mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-20 13:07:52 +09:00
4 files changed
+95
-53
No files matched your search
@@ -103,14 +103,19 @@ _Not all options working now!_
|
||||
## if INPUT is ultrastar.txt ##
|
||||
default Creates all
|
||||
|
||||
[separation]
|
||||
# Default is htdemucs
|
||||
--demucs Model name htdemucs|htdemucs_ft|htdemucs_6s|hdemucs_mmi|mdx|mdx_extra|mdx_q|mdx_extra_q >> ((default) is htdemucs)
|
||||
|
||||
[transcription]
|
||||
# Default is whisper
|
||||
--whisper Multilingual model > tiny|base|small|medium|large-v1|large-v2 >> ((default) is large-v2)
|
||||
--whisper Multilingual model > tiny|base|small|medium|large-v1|large-v2|large-v3 >> ((default) is large-v2)
|
||||
English-only model > tiny.en|base.en|small.en|medium.en
|
||||
--whisper_align_model Use other languages model for Whisper provided from huggingface.co
|
||||
--language Override the language detected by whisper, does not affect transcription but steps after transcription
|
||||
--whisper_batch_size Reduce if low on GPU mem >> ((default) is 16)
|
||||
--whisper_compute_type Change to "int8" if low on GPU mem (may reduce accuracy) >> ((default) is "float16" for cuda devices, "int8" for cpu)
|
||||
--keep_numbers Numbers will be transcribed as numerics instead of as words
|
||||
|
||||
[pitcher]
|
||||
# Default is crepe
|
||||
@@ -118,24 +123,23 @@ _Not all options working now!_
|
||||
--crepe_step_size unit is miliseconds >> ((default) is 10)
|
||||
|
||||
[extra]
|
||||
--hyphenation Use automatic hyphenation > True|False >> ((default) is True)
|
||||
--disable_separation Disable track separation > True|False >> ((default) is False)
|
||||
--disable_karaoke True|False >> ((default) is False)
|
||||
--ignore_audio True|False >> ((default) is False)
|
||||
--create_audio_chunks True|False >> ((default) is False)
|
||||
--keep_cache Keep cache folder after generation > True|False >> ((default) is False)
|
||||
--plot Create a pitch plot > True|False >> ((default) is False)
|
||||
--disable_hyphenation Disable word hyphenation. Hyphenation is enabled by default.
|
||||
--disable_separation Disable track separation. Track separation is enabled by default.
|
||||
--disable_karaoke Disable creation of karaoke style txt file. Karaoke is enabled by default.
|
||||
--create_audio_chunks Enable creation of audio chunks. Audio chunks are disabled by default.
|
||||
--keep_cache Keep cache folder after creation. Cache folder is removed by default.
|
||||
--plot Enable creation of plots. Plots are disabled by default.
|
||||
--format_version 0.3.0|1.0.0|1.1.0|1.2.0 >> ((default) is 1.2.0)
|
||||
--musescore_path path to MuseScore executable
|
||||
--keep_numbers Transcribe numbers as digits and not words > True|False >> ((default) is False)
|
||||
--keep_numbers Transcribe numbers as digits and not words
|
||||
|
||||
[yt-dlp]
|
||||
--cookiefile File name where cookies should be read from
|
||||
|
||||
[device]
|
||||
--force_cpu True|False >> ((default) is False) All steps will be forced to cpu
|
||||
--force_whisper_cpu True|False >> ((default) is False) Only whisper will be forced to cpu
|
||||
--force_crepe_cpu True|False >> ((default) is False) Only crepe will be forced to cpu
|
||||
--force_cpu Force all steps to be processed on CPU.
|
||||
--force_whisper_cpu Only whisper will be forced to cpu
|
||||
--force_crepe_cpu Only crepe will be forced to cpu
|
||||
```
|
||||
|
||||
For standard use, you only need to use [opt]. All other options are optional.
|
||||
@@ -197,10 +201,10 @@ Example for romanian:
|
||||
Is on by default. Can also be deactivated if hyphenation does not produce
|
||||
anything useful. Note that the word is simply split,
|
||||
without paying attention to whether the separated word really
|
||||
starts at the place or is heard.
|
||||
starts at the place or is heard. To disable:
|
||||
|
||||
```commandline
|
||||
-i XYZ --hyphenation True
|
||||
-i XYZ --disable_hyphenation
|
||||
```
|
||||
|
||||
### 👂 Pitcher
|
||||
@@ -220,7 +224,7 @@ The vocals are separated from the audio before they are passed to the models. If
|
||||
you have the option to disable this function; in which case the original audio file is used instead.
|
||||
|
||||
```commandline
|
||||
-i XYZ --disable_separation True
|
||||
-i XYZ --disable_separation
|
||||
```
|
||||
|
||||
### Sheet Music
|
||||
|
||||
+57
-27
@@ -16,6 +16,8 @@ from modules.Audio.vocal_chunks import (
|
||||
create_audio_chunks_from_ultrastar_data,
|
||||
)
|
||||
from modules.Audio.silence_processing import remove_silence_from_transcription_data, mute_no_singing_parts
|
||||
from modules.Speech_Recognition.Whisper import WhisperModel
|
||||
from modules.Audio.separation import DemucsModel
|
||||
|
||||
from modules.Audio.convert_audio import convert_audio_to_mono_wav, convert_wav_to_mp3
|
||||
from modules.Audio.youtube import (
|
||||
@@ -28,7 +30,8 @@ from modules.console_colors import (
|
||||
gold_highlighted,
|
||||
red_highlighted,
|
||||
green_highlighted,
|
||||
cyan_highlighted
|
||||
cyan_highlighted,
|
||||
bright_green_highlighted,
|
||||
)
|
||||
from modules.Midi.midi_creator import (
|
||||
create_midi_segments_from_transcribed_data,
|
||||
@@ -134,7 +137,20 @@ def run() -> tuple[str, Score, Score]:
|
||||
"""The processing function of this program"""
|
||||
#List selected options (can add more later)
|
||||
if settings.keep_numbers:
|
||||
print(f"{ULTRASINGER_HEAD} {cyan_highlighted('Option:')} Numbers will be transcribed as numerics (i.e. 1, 2, 3, etc.)")
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Numbers will be transcribed as numerics (i.e. 1, 2, 3, etc.)')}")
|
||||
if settings.create_plot:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Plot will be created')}")
|
||||
if settings.keep_cache:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Cache folder will not be deleted')}")
|
||||
if settings.create_audio_chunks:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Audio chunks will be created')}")
|
||||
if not settings.create_karaoke:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Karaoke txt will not be created')}")
|
||||
if not settings.use_separated_vocal:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Vocals will not be separated')}")
|
||||
if not settings.hyphenation:
|
||||
print(f"{ULTRASINGER_HEAD} {bright_green_highlighted('Option:')} {cyan_highlighted('Hyphenation will not be applied')}")
|
||||
|
||||
process_data = InitProcessData()
|
||||
|
||||
process_data.process_data_paths.cache_folder_path = (
|
||||
@@ -142,7 +158,7 @@ def run() -> tuple[str, Score, Score]:
|
||||
if settings.cache_override_path is None
|
||||
else settings.cache_override_path
|
||||
)
|
||||
|
||||
|
||||
# Create process audio
|
||||
process_data.process_data_paths.processing_audio_path = CreateProcessAudio(process_data)
|
||||
|
||||
@@ -196,7 +212,7 @@ def run() -> tuple[str, Score, Score]:
|
||||
# Cleanup
|
||||
if not settings.keep_cache:
|
||||
remove_cache_folder(process_data.process_data_paths.cache_folder_path)
|
||||
|
||||
|
||||
# Print Support
|
||||
print_support()
|
||||
return ultrastar_file_output, simple_score, accurate_score
|
||||
@@ -595,7 +611,13 @@ def init_settings(argv: list[str]) -> Settings:
|
||||
settings.output_folder_path = arg
|
||||
elif opt in ("--whisper"):
|
||||
settings.transcriber = "whisper"
|
||||
settings.whisper_model = WhisperModel(arg)
|
||||
|
||||
#Addition of whisper model choice. Added error handling for unknown models.
|
||||
try:
|
||||
settings.whisper_model = WhisperModel(arg)
|
||||
except ValueError as ve:
|
||||
print(f"{ULTRASINGER_HEAD} The model {arg} is not a valid whisper model selection. Please use one of the following models: {blue_highlighted(', '.join([m.value for m in WhisperModel]))}")
|
||||
sys.exit()
|
||||
elif opt in ("--whisper_align_model"):
|
||||
settings.whisper_align_model = arg
|
||||
elif opt in ("--whisper_batch_size"):
|
||||
@@ -603,7 +625,7 @@ def init_settings(argv: list[str]) -> Settings:
|
||||
elif opt in ("--whisper_compute_type"):
|
||||
settings.whisper_compute_type = arg
|
||||
elif opt in ("--keep_numbers"):
|
||||
settings.keep_numbers = arg in ["True", "true"]
|
||||
settings.keep_numbers = True
|
||||
elif opt in ("--language"):
|
||||
settings.language = arg
|
||||
elif opt in ("--crepe"):
|
||||
@@ -611,27 +633,27 @@ def init_settings(argv: list[str]) -> Settings:
|
||||
elif opt in ("--crepe_step_size"):
|
||||
settings.crepe_step_size = int(arg)
|
||||
elif opt in ("--plot"):
|
||||
settings.create_plot = arg in ["True", "true"]
|
||||
settings.create_plot = True
|
||||
elif opt in ("--midi"):
|
||||
settings.create_midi = arg in ["True", "true"]
|
||||
elif opt in ("--hyphenation"):
|
||||
settings.hyphenation = eval(arg.title())
|
||||
settings.create_midi = True
|
||||
elif opt in ("--disable_hyphenation"):
|
||||
settings.hyphenation = False
|
||||
elif opt in ("--disable_separation"):
|
||||
settings.use_separated_vocal = not arg
|
||||
settings.use_separated_vocal = False
|
||||
elif opt in ("--disable_karaoke"):
|
||||
settings.create_karaoke = not arg
|
||||
settings.create_karaoke = False
|
||||
elif opt in ("--create_audio_chunks"):
|
||||
settings.create_audio_chunks = arg
|
||||
elif opt in ("--ignore_audio"):
|
||||
settings.ignore_audio = arg in ["True", "true"]
|
||||
settings.ignore_audio = True
|
||||
elif opt in ("--force_cpu"):
|
||||
settings.force_cpu = arg
|
||||
settings.force_cpu = True
|
||||
if settings.force_cpu:
|
||||
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
||||
elif opt in ("--force_whisper_cpu"):
|
||||
settings.force_whisper_cpu = eval(arg.title())
|
||||
settings.force_whisper_cpu = True
|
||||
elif opt in ("--force_crepe_cpu"):
|
||||
settings.force_crepe_cpu = eval(arg.title())
|
||||
settings.force_crepe_cpu = True
|
||||
elif opt in ("--format_version"):
|
||||
if arg == FormatVersion.V0_3_0.value:
|
||||
settings.format_version = FormatVersion.V0_3_0
|
||||
@@ -646,10 +668,17 @@ def init_settings(argv: list[str]) -> Settings:
|
||||
f"{ULTRASINGER_HEAD} {red_highlighted('Error: Format version')} {blue_highlighted(arg)} {red_highlighted('is not supported.')}"
|
||||
)
|
||||
sys.exit(1)
|
||||
elif opt in ("--keep_cache"):
|
||||
settings.keep_cache = arg
|
||||
elif opt in ("--keep_cache"):
|
||||
settings.keep_cache = True
|
||||
elif opt in ("--musescore_path"):
|
||||
settings.musescore_path = arg
|
||||
#Addition of demucs model choice. Work seems to be needed to make sure syntax is same for models. Added error handling for unknown models
|
||||
elif opt in ("--demucs"):
|
||||
try:
|
||||
settings.demucs_model = DemucsModel(arg)
|
||||
except ValueError as ve:
|
||||
print(f"{ULTRASINGER_HEAD} The model {arg} is not a valid demucs model selection. Please use one of the following models: {blue_highlighted(', '.join([m.value for m in DemucsModel]))}")
|
||||
sys.exit()
|
||||
elif opt in ("--cookiefile"):
|
||||
settings.cookiefile = arg
|
||||
if settings.output_folder_path == "":
|
||||
@@ -665,6 +694,7 @@ def init_settings(argv: list[str]) -> Settings:
|
||||
return settings
|
||||
|
||||
|
||||
#For convenience, made True/False options into noargs
|
||||
def arg_options():
|
||||
short = "hi:o:amv:"
|
||||
long = [
|
||||
@@ -680,19 +710,19 @@ def arg_options():
|
||||
"language=",
|
||||
"plot=",
|
||||
"midi=",
|
||||
"hyphenation=",
|
||||
"disable_separation=",
|
||||
"disable_karaoke=",
|
||||
"create_audio_chunks=",
|
||||
"disable_hyphenation",
|
||||
"disable_separation",
|
||||
"disable_karaoke",
|
||||
"create_audio_chunks",
|
||||
"ignore_audio=",
|
||||
"force_cpu=",
|
||||
"force_whisper_cpu=",
|
||||
"force_crepe_cpu=",
|
||||
"force_cpu",
|
||||
"force_whisper_cpu",
|
||||
"force_crepe_cpu",
|
||||
"format_version=",
|
||||
"keep_cache=",
|
||||
"musescore_path=",
|
||||
"cookiefile=",
|
||||
"keep_numbers="
|
||||
"keep_numbers",
|
||||
"cookiefile="
|
||||
]
|
||||
return long, short
|
||||
|
||||
|
||||
+15
-10
@@ -26,9 +26,14 @@ def print_help() -> None:
|
||||
## INPUT is ultrastar.txt ##
|
||||
default Creates all
|
||||
|
||||
|
||||
[separation]
|
||||
# Default is htdemucs
|
||||
--demucs Model name htdemucs|htdemucs_ft|htdemucs_6s|hdemucs_mmi|mdx|mdx_extra|mdx_q|mdx_extra_q >> ((default) is htdemucs)
|
||||
|
||||
[transcription]
|
||||
# Default is whisper
|
||||
--whisper Multilingual model > tiny|base|small|medium|large-v1|large-v2 >> ((default) is large-v2)
|
||||
--whisper Multilingual model > tiny|base|small|medium|large-v1|large-v2|large-v3 >> ((default) is large-v2)
|
||||
English-only model > tiny.en|base.en|small.en|medium.en
|
||||
--whisper_align_model Use other languages model for Whisper provided from huggingface.co
|
||||
--language Override the language detected by whisper, does not affect transcription but steps after transcription
|
||||
@@ -42,12 +47,12 @@ def print_help() -> None:
|
||||
--crepe_step_size unit is miliseconds >> ((default) is 10)
|
||||
|
||||
[extra]
|
||||
--hyphenation Use automatic hyphenation > True|False >> ((default) is True)
|
||||
--disable_separation Disable track separation > True|False >> ((default) is False)
|
||||
--disable_karaoke True|False >> ((default) is False)
|
||||
--create_audio_chunks True|False >> ((default) is False)
|
||||
--keep_cache Keep cache folder after generation > True|False >> ((default) is False)
|
||||
--plot Create a pitch plot > True|False >> ((default) is False)
|
||||
--disable_hyphenation Disable word hyphenation. Hyphenation is enabled by default.
|
||||
--disable_separation Disable track separation. Track separation is enabled by default.
|
||||
--disable_karaoke Disable creation of karaoke style txt file. Karaoke is enabled by default.
|
||||
--create_audio_chunks Enable creation of audio chunks. Audio chunks are disabled by default.
|
||||
--keep_cache Keep cache folder after creation. Cache folder is removed by default.
|
||||
--plot Enable creation of plots. Plots are disabled by default.
|
||||
--format_version 0.3.0|1.0.0|1.1.0|1.2.0 >> ((default) is 1.2.0)
|
||||
--musescore_path path to MuseScore executable
|
||||
|
||||
@@ -55,9 +60,9 @@ def print_help() -> None:
|
||||
--cookiefile File name where cookies should be read from and dumped to.
|
||||
|
||||
[device]
|
||||
--force_cpu True|False >> ((default) is False) All steps will be forced to cpu
|
||||
--force_whisper_cpu True|False >> ((default) is False) Only whisper will be forced to cpu
|
||||
--force_crepe_cpu True|False >> ((default) is False) Only crepe will be forced to cpu
|
||||
--force_cpu Force all steps to be processed on CPU.
|
||||
--force_whisper_cpu Force whisper transcription to be processed on CPU.
|
||||
--force_crepe_cpu Force crepe pitch detection to be processed on CPU.
|
||||
"""
|
||||
print(help_string)
|
||||
|
||||
|
||||
@@ -32,11 +32,13 @@ def red_highlighted(text: str) -> str:
|
||||
"""Returns a red highlighted text"""
|
||||
return f"{Bcolors.red}{text}{Bcolors.endc}"
|
||||
|
||||
|
||||
def cyan_highlighted(text: str) -> str:
|
||||
"""Returns a cyan highlighted text"""
|
||||
return f"{Bcolors.cyan}{text}{Bcolors.endc}"
|
||||
|
||||
def bright_green_highlighted(text: str) -> str:
|
||||
"""Returns a cyan highlighted text"""
|
||||
return f"{Bcolors.bright_green}{text}{Bcolors.endc}"
|
||||
|
||||
class Bcolors:
|
||||
"""Colors for the console"""
|
||||
@@ -49,3 +51,4 @@ class Bcolors:
|
||||
gold = "\033[93m"
|
||||
underline = "\033[4m"
|
||||
endc = "\033[0m"
|
||||
bright_green = "\033[38;2;204;255;204m"
|
||||
Reference in new issue
Block a user