Skip to content

Commit b242c3f

Browse files
committed
made all Voice-Pro code open source and completely free
1 parent cab8e1c commit b242c3f

179 files changed

Lines changed: 22365 additions & 543 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Azure Configuration
2+
# Copy this file to .env and fill in your Azure credentials
3+
# Do NOT commit .env to version control
4+
5+
# Azure Speech Service (TTS)
6+
AZURE_SPEECH_KEY=your_azure_speech_key_here
7+
AZURE_SPEECH_REGION=eastus
8+
9+
# Azure Translator Service
10+
AZURE_TRANSLATOR_KEY=your_azure_translator_key_here
11+
AZURE_TRANSLATOR_ENDPOINT=https://your-translator-resource.cognitiveservices.azure.com/
12+
AZURE_TRANSLATOR_REGION=eastus

LICENSE

Lines changed: 674 additions & 21 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 95 additions & 114 deletions
Large diffs are not rendered by default.

app/abus_aicover.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import gc
2+
import librosa
3+
import soundfile as sf
4+
from pydub import AudioSegment
5+
from pedalboard import Pedalboard, Reverb, Compressor, HighpassFilter
6+
from pedalboard.io import AudioFile
7+
8+
from src.aicover.rvc import Config, load_hubert, get_vc, rvc_infer
9+
10+
11+
from app.abus_path import *
12+
13+
14+
def rvc_change_voice(input_path, output_path, rvc_voice, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length):
15+
voice_model_folder = os.path.join(os.getcwd(), 'model', 'rvc-voice', rvc_voice)
16+
voice_pth_path = path_subfile(voice_model_folder, ".pth")
17+
voice_index_path = path_subfile(voice_model_folder, ".index")
18+
19+
device = 'cuda:0'
20+
config = Config(device, False)
21+
hubert_model = load_hubert(device, config.is_half, os.path.join(os.getcwd(), 'model', 'rvc-model', 'hubert_base.pt'))
22+
cpt, version, net_g, tgt_sr, vc = get_vc(device, config.is_half, config, voice_pth_path)
23+
24+
# convert main vocals
25+
rvc_infer(voice_index_path, index_rate, input_path, output_path, pitch_change, f0_method, cpt, version, net_g, filter_radius, tgt_sr, rms_mix_rate, protect, crepe_hop_length, vc, hubert_model)
26+
del hubert_model, cpt
27+
gc.collect()
28+
29+
30+
def rvc_add_effects(input_path, output_path, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping):
31+
# Initialize audio effects plugins
32+
board = Pedalboard(
33+
[
34+
HighpassFilter(),
35+
Compressor(ratio=4, threshold_db=-15),
36+
Reverb(room_size=reverb_rm_size, dry_level=reverb_dry, wet_level=reverb_wet, damping=reverb_damping)
37+
]
38+
)
39+
40+
with AudioFile(input_path) as f:
41+
with AudioFile(output_path, 'w', f.samplerate, f.num_channels) as o:
42+
# Read one second of audio at a time, until the file is empty:
43+
while f.tell() < f.frames:
44+
chunk = f.read(int(f.samplerate))
45+
effected = board(chunk, f.samplerate, reset=False)
46+
o.write(effected)
47+
48+
49+
def rvc_shift_pitch(input_path, output_path, n_steps):
50+
if not os.path.exists(output_path):
51+
y, sr = librosa.load(input_path)
52+
y_changed = librosa.effects.pitch_shift(y, sr, n_steps=n_steps)
53+
sf.write(output_path, y_changed, sr)
54+
55+
56+
def rvc_combine_audio(audio_paths: list, output_path: str, main_gain: int, backup_gain: int, inst_gain: int, output_format: str):
57+
main_vocal_audio = AudioSegment.from_wav(audio_paths[0]) + main_gain
58+
backup_vocal_audio = AudioSegment.from_wav(audio_paths[1]) + backup_gain
59+
instrumental_audio = AudioSegment.from_wav(audio_paths[2]) + inst_gain
60+
main_vocal_audio.overlay(backup_vocal_audio).overlay(instrumental_audio).export(output_path, format=output_format)

