mirror of
https://github.com/rakuri255/UltraSinger.git
synced 2026-11-20 13:07:52 +09:00
31 files changed
+194
-70
No files matched your search
@@ -0,0 +1,42 @@
|
||||
name: Check Requirements
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "requirements.txt"
|
||||
|
||||
pull_request:
|
||||
paths:
|
||||
- "requirements.txt"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
TARGET: Linux
|
||||
- os: macos-latest
|
||||
TARGET: macOS
|
||||
- os: windows-latest
|
||||
TARGET: Windows
|
||||
python-version: [ "3.10" ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Install gpu dependencies
|
||||
if: matrix.TARGET != 'macOS'
|
||||
run: pip3 install torch==2.0.1+cu117 torchvision==0.15.2+cu117 torchaudio==2.0.2+cu117 --index-url https://download.pytorch.org/whl/cu117
|
||||
@@ -0,0 +1,31 @@
|
||||
name: Pylint
|
||||
|
||||
#on: [push]
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "none.txt"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10"]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pylint
|
||||
|
||||
- name: Analysing the code with pylint
|
||||
run: |
|
||||
pylint $(git ls-files '*.py')
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Pytest
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [ "3.10" ]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
#pip install -e .
|
||||
|
||||
- name: Run pytest
|
||||
run: python -m pytest --import-mode=append pytest/
|
||||
@@ -1,8 +1,12 @@
|
||||
[](https://discord.gg/7EqhhjFd)
|
||||

|
||||

|
||||
[](https://github.com/rakuri255/UltraSinger/blob/main/LICENSE)
|
||||
[](https://www.codefactor.io/repository/github/rakuri255/ultrasinger)
|
||||
|
||||
[](https://github.com/rakuri255/UltraSinger/actions/workflows/main.yml)
|
||||
[](https://github.com/rakuri255/UltraSinger/actions/workflows/pytest.yml)
|
||||
|
||||
# UltraSinger
|
||||
|
||||
> ⚠️ _This project is still under development!_
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
"""Tests for ultrastar_converter.py"""
|
||||
|
||||
from src.modules.Ultrastar.ultrastar_converter import real_bpm_to_ultrastar_bpm
|
||||
|
||||
|
||||
def test_real_bpm_to_ultrastar_bpm():
|
||||
"""Test case for real_bpm_to_ultrastar_bpm function."""
|
||||
# Real BPM is a multiple of 4
|
||||
assert real_bpm_to_ultrastar_bpm(120) == 30
|
||||
|
||||
# Real BPM is not a multiple of 4
|
||||
assert real_bpm_to_ultrastar_bpm(130) == 32.5
|
||||
|
||||
# Real BPM is zero
|
||||
assert real_bpm_to_ultrastar_bpm(0) == 0
|
||||
|
||||
# Real BPM is a decimal number
|
||||
assert real_bpm_to_ultrastar_bpm(123.45) == 30.8625
|
||||
|
||||
# Real BPM is a large number
|
||||
assert real_bpm_to_ultrastar_bpm(1000000) == 250000
|
||||
|
||||
# Real BPM is a small number
|
||||
assert real_bpm_to_ultrastar_bpm(0.001) == 0.00025
|
||||
+2
-1
@@ -4,7 +4,7 @@ pretty_midi~=0.2.10
|
||||
pydub==0.25.1
|
||||
Levenshtein~=0.21.0
|
||||
scipy~=1.10.1
|
||||
vosk==0.3.45
|
||||
vosk==0.3.44
|
||||
tensorflow~=2.12.0
|
||||
#tensorflow-directml-plugin~=0.4.0.dev230202
|
||||
#cudatoolkit==11.8.0
|
||||
@@ -21,3 +21,4 @@ Pillow~=9.5.0
|
||||
isort==5.12
|
||||
black==23.3
|
||||
pylint==2.17
|
||||
pytest~=7.3.1
|
||||
File renamed without changes.
@@ -5,60 +5,54 @@ import getopt
|
||||
import os
|
||||
import sys
|
||||
from time import sleep
|
||||
from typing import Tuple, Any
|
||||
|
||||
import Levenshtein
|
||||
import librosa
|
||||
from matplotlib import pyplot as plt
|
||||
from tqdm import tqdm
|
||||
|
||||
from modules import os_helper
|
||||
from modules.Audio.denoise import ffmpeg_reduce_noise
|
||||
from modules.Audio.separation import separate_audio
|
||||
from modules.Audio.vocal_chunks import (
|
||||
from src.modules import os_helper
|
||||
from src.modules.Audio.denoise import ffmpeg_reduce_noise
|
||||
from src.modules.Audio.separation import separate_audio
|
||||
from src.modules.Audio.vocal_chunks import (
|
||||
export_chunks_from_transcribed_data,
|
||||
export_chunks_from_ultrastar_data,
|
||||
)
|
||||
from modules.Audio.silence_processing import remove_silence_from_transcribtion_data
|
||||
from modules.csv_handler import export_transcribed_data_to_csv
|
||||
from modules.Audio.convert_audio import convert_audio_to_mono_wav, convert_wav_to_mp3
|
||||
from modules.Audio.youtube import (
|
||||
from src.modules.Audio.silence_processing import remove_silence_from_transcribtion_data
|
||||
from src.modules.csv_handler import export_transcribed_data_to_csv
|
||||
from src.modules.Audio.convert_audio import convert_audio_to_mono_wav, convert_wav_to_mp3
|
||||
from src.modules.Audio.youtube import (
|
||||
download_youtube_audio,
|
||||
download_youtube_thumbnail,
|
||||
download_youtube_video,
|
||||
get_youtube_title,
|
||||
)
|
||||
from modules.DeviceDetection.device_detection import get_available_device
|
||||
from modules.console_colors import (
|
||||
from src.modules.DeviceDetection.device_detection import get_available_device
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
gold_highlighted,
|
||||
light_blue_highlighted,
|
||||
red_highlighted,
|
||||
)
|
||||
from modules.Midi import midi_creator
|
||||
from modules.Midi.midi_creator import (
|
||||
from src.modules.Midi import midi_creator
|
||||
from src.modules.Midi.midi_creator import (
|
||||
convert_frequencies_to_notes,
|
||||
create_midi_notes_from_pitched_data,
|
||||
most_frequent,
|
||||
)
|
||||
from modules.Pitcher.pitcher import (
|
||||
from src.modules.Pitcher.pitcher import (
|
||||
get_frequency_with_high_confidence,
|
||||
get_pitch_with_crepe_file,
|
||||
)
|
||||
from modules.Pitcher.pitched_data import PitchedData
|
||||
from modules.Speech_Recognition.hyphenation import hyphenation, language_check
|
||||
from modules.Speech_Recognition.Vosk import transcribe_with_vosk
|
||||
from modules.Speech_Recognition.Whisper import transcribe_with_whisper
|
||||
from modules.Ultrastar import (
|
||||
ultrastar_converter,
|
||||
ultrastar_parser,
|
||||
ultrastar_score_calculator,
|
||||
ultrastar_writer,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from src.modules.Pitcher.pitched_data import PitchedData
|
||||
from src.modules.Speech_Recognition.hyphenation import hyphenation, language_check
|
||||
from src.modules.Speech_Recognition.Vosk import transcribe_with_vosk
|
||||
from src.modules.Speech_Recognition.Whisper import transcribe_with_whisper
|
||||
from src.modules.Ultrastar import ultrastar_score_calculator, ultrastar_writer, ultrastar_converter, ultrastar_parser
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from Settings import Settings
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
|
||||
settings = Settings()
|
||||
|
||||
@@ -792,7 +786,7 @@ def init_settings(argv: list[str]) -> None:
|
||||
dirname = os.getcwd()
|
||||
else:
|
||||
dirname = os.path.dirname(settings.input_file_path)
|
||||
settings.output_file_path = os.path.join(dirname, "output")
|
||||
settings.output_file_path = os.path.join(dirname, "../output")
|
||||
settings.device = get_available_device()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from pydub import AudioSegment
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
|
||||
|
||||
def convert_audio_to_mono_wav(input_file: str, output_file: str) -> None:
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import ffmpeg
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD, blue_highlighted
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD, blue_highlighted
|
||||
|
||||
|
||||
def ffmpeg_reduce_noise(input_file_path: str, output_file: str) -> None:
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
import subprocess
|
||||
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
red_highlighted,
|
||||
)
|
||||
from modules.os_helper import current_executor_path, move, path_join
|
||||
from src.modules.os_helper import current_executor_path, move, path_join
|
||||
|
||||
|
||||
def separate_audio(input_file_path: str, output_file: str, device="cpu") -> None:
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import librosa
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
|
||||
|
||||
def remove_silence_from_transcribtion_data(audio_path: str, transcribed_data: list[TranscribedData]) -> list[TranscribedData]:
|
||||
@@ -4,13 +4,13 @@ import os
|
||||
import re
|
||||
import wave
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.os_helper import create_folder
|
||||
from modules.Ultrastar.ultrastar_converter import (
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.os_helper import create_folder
|
||||
from src.modules.Ultrastar.ultrastar_converter import (
|
||||
get_end_time_from_ultrastar,
|
||||
get_start_time_from_ultrastar,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
|
||||
|
||||
class AudioManipulation:
|
||||
@@ -6,7 +6,7 @@ import os
|
||||
import yt_dlp
|
||||
from PIL import Image
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
|
||||
|
||||
def get_youtube_title(url: str) -> str:
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import torch
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD, red_highlighted
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD, red_highlighted
|
||||
|
||||
|
||||
def get_available_device() -> str:
|
||||
@@ -7,18 +7,18 @@ import librosa
|
||||
import numpy as np
|
||||
import pretty_midi
|
||||
|
||||
from modules.Pitcher.pitcher import get_frequency_with_high_confidence
|
||||
from modules.Ultrastar.ultrastar_converter import (
|
||||
from src.modules.Pitcher.pitcher import get_frequency_with_high_confidence
|
||||
from src.modules.Ultrastar.ultrastar_converter import (
|
||||
get_end_time_from_ultrastar,
|
||||
get_start_time_from_ultrastar,
|
||||
ultrastar_note_to_midi_note,
|
||||
)
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
red_highlighted,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from modules.Pitcher.pitched_data import PitchedData
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from src.modules.Pitcher.pitched_data import PitchedData
|
||||
|
||||
|
||||
def convert_ultrastar_to_midi_instrument(ultrastar_class: UltrastarTxtValue) -> object:
|
||||
File renamed without changes.
@@ -3,12 +3,12 @@
|
||||
import crepe
|
||||
from scipy.io import wavfile
|
||||
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
red_highlighted,
|
||||
)
|
||||
from modules.Pitcher.pitched_data import PitchedData
|
||||
from src.modules.Pitcher.pitched_data import PitchedData
|
||||
|
||||
|
||||
def get_pitch_with_crepe_file(filename: str, step_size: int, model_capacity: str) -> PitchedData:
|
||||
File renamed without changes.
@@ -5,8 +5,8 @@ import wave
|
||||
|
||||
from vosk import KaldiRecognizer, Model
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
|
||||
# todo: Rename to Transcoder?
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
import whisperx
|
||||
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
red_highlighted,
|
||||
)
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
|
||||
|
||||
def transcribe_with_whisper(audio_path: str, model: str, device="cpu") -> (list[TranscribedData], str):
|
||||
+1
-1
@@ -4,7 +4,7 @@ import string
|
||||
|
||||
from hyphen import Hyphenator, dictools
|
||||
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
)
|
||||
+1
-1
@@ -6,7 +6,7 @@ import speech_recognition as sr
|
||||
from pydub import AudioSegment
|
||||
from pydub.silence import split_on_silence
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
|
||||
# todo: Code from here: https://www.thepythoncode.com/article/using-speech-recognition-to-convert-speech-to-text-python
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
"""Ultrastar Converter"""
|
||||
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
|
||||
def real_bpm_to_ultrastar_bpm(real_bpm: float) -> float:
|
||||
"""Converts real BPM to UltraStar BPM"""
|
||||
@@ -1,11 +1,11 @@
|
||||
"""Ultrastar txt parser"""
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.Ultrastar.ultrastar_converter import (
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.Ultrastar.ultrastar_converter import (
|
||||
get_end_time_from_ultrastar,
|
||||
get_start_time_from_ultrastar,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue, UltrastarTxtTag, UltrastarTxtNoteTypeTag, FILE_ENCODING
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue, UltrastarTxtTag, UltrastarTxtNoteTypeTag, FILE_ENCODING
|
||||
|
||||
def parse_ultrastar_txt(input_file: str) -> UltrastarTxtValue:
|
||||
"""Parse ultrastar txt file to UltrastarTxt class"""
|
||||
+5
-5
@@ -2,7 +2,7 @@
|
||||
|
||||
import librosa
|
||||
|
||||
from modules.console_colors import (
|
||||
from src.modules.console_colors import (
|
||||
ULTRASINGER_HEAD,
|
||||
blue_highlighted,
|
||||
cyan_highlighted,
|
||||
@@ -10,14 +10,14 @@ from modules.console_colors import (
|
||||
light_blue_highlighted,
|
||||
underlined,
|
||||
)
|
||||
from modules.Midi.midi_creator import create_midi_note_from_pitched_data
|
||||
from modules.Ultrastar.ultrastar_converter import (
|
||||
from src.modules.Midi.midi_creator import create_midi_note_from_pitched_data
|
||||
from src.modules.Ultrastar.ultrastar_converter import (
|
||||
get_end_time_from_ultrastar,
|
||||
get_start_time_from_ultrastar,
|
||||
ultrastar_note_to_midi_note,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from modules.Pitcher.pitched_data import PitchedData
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue
|
||||
from src.modules.Pitcher.pitched_data import PitchedData
|
||||
|
||||
MAX_SONG_SCORE = 10000
|
||||
MAX_SONG_LINE_BONUS = 1000
|
||||
File renamed without changes.
@@ -4,14 +4,14 @@ import re
|
||||
|
||||
import langcodes
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.Ultrastar.ultrastar_converter import (
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.Ultrastar.ultrastar_converter import (
|
||||
real_bpm_to_ultrastar_bpm,
|
||||
second_to_beat,
|
||||
)
|
||||
from modules.Ultrastar.ultrastar_txt import UltrastarTxtValue, UltrastarTxtTag, UltrastarTxtNoteTypeTag, FILE_ENCODING
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from modules.Ultrastar.ultrastar_score_calculator import Score
|
||||
from src.modules.Ultrastar.ultrastar_txt import UltrastarTxtValue, UltrastarTxtTag, UltrastarTxtNoteTypeTag, FILE_ENCODING
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.Ultrastar.ultrastar_score_calculator import Score
|
||||
|
||||
|
||||
def get_multiplier(real_bpm: float) -> int:
|
||||
File renamed without changes.
@@ -2,8 +2,8 @@
|
||||
|
||||
import csv
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.Speech_Recognition.TranscribedData import TranscribedData
|
||||
|
||||
|
||||
def export_transcribed_data_to_csv(transcribed_data: list[TranscribedData], filename: str) -> None:
|
||||
@@ -3,7 +3,7 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from modules.console_colors import ULTRASINGER_HEAD
|
||||
from src.modules.console_colors import ULTRASINGER_HEAD
|
||||
|
||||
|
||||
def create_folder(folder_name: str) -> None:
|
||||
Reference in new issue
Block a user