mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-20 13:07:52 +09:00
Merge branch 'main' into Write_language_to_ultrastar
This commit is contained in:
commit
d2c36cb177
5 files changed
+67
-40
No files matched your search
@@ -22,7 +22,33 @@ This will help me alot to keep this project alive and improve it.
|
||||
<a href="https://www.buymeacoffee.com/rakuri255" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
||||
<a href="https://patreon.com/Rakuri"><img src="https://raw.githubusercontent.com/rakuri255/UltraSinger/main/assets/patreon.png" alt="Become a Patron" style="height: 60px !important;width: 217px !important;"/> </a>
|
||||
|
||||
## How to use
|
||||
## How to use this source code
|
||||
|
||||
### With Console (Windows)
|
||||
|
||||
* Install Python 3.10 (older and newer versions has some breaking changes). [Download](https://www.python.org/downloads/)
|
||||
* Also install ffmpeg separately with PATH. [Download](https://www.ffmpeg.org/download.html)
|
||||
* Open a console (CMD) and navigate to the project folder.
|
||||
* Type `py -m venv .venv` and press enter. If this does not work, try instead of `py` `python` or `python3`.
|
||||
* This will always take the newest Python version. If you have multiple versions installed, you can use `py -0p` to see all installed versions.
|
||||
* Build with correct version use `py -3.10 -m venv .venv`.
|
||||
* Wait until the console is done with creating the environment. This can take a while.
|
||||
* Type `.venv\Scripts\activate` and press enter.
|
||||
* You should see now a `(.venv)` in front of your console line.
|
||||
* Install the requirements with `pip install -r requirements.txt`.
|
||||
* Now you can use the UltraSinger source code with `py UltraSinger.py [opt] [mode] [transcription] [pitcher] [extra]`. See [How to use](#how-to-use) for more information.
|
||||
|
||||
For more information about Python environments look [here](https://code.visualstudio.com/docs/python/environments#_global-virtual-or-conda-environments).
|
||||
|
||||
As copy:
|
||||
|
||||
```commandline
|
||||
py -m venv .venv
|
||||
.venv\Scripts\activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## How to use the App
|
||||
|
||||
_Not all options working now!_
|
||||
```commandline
|
||||
@@ -52,8 +78,8 @@ _Not all options working now!_
|
||||
(-m Create midi file) # In Progress
|
||||
|
||||
[transcription]
|
||||
# Default is whisper tiny
|
||||
--whisper tiny|base|small|medium|large
|
||||
# Default is whisper
|
||||
--whisper tiny|base|small|medium|large >> ((default) is large)
|
||||
--vosk Needs model
|
||||
|
||||
[extra]
|
||||
@@ -63,8 +89,8 @@ _Not all options working now!_
|
||||
--create_audio_chunks True|False >> ((default) is False)
|
||||
|
||||
[pitcher]
|
||||
# Default is crepe full
|
||||
--crepe tiny|small|medium|large|full
|
||||
# Default is crepe
|
||||
--crepe tiny|small|medium|large|full >> ((default) is full)
|
||||
```
|
||||
|
||||
For standard use, you only need to use [opt]. All other options are optional.
|
||||
@@ -159,14 +185,3 @@ for low male voices. Accurate is the real tone specified in the txt. I had txt f
|
||||
singable by humans, but you could still reach the 10k points in the game. The accuracy is important here, because from
|
||||
this MIDI and sheet are created. And you also want to have accurate files
|
||||
|
||||
## How to use this source code
|
||||
|
||||
Install Python 3.10 (older and newer versions has some breaking changes).
|
||||
You should install and use `venv` or `conda`.
|
||||
For VSCode look [here](https://code.visualstudio.com/docs/python/environments#_global-virtual-or-conda-environments).
|
||||
|
||||
After that you need to install the requirements from `requirements.txt`.
|
||||
|
||||
Also install ffmpeg separately.
|
||||
|
||||
Then just use the `How to use` commands, described above.
|
||||
@@ -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("{} Transcribing with {} and model {} and {} as worker".format(PRINT_ULTRASTAR,
|
||||
print("{} Pitching with {} and model {} and {} as worker".format(PRINT_ULTRASTAR,
|
||||
print_blue_highlighted_text("crepe"),
|
||||
print_blue_highlighted_text(model_capacity),
|
||||
print_red_highlighted_text("cpu")))
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
from moduls.Midi.midi_creator import create_midi_note_from_pitched_data
|
||||
from moduls.Ultrastar.ultrastar_converter import get_start_time_from_ultrastar, get_end_time_from_ultrastar, \
|
||||
ultrastar_note_to_midi_note
|
||||
from moduls.Log import PRINT_ULTRASTAR, print_blue_highlighted_text, print_gold_highlighted_text, print_light_blue_highlighted_text, print_underlined_text, print_cyan_highlighted_text
|
||||
from moduls.Log import PRINT_ULTRASTAR, print_blue_highlighted_text, print_gold_highlighted_text, \
|
||||
print_light_blue_highlighted_text, print_underlined_text, print_cyan_highlighted_text
|
||||
import librosa
|
||||
|
||||
# Todo: LineBonus
|
||||
# if (Ini.LineBonus > 0) then
|
||||
# MaxSongPoints := MAX_SONG_SCORE - MAX_SONG_LINE_BONUS
|
||||
# else
|
||||
# MaxSongPoints := MAX_SONG_SCORE;
|
||||
|
||||
MAX_SONG_SCORE = 10000
|
||||
MAX_SONG_LINE_BONUS = 1000
|
||||
|
||||
@@ -36,11 +31,14 @@ def add_point(noteType, points):
|
||||
|
||||
|
||||
def print_score(points):
|
||||
notes = MAX_SONG_SCORE * (points.notes + points.rap) / points.parts
|
||||
line_bonus = 0
|
||||
# todo: here also a score calculation !?!
|
||||
max_score = MAX_SONG_SCORE if points.line_bonus == 0 else MAX_SONG_SCORE - MAX_SONG_LINE_BONUS
|
||||
notes = max_score * (points.notes + points.rap) / points.parts
|
||||
golden = points.golden_notes + points.golden_rap
|
||||
score = notes + line_bonus + golden
|
||||
print(PRINT_ULTRASTAR + " Total: {}, notes: {}, line bonus: {}, golden notes: {}".format(print_cyan_highlighted_text(str(round(score))), print_blue_highlighted_text(str(round(notes))), print_light_blue_highlighted_text(str(round(line_bonus))), print_gold_highlighted_text(str(round(golden)))))
|
||||
score = notes + points.line_bonus + golden
|
||||
print(PRINT_ULTRASTAR + " Total: {}, notes: {}, line bonus: {}, golden notes: {}".format(
|
||||
print_cyan_highlighted_text(str(round(score))), print_blue_highlighted_text(str(round(notes))),
|
||||
print_light_blue_highlighted_text(str(round(points.line_bonus))), print_gold_highlighted_text(str(round(golden)))))
|
||||
|
||||
|
||||
def print_score_calculation(pitched_data, ultrastar_class):
|
||||
@@ -49,6 +47,8 @@ def print_score_calculation(pitched_data, ultrastar_class):
|
||||
simple_points = Points()
|
||||
accurate_points = Points()
|
||||
|
||||
reachable_line_bonus_per_word = MAX_SONG_LINE_BONUS / len(ultrastar_class.words)
|
||||
|
||||
for i in range(len(ultrastar_class.words)):
|
||||
if ultrastar_class.words == "":
|
||||
continue
|
||||
@@ -59,30 +59,42 @@ def print_score_calculation(pitched_data, ultrastar_class):
|
||||
start_time = get_start_time_from_ultrastar(ultrastar_class, i)
|
||||
end_time = get_end_time_from_ultrastar(ultrastar_class, i)
|
||||
duration = end_time - start_time
|
||||
parts_len = 0.01
|
||||
parts = duration / parts_len
|
||||
step_size = 0.01 # todo: should be beat length ?
|
||||
parts = int(duration / step_size)
|
||||
parts = 1 if parts == 0 else parts
|
||||
|
||||
accurate_part_line_bonus_points = 0
|
||||
simple_part_line_bonus_points = 0
|
||||
|
||||
ultrastar_midi_note = ultrastar_note_to_midi_note(int(ultrastar_class.pitches[i]))
|
||||
ultrastar_note = librosa.midi_to_note(ultrastar_midi_note)
|
||||
|
||||
for p in range(int(parts)):
|
||||
st = start_time + parts_len * p
|
||||
end = st + parts_len
|
||||
for p in range(parts):
|
||||
st = start_time + step_size * p
|
||||
end = st + step_size
|
||||
pitch_note = create_midi_note_from_pitched_data(st, end, pitched_data)
|
||||
|
||||
if pitch_note[:-1] == ultrastar_note[:-1]:
|
||||
accurate_points = add_point(ultrastar_class.noteType[i], accurate_points)
|
||||
# Ignore octave high
|
||||
simple_points = add_point(ultrastar_class.noteType[i], simple_points)
|
||||
simple_part_line_bonus_points += 1
|
||||
|
||||
if pitch_note == ultrastar_note:
|
||||
simple_points = add_point(ultrastar_class.noteType[i], simple_points)
|
||||
# Octave high must be the same
|
||||
accurate_points = add_point(ultrastar_class.noteType[i], accurate_points)
|
||||
accurate_part_line_bonus_points += 1
|
||||
|
||||
accurate_points.parts += 1
|
||||
simple_points.parts += 1
|
||||
|
||||
# todo: line_bonus
|
||||
if accurate_part_line_bonus_points >= parts:
|
||||
accurate_points.line_bonus += reachable_line_bonus_per_word
|
||||
|
||||
print("{} {} points".format(PRINT_ULTRASTAR, print_underlined_text("Simple")))
|
||||
if simple_part_line_bonus_points >= parts:
|
||||
simple_points.line_bonus += reachable_line_bonus_per_word
|
||||
|
||||
print("{} {} points".format(PRINT_ULTRASTAR, print_underlined_text("Simple (octave high ignored)")))
|
||||
print_score(simple_points)
|
||||
|
||||
print("{} {} points:".format(PRINT_ULTRASTAR, print_underlined_text("Accurate")))
|
||||
print("{} {} points:".format(PRINT_ULTRASTAR, print_underlined_text("Accurate (octave high matches)")))
|
||||
print_score(accurate_points)
|
||||
@@ -73,7 +73,7 @@ def create_ultrastar_txt_from_automation(transcribed_data, note_numbers, ultrast
|
||||
else:
|
||||
silence = 0
|
||||
|
||||
if silence > 0.3:
|
||||
if silence > 0.3 and i != len(transcribed_data) - 1:
|
||||
# - 10
|
||||
# '-' end of current sing part
|
||||
# 'n1' show next at time in real beat
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ pydub==0.25.1
|
||||
Levenshtein==0.20.9
|
||||
scipy==1.10.0
|
||||
vosk==0.3.45
|
||||
tensorflow~=2.11.0
|
||||
tensorflow~=2.12.0
|
||||
matplotlib~=3.7.1
|
||||
yt_dlp~=2023.3.4
|
||||
numpy~=1.23.5
|
||||
|
||||
Reference in new issue
Block a user