app/abus_app_aria.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import os
2+
import sys
3+
from pathlib import Path
4+
import random
5+
6+
current_dir = os.path.dirname(os.path.abspath(__file__))
7+
parent_dir = os.path.dirname(current_dir)
8+
sys.path.append(parent_dir)
9+
10+
import platform
11+
import torch
12+
import gradio as gr
13+
from src.config import UserConfig
14+
15+
import src.ui as ui
16+
from src.i18n.i18n import I18nAuto
17+
i18n = I18nAuto()
18+
19+
import structlog
20+
import logging
21+
22+
level = os.environ.get("LOG_LEVEL", "INFO").upper()
23+
LOG_LEVEL = getattr(logging, level)
24+
structlog.configure(
25+
wrapper_class=structlog.make_filtering_bound_logger(logging.WARNING)
26+
)
27+
logger = structlog.get_logger()
28+
29+
30+
from app.abus_genuine import *
31+
from app.tab_aicover import aicover_tab
32+
from app.tab_demixing import demixing_tab
33+
34+
35+
##############################################################################################
36+
# Gradio
37+
##############################################################################################
38+
39+
def create_ui(user_config: UserConfig):
40+
# css/js strings
41+
css = ui.css
42+
js = ui.js
43+
44+
with gr.Blocks(title='Aria CoverSong', css=css, theme=ui.theme) as gradio_interface:
45+
gr.HTML(f'<center><h6>{i18n("")}</h6></center>')
46+
47+
with gr.Tab(i18n("AI Cover")):
48+
aicover_tab(user_config)
49+
50+
with gr.Tab(i18n("Demixing")):
51+
demixing_tab(user_config)
52+
53+
create_app_footer()
54+
55+
gradio_interface.load(None, None, None, js="() => document.getElementsByTagName('body')[0].classList.add('dark')")
56+
gradio_interface.load(None, None, None, js=f"() => {{{js}}}")
57+
58+
59+
gradio_interface.launch(
60+
share=False,
61+
server_name=None,
62+
server_port=7910,
63+
inbrowser=True
64+
)
65+
66+
def create_app_footer():
67+
gradio_version = gr.__version__
68+
python_version = platform.python_version()
69+
torch_version = torch.__version__
70+
71+
footer_items = ["🔊 [aria-coversong](https://github.com/abus-aikorea/aria-coversong)"]
72+
footer_items.append(f"python: `{python_version}`")
73+
footer_items.append(f"torch: `{torch_version}`")
74+
footer_items.append(f"gradio: `{gradio_version}`")
75+
76+
genuine = "activated version"
77+
footer_items.append(f"{genuine}")
78+
79+
gr.Markdown(
80+
" | ".join(footer_items),
81+
elem_classes=["no-translate"],
82+
)
83+

