### Install Project Requirements
Source: https://github.com/hinabl/aicovergen-colab/blob/main/AICoverGen_colab.ipynb
Installs the necessary Python packages listed in 'requirements.txt' quietly, updates the system's package list, and installs the 'sox' audio processing tool.
```bash
#@title Install requirements
!pip install -q -r requirements.txt
!sudo apt update
!sudo apt install sox
```
--------------------------------
### Download MDXNet and Hubert Models
Source: https://github.com/hinabl/aicovergen-colab/blob/main/AICoverGen_colab.ipynb
Executes a Python script to download the pre-trained MDXNet vocal separation and Hubert Base models required by AICoverGen.
```python
#@title Download MDXNet Vocal Separation and Hubert Base Models
!python src/download_models.py
```
--------------------------------
### Run AICoverGen WebUI
Source: https://github.com/hinabl/aicovergen-colab/blob/main/AICoverGen_colab.ipynb
Launches the AICoverGen web user interface using a Python script. The '--share' flag enables the creation of a public Gradio URL for external access.
```python
#@title Run WebUI
!python src/webui.py --share
```
--------------------------------
### Clone AICoverGen Repository and Setup Environment
Source: https://github.com/hinabl/aicovergen-colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb
This Python code snippet clones the AICoverGen repository from GitHub. It allows users to choose between different repository URLs based on the 'Pitch_Change' parameter and optionally install the project to Google Drive. It also sets up a timer for tracking the execution duration and handles potential CUDA installation for GPU acceleration.
```python
#@title Clone repository
from IPython.display import clear_output, Javascript
import codecs
import threading
import time
import os # for reasons...
# cloneing=codecs.decode('uggcf://tvguho.pbz/uvanoy/NVPbireTra-Pbyno.tvg','rot_13')
credit = " - This Notebook was originally modified by Hina"
#=======================Auto Edit======================
#@markdown ---
#@markdown Switch between ```-1 0 1``` or ```-12 0 12``` pitch change control
#@markdown This can only be changed once, you need to restart the whole thing if you wanna change it again
Pitch_Change="12" #@param ['1','12']
##@markdown Enable if you want to install the Program to your Drive
if Pitch_Change=="1":
cloneing=codecs.decode('uggcf://tvguho.pbz/FbpvnyylVarcgJrro/NVPbireTra.tvg','rot_13')
else:
cloneing=codecs.decode('uggcf://tvguho.pbz/uvanoy/NVPbireTra-Pbyno.tvg','rot_13')
#=====================Auto Edit End================
# this doesnt work btw :D
Install_To_Drive=False
#====================Use Drive============
if Install_To_Drive==True:
from google.colab import drive
drive.mount('/content/drive')
!git clone $cloneing Hina_RVC
!mv Hina_RVC /content/drive/MyDrive/
!rm -rf sample_data
%cd /content/drive/MyDrive/Hina_RVC
else:
!git clone $cloneing Hina_RVC
!rm -rf sample_data
%cd /content/
%cd Hina_RVC
def update_timer_and_print():
global timer
while True:
hours, remainder = divmod(timer, 3600)
minutes, seconds = divmod(remainder, 60)
timer_str = f'{hours:02}:{minutes:02}:{seconds:02}'
print(f'\rTimer: {timer_str} ', end='', flush=True) # Print without a newline
time.sleep(1)
timer += 1
timer = 0
threading.Thread(target=update_timer_and_print, daemon=True).start()
#@markdown ---
LongInstall=False #@param {type:"boolean"}
#@markdown When using LongInstall -> This cell may take a while to install, up to 15 minutes if unlucky
#@markdown
``NOTE! The L̲o̲n̲g̲I̲n̲s̲t̲a̲l̲l̲ toggle is only needed when it fails to use the GPU when making a cover``
if LongInstall==True:
!sudo apt update
!yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install cuda-11-8
clear_output()
!find / -name '*libcublasLt.so*'
time.sleep(10)
clear_output()
print("Done Cloning Repository"+credit)
```
--------------------------------
### Launch AICoverGen WebUI Server
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Start the Gradio-based web interface for AICoverGen using `src/webui.py`. Options include basic local launch, creating a public URL for services like Google Colab, or making it accessible from the local network.
```bash
# Basic local launch
python src/webui.py
# Launch with public URL (for Google Colab)
python src/webui.py --share
# Launch accessible from local network
python src/webui.py --listen
# Launch with custom host and port
python src/webui.py --listen --listen-host 0.0.0.0 --listen-port 7860
```
--------------------------------
### Run WebUI with Gradio, Ngrok, or Cloudflared
Source: https://github.com/hinabl/aicovergen-colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb
Launches a web UI for AI cover generation. Users can choose between Gradio for direct hosting, Ngrok for secure tunneling with an auth token, or Cloudflared for alternative tunneling. It requires Python and specific libraries to be installed.
```python
#@title Run WebUI
#@markdown ---
runpice=codecs.decode('fep/jrohv.cl','rot_13')
Url="Gradio" #@param ['Gradio','Ngrok','Cloudflared']
#@markdown ---
#@markdown - Token is only needed if you are using Ngrok. You can make an account on [ngrok](https://dashboard.ngrok.com/signup) for free.
#@markdown - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and place it here:
Token="" #@param {type:"string"}
if Url=="Gradio":
!source .venv/bin/activate; python $runpice --share
elif Url == "Cloudflared":
# Install Cloudflared
!curl -LO https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
!dpkg -i cloudflared-linux-amd64.deb
# Delete log file
!rm -rf nohup.out
# Run cloudflared
!nohup cloudflared tunnel --url localhost:9999 &
clear_output()
time.sleep(5)
!grep -oE "https://[a-zA-Z0-9.-]+\.trycloudflare.com" nohup.out
!source .venv/bin/activate; python $runpice --listen-port 9999
else:
!uv pip install pyngrok > /dev/null 2>&1
from pyngrok import ngrok
ngrok.set_auth_token(Token)
ngrok.kill()
cover_tunnel = ngrok.connect(9999)
print("CoverGen URL:", cover_tunnel.public_url)
print(credit)
!source .venv/bin/activate; python $runpice --listen-port 9999
```
--------------------------------
### Clone AICoverGen Repository
Source: https://github.com/hinabl/aicovergen-colab/blob/main/AICoverGen_colab.ipynb
Clones the AICoverGen repository from GitHub into the current Colab environment and changes the working directory to the cloned repository.
```python
#@title Clone repository
!git clone https://github.com/SociallyIneptWeeb/AICoverGen.git
%cd AICoverGen
```
--------------------------------
### Install and Run Voice Separation Model
Source: https://github.com/hinabl/aicovergen-colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb
Installs the SoX audio processing tool and then downloads and executes a voice separation model using a ROT13 encoded path. This step is crucial for preparing audio for AI cover generation.
```shell
!sudo apt install sox
clear_output()
models=codecs.decode('fep/qbjaybnq_zbqryf.cl','rot_13')
!python $models
clear_output()
print("Finished Downloading Voice Separation Model and Hubert Base Model")
print("Finsihed running this cell, proceed to the next cell"+credit)
```
--------------------------------
### Install Python Requirements for AICoverGen
Source: https://github.com/hinabl/aicovergen-colab/blob/main/Hina_Mod_AICoverGen_colab.ipynb
This Python code installs the necessary Python packages for the AICoverGen project using the 'uv' package manager. It configures the installation based on the 'Pitch_Change' setting, potentially modifying requirement files. It also installs specific versions of PyTorch and Gradio, along with a CUDA fix for `onnxruntime-gpu`.
```python
#@title Install requirements
req=codecs.decode('erdhverzragf.gkg','rot_13')
pt=codecs.decode('fep/pbasvtf','rot_13')
#@markdown This cell can take up to 5 minutes to finish
!pip install uv
!uv venv --python 3.10.12 .venv
!uv pip install pip==23.3.1 > /dev/null 2>&1
!uv pip install setuptools wheel ipykernel numpy onnxruntime-gpu onnxruntime > /dev/null 2>&1
!uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 > /dev/null 2>&1
clear_output()
if Pitch_Change=="12":
print("Using Pitch 12")
%cd $pt
time.sleep(5)
!sed -i '/torch==/d' $req
!sed -i '/torchaudio==/d' $req
!sed -i '/numpy==/d' $req
!sed -i '/librosa==/d' $req
!sed -i '/Requests==/d' $req
!sed -i '/scipy==/d' $req
!sed -i '/soundfile==/d' $req
!sed -i '/tqdm==/d' $req
time.sleep(5)
!uv pip install -r requirements.txt > /dev/null 2>&1
clear_output()
# Fix Numpy deprecation
!sed -i 's/(np.int)/(int)/g' '../vc_infer_pipeline.py'
%cd ../../
else:
print("Using Pitch 1")
time.sleep(5)
!sed -i '/torch==/d' $req
!sed -i '/torchaudio==/d' $req
!sed -i '/numpy==/d' $req
!sed -i '/librosa==/d' $req
!sed -i '/Requests==/d' $req
!sed -i '/scipy==/d' $req
!sed -i '/soundfile==/d' $req
!sed -i '/tqdm==/d' $req
time.sleep(5)
!uv pip install -r requirements.txt > /dev/null 2>&1
clear_output()
# Fix Numpy deprecation
!sed -i 's/(np.int)/(int)/g' 'src/vc_infer_pipeline.py'
!uv pip install gradio==3.48.0 > /dev/null 2>&1
# install cuda fix
!uv pip install ort-nightly-gpu --index-url=https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ort-cuda-12-nightly/pypi/simple/ > /dev/null 2>&1
!uv pip install torch==2.0.1 > /dev/null 2>&1
# clear_output()
print("Finished Installing Requirements")
!sudo apt update
```
--------------------------------
### Run AI Cover Generation Pipeline (Python)
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Execute the AI cover generation pipeline using the provided Python script. This command allows for extensive customization through various flags controlling input, pitch, effects, and output format. Ensure all paths and filenames are correctly specified.
```bash
python src/main.py [-h] -i SONG_INPUT -dir RVC_DIRNAME -p PITCH_CHANGE [-k | --keep-files | --no-keep-files] [-ir INDEX_RATE] [-fr FILTER_RADIUS] [-rms RMS_MIX_RATE] [-palgo PITCH_DETECTION_ALGO] [-hop CREPE_HOP_LENGTH] [-pro PROTECT] [-mv MAIN_VOL] [-bv BACKUP_VOL] [-iv INST_VOL] [-pall PITCH_CHANGE_ALL] [-rsize REVERB_SIZE] [-rwet REVERB_WETNESS] [-rdry REVERB_DRYNESS] [-rdamp REVERB_DAMPING] [-oformat OUTPUT_FORMAT]
```
--------------------------------
### Run AI Cover Generation Pipeline via WebUI
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Details the process of generating AI covers using the WebUI. Users select a voice model, provide a YouTube link or local audio file path, set the pitch, and can adjust advanced options before clicking 'Generate'.
```text
- From the Voice Models dropdown menu, select the voice model to use. Click `Update` if you added the files manually to the [rvc_models](rvc_models) directory to refresh the list.
- In the song input field, copy and paste the link to any song on YouTube or the full path to a local audio file.
- Pitch should be set to either -12, 0, or 12 depending on the original vocals and the RVC AI modal. This ensures the voice is not *out of tune*.
- Other advanced options for Voice conversion and audio mixing can be viewed by clicking the accordion arrow to expand.
Once all Main Options are filled in, click `Generate` and the AI generated cover should appear in a less than a few minutes depending on your GPU.
```
--------------------------------
### Run AI Cover Generation Pipeline
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Execute the AI cover generation pipeline with various customizable options.
```APIDOC
## POST /run/pipeline
### Description
This endpoint allows you to run the AI cover generation pipeline via the command line. You can specify various parameters to control the input song, voice models, pitch, audio processing, and output format.
### Method
POST
### Endpoint
`/run/pipeline`
### Parameters
#### Query Parameters
- **-i SONG_INPUT** (string) - Required - Link to a song on YouTube or path to a local audio file. Should be enclosed in double quotes for Windows and single quotes for Unix-like systems.
- **-dir RVC_DIRNAME** (string) - Required - Name of folder in [rvc_models](rvc_models) directory containing your `.pth` and `.index` files for a specific voice.
- **-p PITCH_CHANGE** (float) - Optional - Change pitch of AI vocals in octaves. Set to 0 for no change. Generally, use 1 for male to female conversions and -1 for vice-versa.
- **-k** (boolean) - Optional - Keep all intermediate audio files generated. e.g. Isolated AI vocals/instrumentals. Leave out to save space.
- **-ir INDEX_RATE** (float) - Optional - Default: 0.5. Control how much of the AI's accent to leave in the vocals. 0 <= INDEX_RATE <= 1.
- **-fr FILTER_RADIUS** (integer) - Optional - Default: 3. If >=3: apply median filtering to the harvested pitch results. 0 <= FILTER_RADIUS <= 7.
- **-rms RMS_MIX_RATE** (float) - Optional - Default: 0.25. Control how much to use the original vocal's loudness (0) or a fixed loudness (1). 0 <= RMS_MIX_RATE <= 1.
- **-palgo PITCH_DETECTION_ALGO** (string) - Optional - Default: rmvpe. Best option is rmvpe (clarity in vocals), then mangio-crepe (smoother vocals).
- **-hop CREPE_HOP_LENGTH** (integer) - Optional - Default: 128. Controls how often it checks for pitch changes in milliseconds when using mangio-crepe algo specifically. Lower values leads to longer conversions and higher risk of voice cracks, but better pitch accuracy.
- **-pro PROTECT** (float) - Optional - Default: 0.33. Control how much of the original vocals' breath and voiceless consonants to leave in the AI vocals. Set 0.5 to disable. 0 <= PROTECT <= 0.5.
- **-mv MAIN_VOCALS_VOLUME_CHANGE** (float) - Optional - Default: 0. Control volume of main AI vocals. Use -3 to decrease the volume by 3 decibels, or 3 to increase the volume by 3 decibels.
- **-bv BACKUP_VOCALS_VOLUME_CHANGE** (float) - Optional - Default: 0. Control volume of backup AI vocals.
- **-iv INSTRUMENTAL_VOLUME_CHANGE** (float) - Optional - Default: 0. Control volume of the background music/instrumentals.
- **-pall PITCH_CHANGE_ALL** (integer) - Optional - Default: 0. Change pitch/key of background music, backup vocals and AI vocals in semitones. Reduces sound quality slightly.
- **-rsize REVERB_SIZE** (float) - Optional - Default: 0.15. The larger the room, the longer the reverb time. 0 <= REVERB_SIZE <= 1.
- **-rwet REVERB_WETNESS** (float) - Optional - Default: 0.2. Level of AI vocals with reverb. 0 <= REVERB_WETNESS <= 1.
- **-rdry REVERB_DRYNESS** (float) - Optional - Default: 0.8. Level of AI vocals without reverb. 0 <= REVERB_DRYNESS <= 1.
- **-rdamp REVERB_DAMPING** (float) - Optional - Default: 0.7. Absorption of high frequencies in the reverb. 0 <= REVERB_DAMPING <= 1.
- **-oformat OUTPUT_FORMAT** (string) - Optional - Default: mp3. wav for best quality and large file size, mp3 for decent quality and small file size.
### Request Example
```bash
python src/main.py -i "path/to/your/song.mp3" -dir "voice_model_name" -p 1 -oformat wav
```
### Response
#### Success Response (200)
- **output_path** (string) - Path to the generated audio file.
#### Response Example
```json
{
"output_path": "/path/to/output/generated_song.wav"
}
```
```
--------------------------------
### Run AI Cover Generation Pipeline via CLI
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Execute the AI cover generation pipeline directly from the command line using `src/main.py`. This allows for flexible parameter control for input source, voice model directory, pitch adjustments, and various audio processing settings.
```bash
# Basic usage with required parameters
python src/main.py \
-i "https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
-dir Emilia \
-p 12
# Full usage with all optional parameters
python src/main.py \
-i "https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
-dir Emilia \
-p 12 \
-k \
-ir 0.5 \
-fr 3 \
-rms 0.25 \
-palgo rmvpe \
-hop 128 \
-pro 0.33 \
-mv 0 \
-bv 0 \
-iv 0 \
-pall 0 \
-rsize 0.15 \
-rwet 0.2 \
-rdry 0.8 \
-rdamp 0.7 \
-oformat mp3
# Using a local audio file instead of YouTube
python src/main.py \
-i "/path/to/local/song.mp3" \
-dir MyVoiceModel \
-p 0 \
-k
```
--------------------------------
### Load and Preprocess Audio Files
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Loads audio files using the `load_audio` utility function, allowing for a specified sample rate. This is crucial for preparing audio data, particularly for models like HuBERT which require a specific sample rate (e.g., 16000 Hz).
```python
from my_utils import load_audio
import numpy as np
# Load audio file with specified sample rate
audio = load_audio(
file='/path/to/audio.mp3',
sr=16000 # Sample rate (16000 for HuBERT input)
)
print(f"Audio shape: {audio.shape}")
print(f"Duration: {len(audio) / 16000:.2f} seconds")
```
--------------------------------
### Configure RVC Voice Conversion System in Python
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Initialize the RVC configuration and load necessary models for voice conversion inference. This involves setting up the CUDA device, configuring model parameters, and loading the HuBERT model for feature extraction.
```python
from rvc import Config, load_hubert, get_vc, rvc_infer
import os
# Initialize configuration for CUDA device
device = 'cuda:0'
config = Config(device, is_half=True)
# Access computed device parameters
print(f"Device: {config.device}")
print(f"GPU Name: {config.gpu_name}")
print(f"GPU Memory: {config.gpu_mem} GB")
print(f"Padding params: x_pad={config.x_pad}, x_query={config.x_query}")
# Load the HuBERT model for feature extraction
hubert_model = load_hubert(
device=device,
is_half=True,
model_path='rvc_models/hubert_base.pt'
)
```
--------------------------------
### Manual RVC Model Directory Structure
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Illustrates the required directory structure for manually managing RVC models for CLI usage. Each voice model should have its own subfolder containing a .pth file and an optional .index file.
```bash
├── rvc_models
│ ├── John
│ │ ├── JohnV2.pth
│ │ └── added_IVF2237_Flat_nprobe_1_v2.index
│ ├── May
│ │ ├── May.pth
│ │ └── added_IVF2237_Flat_nprobe_1_v2.index
│ ├── MODELS.txt
│ └── hubert_base.pt
├── mdxnet_models
├── song_output
└── src
```
--------------------------------
### Download and Upload Models via WebUI
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Provides Python functions to download voice models from online repositories (HuggingFace, Pixeldrain) and upload local models through a WebUI interface. It demonstrates downloading a model from a URL and saving it to a specified directory.
```python
from webui import download_online_model, upload_local_model
# Download a model from HuggingFace or Pixeldrain
result = download_online_model(
url='https://huggingface.co/phant0m4r/LiSA/resolve/main/LiSA.zip',
dir_name='Lisa'
)
print(result)
# Output: [+] Lisa Model successfully downloaded!
# Download from Pixeldrain
result = download_online_model(
url='https://pixeldrain.com/u/3tJmABXA',
dir_name='Gura'
)
print(result)
# Output: [+] Gura Model successfully downloaded!
```
--------------------------------
### Download Required Models (Bash)
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Downloads all necessary MDX-NET and RVC base models required for the AICoverGen pipeline. This is a command-line utility to ensure all dependencies are met before running inference.
```bash
# Download all required models
python src/download_models.py
```
--------------------------------
### Download Individual Models Programmatically (Python)
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Provides a Python interface to download individual models, such as MDX-NET and RVC models. This allows for more granular control over model management within scripts. Requires specifying the target directories for models.
```python
from download_models import dl_model
from pathlib import Path
# Download individual models programmatically
mdxnet_models_dir = Path('mdxnet_models')
rvc_models_dir = Path('rvc_models')
```
--------------------------------
### Combine Audio Tracks for Final Cover
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Mixes multiple audio tracks, including AI vocals, backup vocals, and instrumentals, into a single final audio file. Allows for gain adjustments for each track and specifies the output format. Requires a list of audio paths and the desired output path.
```python
from main import combine_audio
# Combine all audio tracks
combine_audio(
audio_paths=[
'song_output/song_id/Song_AI_Vocals_mixed.wav',
'song_output/song_id/Song_Vocals_Backup.wav',
'song_output/song_id/Song_Instrumental.wav'
],
output_path='song_output/song_id/Song (Emilia Ver).mp3',
main_gain=0,
backup_gain=0,
inst_gain=0,
output_format='mp3'
)
```
--------------------------------
### YouTube Audio Download Utility
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
A utility function to download audio from YouTube videos. It includes a helper function to extract the video ID from various YouTube URL formats and then proceeds to download the audio, returning the path to the saved file.
```python
from main import yt_download, get_youtube_video_id
# Extract video ID from various YouTube URL formats
video_id = get_youtube_video_id('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
print(f"Video ID: {video_id}")
# Output: Video ID: dQw4w9WgXcQ
# Supported URL formats:
# - http://youtu.be/SA2iWivDJiE
# - http://www.youtube.com/watch?v=_oPAwA_Udwc&feature=feedu
# - http://www.youtube.com/embed/SA2iWivDJiE
# - http://www.youtube.com/v/SA2iWivDJiE?version=3
# Download audio from YouTube
downloaded_path = yt_download('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
print(f"Downloaded to: {downloaded_path}")
# Output: Downloaded to: Song Title.mp3
```
--------------------------------
### Generate AI Song Cover using Python Function
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
The `song_cover_pipeline` function orchestrates the AI cover generation process. It takes various parameters to control input source, voice model, pitch, audio gains, AI accent retention, pitch detection methods, and output format. It returns the path to the generated cover file.
```python
from main import song_cover_pipeline
# Generate an AI cover from a YouTube video
cover_path = song_cover_pipeline(
song_input="https://www.youtube.com/watch?v=dQw4w9WgXcQ",
voice_model="Emilia", # Name of the RVC model folder
pitch_change=12, # Octave shift: 12 for male-to-female, -12 for vice-versa
keep_files=False, # Keep intermediate files (vocals, instrumentals)
is_webui=0, # 0 for CLI, 1 for WebUI
main_gain=0, # Main vocals volume change in dB
backup_gain=0, # Backup vocals volume change in dB
inst_gain=0, # Instrumentals volume change in dB
index_rate=0.5, # AI voice accent retention (0-1)
filter_radius=3, # Pitch filtering radius (0-7)
rms_mix_rate=0.25, # Loudness mix rate (0-1)
f0_method='rmvpe', # Pitch detection: 'rmvpe' or 'mangio-crepe'
crepe_hop_length=128, # Crepe hop length (32-320)
protect=0.33, # Consonant protection rate (0-0.5)
pitch_change_all=0, # Overall pitch change in semitones
reverb_rm_size=0.15, # Reverb room size (0-1)
reverb_wet=0.2, # Reverb wet level (0-1)
reverb_dry=0.8, # Reverb dry level (0-1)
reverb_damping=0.7, # Reverb damping (0-1)
output_format='mp3' # Output format: 'mp3' or 'wav'
)
print(f"Cover generated at: {cover_path}")
# Output: Cover generated at: song_output/SA2iWivDJiE/Song Title (Emilia Ver).mp3
```
--------------------------------
### Perform Voice Conversion Inference
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Performs voice conversion using a loaded RVC model. It takes an input audio file and converts its voice to match the RVC model. Requires paths to the RVC model, index file, input/output audio, and various inference parameters.
```python
from rvc import rvc_infer
# Perform voice conversion
rvc_infer(
index_path='rvc_models/Emilia/added_IVF2237_Flat_nprobe_1_v2.index',
index_rate=0.5,
input_path='song_output/id/Song_Vocals_Main_DeReverb.wav',
output_path='song_output/id/Song_AI_Vocals.wav',
pitch_change=12,
f0_method='rmvpe',
cpt=cpt,
version=version,
net_g=net_g,
filter_radius=3,
tgt_sr=tgt_sr,
rms_mix_rate=0.25,
protect=0.33,
crepe_hop_length=128,
vc=vc,
hubert_model=hubert_model
)
```
--------------------------------
### Download RVC Models via WebUI
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Allows users to download RVC models directly within the WebUI by providing a URL. The downloaded models should include a .pth file and an optional .index file. Successful downloads are indicated by a confirmation message.
```text
Navigate to the `Download model` tab, and paste the download link to the RVC model and give it a unique name.
You may search the [AI Hub Discord](https://discord.gg/aihub) where already trained voice models are available for download. You may refer to the examples for how the download link should look like.
The downloaded zip file should contain the .pth model file and an optional .index file.
Once the 2 input fields are filled in, simply click `Download`! Once the output message says `[NAME] Model successfully downloaded!`, you should be able to use it in the `Generate` tab after clicking the refresh models button!
```
--------------------------------
### Download MDX-NET and RVC Models
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Downloads necessary ONNX models for MDX-NET vocal separation and PyTorch models for RVC voice conversion from specified URLs. It iterates through lists of model filenames and uses a `dl_model` function to fetch them into designated directories.
```python
MDX_DOWNLOAD_LINK = 'https://github.com/TRvlvr/model_repo/releases/download/all_public_uvr_models/'
mdx_models = ['UVR-MDX-NET-Voc_FT.onnx', 'UVR_MDXNET_KARA_2.onnx', 'Reverb_HQ_By_FoxJoy.onnx']
for model in mdx_models:
dl_model(MDX_DOWNLOAD_LINK, model, mdxnet_models_dir)
RVC_DOWNLOAD_LINK = 'https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/'
rvc_models = ['hubert_base.pt', 'rmvpe.pt']
for model in rvc_models:
dl_model(RVC_DOWNLOAD_LINK, model, rvc_models_dir)
```
--------------------------------
### Upload RVC Models via WebUI
Source: https://github.com/hinabl/aicovergen-colab/blob/main/README.md
Enables users to upload their locally trained RVC v2 models to the WebUI for AI cover generation. After a successful upload, the model can be used in the 'Generate' tab after refreshing the model list.
```text
Navigate to the `Upload model` tab, and follow the instructions.
Once the output message says `[NAME] Model successfully uploaded!`, you should be able to use it in the `Generate` tab after clicking the refresh models button!
```
--------------------------------
### Load RVC Voice Model
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Loads a Retrieval-based Voice Conversion (RVC) model for voice synthesis. It requires the model path and configuration details. Outputs the model version, target sample rate, and the loaded model components.
```python
rvc_model_path = 'rvc_models/Emilia/Emilia.pth'
cpt, version, net_g, tgt_sr, vc = get_vc(
device=device,
is_half=True,
config=config,
model_path=rvc_model_path
)
print(f"Model version: {version}")
print(f"Target sample rate: {tgt_sr}")
```
--------------------------------
### MDX-NET Vocal Separation
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Separates vocals from instrumentals in an audio file using the MDX-NET model. It can also separate main vocals from backup vocals and apply de-reverb. Requires model parameters, model path, input filename, and output directory.
```python
from mdx import run_mdx
import json
# Load model parameters
with open('mdxnet_models/model_data.json') as f:
mdx_model_params = json.load(f)
# Separate vocals from instrumental
vocals_path, instrumentals_path = run_mdx(
model_params=mdx_model_params,
output_dir='song_output/song_id',
model_path='mdxnet_models/UVR-MDX-NET-Voc_FT.onnx',
filename='song_output/song_id/original_song.wav',
exclude_main=False,
exclude_inversion=False,
suffix=None,
invert_suffix=None,
denoise=True,
keep_orig=True,
m_threads=2
)
print(f"Vocals: {vocals_path}")
print(f"Instrumentals: {instrumentals_path}")
# Separate main vocals from backup vocals
backup_vocals_path, main_vocals_path = run_mdx(
model_params=mdx_model_params,
output_dir='song_output/song_id',
model_path='mdxnet_models/UVR_MDXNET_KARA_2.onnx',
filename=vocals_path,
suffix='Backup',
invert_suffix='Main',
denoise=True
)
# Apply de-reverb to main vocals
_, main_vocals_dereverb_path = run_mdx(
model_params=mdx_model_params,
output_dir='song_output/song_id',
model_path='mdxnet_models/Reverb_HQ_By_FoxJoy.onnx',
filename=main_vocals_path,
invert_suffix='DeReverb',
exclude_main=True,
denoise=True
)
```
--------------------------------
### Apply Pitch Shifting to Audio
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Applies pitch shifting to an audio file using the `pitch_shift` function. This function takes the path to an audio file and a pitch change value in semitones, returning the path to the modified audio file.
```python
from main import pitch_shift
# Shift pitch by semitones
shifted_audio_path = pitch_shift(
audio_path='song_output/song_id/Song_Instrumental.wav',
pitch_change=2 # Semitones (positive = higher, negative = lower)
)
print(f"Pitch-shifted audio: {shifted_audio_path}")
# Output: song_output/song_id/Song_Instrumental_p2.wav
```
--------------------------------
### Add Audio Effects to AI Vocals
Source: https://context7.com/hinabl/aicovergen-colab/llms.txt
Applies audio effects such as reverb to the AI-generated vocals. This function enhances the quality and mixability of the synthesized voice. It takes the path to the audio file and various reverb parameters.
```python
from main import add_audio_effects
# Apply audio effects to AI vocals
Mixed_vocals_path = add_audio_effects(
audio_path='song_output/song_id/Song_AI_Vocals.wav',
reverb_rm_size=0.15,
reverb_wet=0.2,
reverb_dry=0.8,
reverb_damping=0.7
)
print(f"Mixed vocals: {mixed_vocals_path}")
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.