Merge pull request #42 from bohning/main

Fix f-strings.
This commit is contained in:
Vadim Rangnau authored and GitHub committed 2023-05-28 15:24:34 +02:00
commit e509c59fdc
8 files changed
+21 -20

No files matched your search

+3
View File
@@ -2,5 +2,8 @@
venv
.venv
# python
**__pycache__
# default output folder
output
+10 -12
View File
@@ -59,7 +59,7 @@ def convert_ultrastar_note_numbers(midi_notes):
def pitch_each_chunk_with_crepe(directory):
print(f"{PRINT_ULTRASTAR} Pitching each chunk with {print_blue_highlighted_text("crepe")})
print(f"{PRINT_ULTRASTAR} Pitching each chunk with {print_blue_highlighted_text('crepe')}")
midi_notes = []
for filename in sorted([f for f in os.listdir(directory) if f.endswith('.wav')],
@@ -196,9 +196,7 @@ def hyphenate_each_word(language, transcribed_data):
hyphenated_word = []
lang_region = language_check(language)
if lang_region is None:
print("{} {} {}".format(PRINT_ULTRASTAR, print_red_highlighted_text("Error in hyphenation for language "),
print_blue_highlighted_text(language),
print_red_highlighted_text("maybe you want to disable it?")))
print(f"{PRINT_ULTRASTAR} {print_red_highlighted_text('Error in hyphenation for language ')} {print_blue_highlighted_text(language)} {print_red_highlighted_text(', maybe you want to disable it?')}")
return None
sleep(.1)
@@ -209,9 +207,9 @@ def hyphenate_each_word(language, transcribed_data):
def print_support():
print()
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text("Do you like UltraSinger? And want it to be even better? Then help with your")} {print_light_blue_highlighted_text("support")}{print_gold_highlighted_text("!")}")
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text('Do you like UltraSinger? And want it to be even better? Then help with your')} {print_light_blue_highlighted_text('support')}{print_gold_highlighted_text('!')}")
print(f"{PRINT_ULTRASTAR} See project page -> https://github.com/rakuri255/UltraSinger")
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text("This will help alot to keep this project alive and improved.")}"
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text('This will help alot to keep this project alive and improved.')}")
def run():
@@ -220,13 +218,13 @@ def run():
real_bpm = None
if not isAudio: # Parse Ultrastar txt
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text("re-pitch mode")}"
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text('re-pitch mode')}")
basename_without_ext, real_bpm, song_output, ultrastar_audio_input_path, ultrastar_class = parse_ultrastar_txt()
elif settings.input_file_path.startswith('https:'): # Youtube
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text("full automatic mode")}")
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text('full automatic mode')}")
basename_without_ext, song_output, ultrastar_audio_input_path = download_from_youtube()
else: # Audio File
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text("full automatic mode")}")
print(f"{PRINT_ULTRASTAR} {print_gold_highlighted_text('full automatic mode')}")
basename_without_ext, song_output, ultrastar_audio_input_path = setup_audio_input_file()
cache_path = os.path.join(song_output, 'cache')
@@ -317,9 +315,9 @@ def calculate_score_points(isAudio, pitched_data, ultrastar_class, ultrastar_fil
ultrastar_class = ultrastar_parser.parse_ultrastar_txt(ultrastar_file_output)
ultrastar_score_calculator.print_score_calculation(pitched_data, ultrastar_class)
else:
print(f"{PRINT_ULTRASTAR} {print_blue_highlighted_text("Score of original Ultrastar txt")}")
print(f"{PRINT_ULTRASTAR} {print_blue_highlighted_text('Score of original Ultrastar txt')}")
ultrastar_score_calculator.print_score_calculation(pitched_data, ultrastar_class)
print(f"{PRINT_ULTRASTAR} {print_blue_highlighted_text("Score of re-pitched Ultrastar txt")}")
print(f"{PRINT_ULTRASTAR} {print_blue_highlighted_text('Score of re-pitched Ultrastar txt')}")
ultrastar_class = ultrastar_parser.parse_ultrastar_txt(ultrastar_file_output)
ultrastar_score_calculator.print_score_calculation(pitched_data, ultrastar_class)
return ultrastar_class
@@ -408,7 +406,7 @@ def parse_ultrastar_txt():
def create_midi_file(isAudio, real_bpm, song_output, ultrastar_class):
print(f"{PRINT_ULTRASTAR} Creating Midi with {print_blue_highlighted_text("pretty_midi")}")
print(f"{PRINT_ULTRASTAR} Creating Midi with {print_blue_highlighted_text('pretty_midi')}")
if isAudio:
voice_instrument = [midi_creator.convert_ultrastar_to_midi_instrument(ultrastar_class)]
midi_output = os.path.join(song_output, ultrastar_class.title + '.mid')
+1 -1
View File
@@ -13,7 +13,7 @@ def ffmpeg_reduce_noise(input_file_path, output_file):
# track_noise, tn
# Enable noise floor tracking. By default is disabled. With this enabled, noise floor is automatically adjusted.
print(f"{PRINT_ULTRASTAR} Reduce noise from vocal audio with {print_blue_highlighted_text("ffmpeg")}.")
print(f"{PRINT_ULTRASTAR} Reduce noise from vocal audio with {print_blue_highlighted_text('ffmpeg')}.")
(
ffmpeg
.input(input_file_path)
+1 -1
View File
@@ -4,7 +4,7 @@ from moduls.Log import PRINT_ULTRASTAR, print_blue_highlighted_text, print_red_h
def separate_audio(input_file_path, output_file, device="cpu"):
print(f"{PRINT_ULTRASTAR} Separating vocals from audio with {print_blue_highlighted_text("demucs")} and {print_red_highlighted_text(device)} as worker.")
print(f"{PRINT_ULTRASTAR} Separating vocals from audio with {print_blue_highlighted_text('demucs')} and {print_red_highlighted_text(device)} as worker.")
# Model selection?
# -n mdx_q
# -n htdemucs_ft
+2 -2
View File
@@ -7,7 +7,7 @@ def get_available_device():
gpus = tf.config.list_physical_devices('GPU')
if not gpus:
print(f"{PRINT_ULTRASTAR} There are no GPUs available. Using {print_red_highlighted_text("cpu")}.")
print(f"{PRINT_ULTRASTAR} There are no GPUs available. Using {print_red_highlighted_text('cpu')}.")
return "cpu"
print(f"{PRINT_ULTRASTAR} Found available GPUs:")
@@ -15,5 +15,5 @@ def get_available_device():
print("Name:", gpu.name, " Type:", gpu.device_type)
# Todo: Finish this
print("{PRINT_ULTRASTAR} GPU usage are currently in development. Using {print_red_highlighted_text("cpu")}")
print(f"{PRINT_ULTRASTAR} GPU usage are currently in development. Using {print_red_highlighted_text('cpu')}")
return "cpu"
+1 -1
View File
@@ -7,7 +7,7 @@ from moduls.Log import print_blue_highlighted_text, print_red_highlighted_text
def get_pitch_with_crepe_file(filename, step_size, model_capacity):
print(f"{PRINT_ULTRASTAR} Pitching with {print_blue_highlighted_text("crepe")} and model {print_blue_highlighted_text(model_capacity)} and {print_red_highlighted_text("cpu")} as worker")
print(f"{PRINT_ULTRASTAR} Pitching with {print_blue_highlighted_text('crepe')} and model {print_blue_highlighted_text(model_capacity)} and {print_red_highlighted_text('cpu')} as worker")
# Todo: add GPU support by using torchcrepe
sr, audio = wavfile.read(filename)
+1 -1
View File
@@ -5,7 +5,7 @@ from moduls.Log import print_blue_highlighted_text, print_red_highlighted_text
def transcribe_with_whisper(audioPath, model, device="cpu"):
print(f"{PRINT_ULTRASTAR} Loading {print_blue_highlighted_text("whisper")} with model {print_blue_highlighted_text(model)} and {print_red_highlighted_text(device)} as worker")
print(f"{PRINT_ULTRASTAR} Loading {print_blue_highlighted_text('whisper')} with model {print_blue_highlighted_text(model)} and {print_red_highlighted_text(device)} as worker")
model = whisper.load_model(model, device=device)
@@ -91,8 +91,8 @@ def print_score_calculation(pitched_data, ultrastar_class):
if simple_part_line_bonus_points >= parts:
simple_points.line_bonus += reachable_line_bonus_per_word
print(f"{PRINT_ULTRASTAR} {print_underlined_text("Simple (octave high ignored)")} points")
print(f"{PRINT_ULTRASTAR} {print_underlined_text('Simple (octave high ignored)')} points")
print_score(simple_points)
print(f"{PRINT_ULTRASTAR} {print_underlined_text("Accurate (octave high matches)")} points:")
print(f"{PRINT_ULTRASTAR} {print_underlined_text('Accurate (octave high matches)')} points:")
print_score(accurate_points)