app/abus_app_gulliver.py

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
import os
2+
import sys
3+
from pathlib import Path
4+
import random
5+
import requests
6+
7+
8+
current_dir = os.path.dirname(os.path.abspath(__file__))
9+
parent_dir = os.path.dirname(current_dir)
10+
sys.path.append(parent_dir)
11+
12+
matcha_dir = os.path.join(parent_dir, 'third_party', 'Matcha-TTS')
13+
sys.path.append(matcha_dir)
14+
15+
16+
import platform
17+
import torch
18+
import gradio as gr
19+
from src.config import UserConfig
20+
21+
import src.ui as ui
22+
from src.i18n.i18n import I18nAuto
23+
i18n = I18nAuto()
24+
25+
import structlog
26+
import logging
27+
28+
logging.getLogger("httpx").setLevel(logging.WARNING)
29+
logging.getLogger("httpcore").setLevel(logging.WARNING)
30+
logging.getLogger("fairseq").setLevel(logging.WARNING)
31+
logging.getLogger("azure.core").setLevel(logging.WARNING)
32+
logging.getLogger("faster_whisper").setLevel(logging.DEBUG)
33+
34+
logging.getLogger('matplotlib').setLevel(logging.WARNING)
35+
36+
37+
level = os.environ.get("LOG_LEVEL", "INFO").upper()
38+
LOG_LEVEL = getattr(logging, level)
39+
structlog.configure(
40+
wrapper_class=structlog.make_filtering_bound_logger(logging.DEBUG)
41+
)
42+
logger = structlog.get_logger()
43+
44+
45+
from app.abus_genuine import *
46+
from app.tab_gulliver import gulliver_tab
47+
from app.tab_subtitle import subtitle_tab
48+
from app.tab_tts_edge import tts_edge_tab
49+
from app.tab_tts_f5_single import tts_f5_single_tab
50+
from app.tab_tts_f5_multi import tts_f5_multi_tab
51+
from app.tab_tts_cosyvoice import tts_cosyvoice_tab
52+
from app.tab_tts_kokoro import tts_kokoro_tab
53+
from app.tab_translate import translate_tab
54+
from app.tab_live_translate import live_translate_tab
55+
from app.tab_vsr import vsr_tab
56+
from app.tab_aicover import aicover_tab
57+
from app.tab_demixing import demixing_tab
58+
from app.tab_tts_rvc import tts_rvc_tab
59+
from app.tab_rvc import rvc_tab
60+
from app.tab_batch_tts import batch_tts_tab
61+
62+
63+
##############################################################################################
64+
# Gradio
65+
##############################################################################################
66+
67+
68+
def create_ui(user_config: UserConfig):
69+
# css/js strings
70+
css = ui.css
71+
js = ui.js
72+
73+
with gr.Blocks(title='Voice Gulliver', css=css, theme=ui.theme) as gradio_interface:
74+
gr.HTML(f'<center><h6>{i18n("")}</h6></center>')
75+
76+
with gr.Tab(i18n("Dubbing Studio")):
77+
gulliver_tab(user_config)
78+
79+
with gr.Tab(i18n("Whisper subtitles")):
80+
subtitle_tab(user_config)
81+
82+
with gr.Tab(i18n("Translation")):
83+
with gr.Tabs():
84+
with gr.Tab(i18n("VOD")):
85+
translate_tab(user_config)
86+
with gr.Tab(i18n("Live")):
87+
live_translate_tab(user_config)
88+
89+
with gr.Tab(i18n("Speech Generation")):
90+
with gr.Tabs():
91+
tab_name = i18n('Azure-TTS') if azure_text_api_working() else i18n('Edge-TTS')
92+
with gr.Tab(tab_name):
93+
tts_edge_tab(user_config)
94+
with gr.Tab(i18n("F5-TTS (Single)")):
95+
tts_f5_single_tab(user_config)
96+
with gr.Tab(i18n("F5-TTS (Multi)")):
97+
tts_f5_multi_tab(user_config)
98+
with gr.Tab(i18n("CosyVoice")):
99+
tts_cosyvoice_tab(user_config)
100+
with gr.Tab(i18n("kokoro")):
101+
tts_kokoro_tab(user_config)
102+
103+
with gr.Tab(i18n("AI Cover")):
104+
with gr.Tabs():
105+
with gr.Tab(i18n("Cover Studio")):
106+
aicover_tab(user_config)
107+
with gr.Tab(i18n("Demixing")):
108+
demixing_tab(user_config)
109+
110+
with gr.Tab(i18n("Batch processing")):
111+
batch_tts_tab(user_config)
112+
113+
with gr.Tab(i18n("RVC")):
114+
rvc_tab(user_config)
115+
116+
with gr.Tab(i18n("TTS + RVC")):
117+
tts_rvc_tab(user_config)
118+
119+
with gr.Tab(i18n("NVIDIA RTX")):
120+
vsr_tab(user_config)
121+
122+
create_app_footer()
123+
124+
gradio_interface.load(None, None, None, js="() => document.getElementsByTagName('body')[0].classList.add('dark')")
125+
gradio_interface.load(None, None, None, js=f"() => {{{js}}}")
126+
127+
128+
gradio_interface.launch(
129+
share=False,
130+
server_name=None,
131+
server_port=7860,
132+
inbrowser=True
133+
)
134+
135+
def create_app_footer():
136+
gradio_version = gr.__version__
137+
python_version = platform.python_version()
138+
torch_version = torch.__version__
139+
140+
footer_items = ["🔊 [voice-gulliver](https://github.com/abus-aikorea/voice-gulliver)"]
141+
footer_items.append(f"python: `{python_version}`")
142+
footer_items.append(f"torch: `{torch_version}`")
143+
footer_items.append(f"gradio: `{gradio_version}`")
144+
145+
genuine = "activated version"
146+
footer_items.append(f"{genuine}")
147+
148+
gr.Markdown(
149+
" | ".join(footer_items),
150+
elem_classes=["no-translate"],
151+
)
152+
153+

0 commit comments

Comments
 (0)