### Install Server Requirements Source: https://github.com/w-okada/voice-changer/blob/master/README_dev_en.md Navigates to the server directory and installs all necessary Python packages listed in the requirements.txt file. ```bash $ cd voice-changer/server $ pip install -r requirements.txt ``` -------------------------------- ### Project Setup Commands (Shell) Source: https://github.com/w-okada/voice-changer/blob/master/server/requirements.txt A collection of shell commands used for initial project setup. This includes updating the package list, installing essential development tools, downloading the Anaconda installer, and executing the installer script. ```shell # apt-get update # apt-get install -y emacs mlocate wget git curl gcc g++ make unzip # wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh # bash Anaconda3-2022.10-Linux-x86_64.sh ``` -------------------------------- ### Linux Installation via Repository Clone Source: https://github.com/w-okada/voice-changer/blob/master/docs_i18n/README_es.md Instructions for Linux users to clone the repository for usage, as direct installation might differ. ```bash git clone cd ``` -------------------------------- ### Installation and Launching Source: https://github.com/w-okada/voice-changer/blob/master/tutorials/tutorial_rvc_ja_1_5_2_5.md Instructions for installing necessary components like HuBERT and launching the GUI client on different operating systems. Includes commands for Windows and macOS. ```shell Windows: Download the zip file, extract it, and run `start_http.bat`. Mac: Extract the downloaded file and run `startHttp.command`. If prompted about an untrusted developer, Control-click or right-click to open. ``` ```shell Remote Connection: Use the `.bat` (win) or `.command` (mac) files where 'http' is replaced with 'https'. ``` -------------------------------- ### Install and Build Client Dependencies Source: https://github.com/w-okada/voice-changer/blob/master/README_dev_en.md Installs Node.js dependencies and builds the client application in development mode for both the main client and the demo interface. ```npm cd client cd lib npm install npm run build:dev cd ../demo npm install npm run build:dev ``` -------------------------------- ### Clone Voice Changer Repo and Install Python Dependencies Source: https://github.com/w-okada/voice-changer/blob/master/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb Clones the Voice Changer repository from GitHub and installs necessary Python packages including faiss-gpu, fairseq, pyngrok, and pyworld. It also includes system package installation for libportaudio2 and downloads default settings. ```python # This will make that we're on the right folder before installing %cd /kaggle/working/ !pip install colorama --quiet from colorama import Fore, Style import os !mkdir Hmod %cd Hmod !git clone https://github.com/w-okada/voice-changer.git --depth=1 --quiet . print(f"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}") %cd server !sed -i "s/-.-.-.-/Kaggle.Mod/" '../client/demo/dist/assets/gui_settings/version.txt' !mv MMVCServerSIO.py Hmod.py !sed -i "s/MMVCServerSIO/Hmod/" Hmod.py print(f"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}") !apt-get -y install libportaudio2 -qq print(f"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}") # Install dependencies that are missing from requirements.txt and pyngrok !pip install faiss-gpu fairseq pyngrok --quiet !pip install pyworld --no-build-isolation print(f"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}") !pip install -r requirements.txt --quiet # Download the default settings ^-^ if not os.path.exists("/kaggle/working/Hmod/server/stored_setting.json"): !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/24apuiBokE3TjZwc6tuqqv39SwP_2LRouVj3M9oZZCbzgntuG /server/stored_setting.json print(f"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}") print(f"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}") ``` -------------------------------- ### Install Specific Python Packages Source: https://github.com/w-okada/voice-changer/blob/master/README_dev_en.md Installs the 'chardet' package and a specific version (1.24.0) of NumPy. These are often required dependencies for the project. ```bash pip install chardet pip install numpy==1.24.0 ``` -------------------------------- ### Configure pyngrok and Start Server Source: https://github.com/w-okada/voice-changer/blob/master/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb Sets up pyngrok with authentication token and region, then establishes an ngrok tunnel for a local port. It includes a function to wait until the server is ready and prints the public ngrok URL. ```python from pyngrok import conf, ngrok MyConfig = conf.PyngrokConfig() MyConfig.auth_token = Token MyConfig.region = Region conf.get_default().authtoken = Token conf.get_default().region = Region conf.set_default(MyConfig); import subprocess, threading, time, socket, urllib.request PORT = 8000 from pyngrok import ngrok ngrokConnection = ngrok.connect(PORT) public_url = ngrokConnection.public_url def wait_for_server(): while True: time.sleep(0.5) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex(('127.0.0.1', PORT)) if result == 0: break sock.close() print("--------- SERVER READY! ---------") print("Your server is available at:") print(public_url) print("---------------------------------") threading.Thread(target=wait_for_server, daemon=True).start() ``` -------------------------------- ### Clone Repo and Install Voice Changer Dependencies Source: https://github.com/w-okada/voice-changer/blob/master/Kaggle_RealtimeVoiceChanger.ipynb This Python script clones the Voice Changer repository, installs necessary system libraries (like libportaudio2), Python dependencies from requirements.txt, and downloads default settings. It also includes instructions for using GPU and handling potential dependency conflicts. ```Python # This will make that we're on the right folder before installing %cd /kaggle/working/ !pip install colorama --quiet from colorama import Fore, Style import os print(f"{Fore.CYAN}> Cloning the repository...{Style.RESET_ALL}") !git clone https://github.com/w-okada/voice-changer.git --quiet print(f"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}") %cd voice-changer/server/ print(f"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}") !apt-get -y install libportaudio2 -qq print(f"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}") # Install dependencies that are missing from requirements.txt and pyngrok !pip install faiss-gpu fairseq pyngrok --quiet !pip install pyworld --no-build-isolation --quiet print(f"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}") !pip install -r requirements.txt --quiet # Download the default settings ^-^ if not os.path.exists("/kaggle/working/voice-changer/server/stored_setting.json"): !wget -q https://gist.githubusercontent.com/Rafacasari/d820d945497a01112e1a9ba331cbad4f/raw/8e0a426c22688b05dd9c541648bceab27e422dd6/kaggle_setting.json -O /kaggle/working/voice-changer/server/stored_setting.json print(f"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}") print(f"{Fore.GREEN}> You can safely ignore the dependency conflict errors, it's a error from Kaggle and don't interfer on Voice Changer!{Style.RESET_ALL}") ``` -------------------------------- ### Install Dependencies and Playwright Source: https://github.com/w-okada/voice-changer/blob/master/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb Installs essential Python packages, Playwright for browser automation, and its system dependencies. It also installs packages listed in requirements.txt, ensuring the environment is ready for the voice changer application. ```python import asyncio import re !pip install playwright !playwright install !playwright install-deps !pip install nest_asyncio from playwright.async_api import async_playwright print(f"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}") !pip install -r requirements.txt --quiet clear_output() print(f"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}") ``` -------------------------------- ### Start Client GUI Source: https://github.com/w-okada/voice-changer/blob/master/tutorials/tutorial_rvc_en_1_5_2_4.md Instructions for launching the Realtime Voice Changer client GUI on different operating systems. Includes steps for Windows and macOS, along with precautions for remote connections. ```batch Windows: Unzip the downloaded zip file. Run `start_http.bat`. ``` ```shell macOS: Extract the downloaded file. Execute `startHttp.command`. If prompted about developer verification, press Control, then click to execute (or right-click to execute). ``` ```APIDOC Remote Connection Precautions: When connecting remotely, use `.bat` (Windows) or `.command` (macOS) files where 'http' is replaced with 'https'. ``` -------------------------------- ### Install PyTorch with CUDA Support Source: https://github.com/w-okada/voice-changer/blob/master/README_dev_en.md Installs PyTorch, torchvision, and torchaudio with CUDA 11.8 support using Conda. This command is crucial for GPU acceleration on Windows with Anaconda. ```bash conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia ``` -------------------------------- ### Start Voice Changer Server with ngrok Configuration Source: https://github.com/w-okada/voice-changer/blob/master/Hina_Mod_Kaggle_Real_Time_Voice_Changer.ipynb Configures and starts the Voice Changer server using ngrok for external access. Requires a free ngrok account and authentication token. Users can select a preferred ngrok region for latency optimization. ```python Token = 'Token_Here' # Replace with your ngrok auth token Region = "ap" # Choose your ngrok region (e.g., "us", "ap", "au", "eu", "in", "jp", "sa") # You can change the region for a better latency, use only the abbreviation # Choose between this options: # us -> United States (Ohio) # ap -> Asia/Pacific (Singapore) # au -> Australia (Sydney) # eu -> Europe (Frankfurt) # in -> India (Mumbai) # jp -> Japan (Tokyo) # sa -> South America (Sao Paulo) # --------------------------------- ``` -------------------------------- ### Windows Startup Command Source: https://github.com/w-okada/voice-changer/blob/master/tutorials/tutorial_rvc_en_1_5_2_5.md Executes the HTTP server on Windows. Unzip the downloaded file and run this batch script to start the client application. ```batch start_http.bat ``` -------------------------------- ### Install PortAudio and ALSA Development Libraries Source: https://github.com/w-okada/voice-changer/blob/master/README_dev_en.md Installs necessary system libraries for PortAudio and ALSA, often required for audio processing functionalities, particularly on Debian/Ubuntu-based systems. ```shell $ sudo apt-get install libportaudio2 $ sudo apt-get install libasound-dev ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/w-okada/voice-changer/blob/master/Realtime_Voice_Changer_on_Colab.ipynb This section clones the voice-changer repository from GitHub and installs all required Python packages and system libraries. It includes steps for setting up the environment, installing specific libraries like faiss-gpu, fairseq, pyngrok, and pyworld, and managing dependencies from a requirements.txt file. This process can take a significant amount of time. ```python # @title Clone repository and install dependencies # @markdown This first step will download the latest version of Voice Changer and install the dependencies. **It can take some time to complete.** %cd /content/ !pip install colorama --quiet from colorama import Fore, Style import os print(f"{Fore.CYAN}> Cloning the repository...{Style.RESET_ALL}") !git clone https://github.com/w-okada/voice-changer.git --quiet print(f"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}") %cd voice-changer/server/ print(f"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}") !apt-get -y install libportaudio2 -qq print(f"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}") # Install dependencies that are missing from requirements.txt and pyngrok !pip install faiss-gpu fairseq pyngrok --quiet !pip install pyworld --no-build-isolation --quiet print(f"{Fore.CYAN}> Installing dependencies from requirements.txt...{Style.RESET_ALL}") !pip install -r requirements.txt --quiet print(f"{Fore.GREEN}> Successfully installed all packages!{Style.RESET_ALL}") ``` -------------------------------- ### Clone Repo and Install Dependencies Source: https://github.com/w-okada/voice-changer/blob/master/Hina_Modified_Realtime_Voice_Changer_on_Colab.ipynb This snippet clones the Realtime Voice Changer repository from GitHub and installs necessary Python dependencies. It also includes optional Google Drive mounting and modifies a version file. It requires a Colab environment with GPU acceleration enabled. ```python #=================Updated================= # @title **[1]** Clone repository and install dependencies # @markdown This first step will download the latest version of Voice Changer and install the dependencies. **It can take some time to complete.** import os import time import subprocess import threading import shutil import base64 import codecs #@markdown --- # @title **[Optional]** Connect to Google Drive # @markdown Using Google Drive can improve load times a bit and your models will be stored, so you don't need to re-upload every time that you use. Use_Drive=False #@param {type:"boolean"} from google.colab import drive if Use_Drive==True: if not os.path.exists('/content/drive'): drive.mount('/content/drive') %cd /content/drive/MyDrive externalgit=codecs.decode('uggcf://tvguho.pbz/j-bxnqn/ibvpr-punatre.tvg','rot_13') rvctimer=codecs.decode('uggcf://tvguho.pbz/uvanoy/eipgvzre.tvg','rot_13') pathloc=codecs.decode('ibvpr-punatre','rot_13') from IPython.display import clear_output, Javascript 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() !pip install colorama --quiet from colorama import Fore, Style print(f"{Fore.CYAN}> Cloning the repository...{Style.RESET_ALL}") !git clone --depth 1 $externalgit &> /dev/null print(f"{Fore.GREEN}> Successfully cloned the repository!{Style.RESET_ALL}") %cd $pathloc/server/ # Read the content of the file file_path = '../client/demo/dist/assets/gui_settings/version.txt' with open(file_path, 'r') as file: file_content = file.read() # Replace the specific text text_to_replace = "-.-.-.-" new_text = "Google.Colab" # New text to replace the specific text modified_content = file_content.replace(text_to_replace, new_text) # Write the modified content back to the file with open(file_path, 'w') as file: file.write(modified_content) print(f"Text '{text_to_replace}' has been replaced with '{new_text}' in the file.") print(f"{Fore.CYAN}> Installing libportaudio2...{Style.RESET_ALL}") !apt-get -y install libportaudio2 -qq !sed -i '/torch==/d' requirements.txt !sed -i '/torchaudio==/d' requirements.txt !sed -i '/numpy==/d' requirements.txt print(f"{Fore.CYAN}> Installing pre-dependencies...{Style.RESET_ALL}") # Install dependencies that are missing from requirements.txt and pyngrok !pip install faiss-gpu fairseq pyngrok --quiet !pip install pyworld --no-build-isolation --quiet ``` -------------------------------- ### Mac Startup Command Source: https://github.com/w-okada/voice-changer/blob/master/tutorials/tutorial_rvc_en_1_5_2_5.md Executes the HTTP server on macOS. After extracting the download file, run this command. If prompted about developer verification, use control-click or right-click to execute. ```bash startHttp.command ``` -------------------------------- ### Configure Pyngrok and Launch MMVC Server Source: https://github.com/w-okada/voice-changer/blob/master/Kaggle_RealtimeVoiceChanger.ipynb Sets up pyngrok with authentication and region, then launches the MMVC server script using a subprocess call. It includes a thread to wait for the server to become ready and prints the public ngrok URL. ```python from pyngrok import conf, ngrok MyConfig = conf.PyngrokConfig() MyConfig.auth_token = Token MyConfig.region = Region conf.set_default(MyConfig); import subprocess, threading, time, socket, urllib.request PORT = 8000 from pyngrok import ngrok ngrokConnection = ngrok.connect(PORT) public_url = ngrokConnection.public_url from IPython.display import clear_output def wait_for_server(): while True: time.sleep(0.5) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex(('127.0.0.1', PORT)) if result == 0: break sock.close() if ClearConsole: clear_output() print("--------- SERVER READY! ---------") print("Your server is available at:") print(public_url) print("---------------------------------") threading.Thread(target=wait_for_server, daemon=True).start() # Execute the server script # Note: The actual command execution is handled by the shell interpreter in environments like Jupyter # The following line represents the command executed: # !python3 MMVCServerSIO.py \ # -p {PORT} \ # --https False \ # --content_vec_500 pretrain/checkpoint_best_legacy_500.pt \ # --content_vec_500_onnx pretrain/content_vec_500.onnx \ # --content_vec_500_onnx_on true \ # --hubert_base pretrain/hubert_base.pt \ # --hubert_base_jp pretrain/rinna_hubert_base_jp.pt \ # --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt \ # --nsf_hifigan pretrain/nsf_hifigan/model \ # --crepe_onnx_full pretrain/crepe_onnx_full.onnx \ # --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx \ # --rmvpe pretrain/rmvpe.pt \ # --model_dir model_dir \ # --samples samples.json ``` -------------------------------- ### Start Server using ngrok Source: https://github.com/w-okada/voice-changer/blob/master/Realtime_Voice_Changer_on_Colab.ipynb This code block starts the voice changer server and exposes it via ngrok. It requires users to provide their ngrok authentication token. The first run may involve downloading models, which can take 1-2 minutes. Users can optionally select a region for ngrok and choose whether to clear the console. ```python # @title Start Server **using ngrok** # @markdown This cell will start the server, the first time that you run it will download the models, so it can take a while (~1-2 minutes) # @markdown --- # @markdown You'll need a ngrok account, but **it's free** and easy to create! # @markdown --- # @markdown **1** - Create a **free** account at [ngrok](https://dashboard.ngrok.com/signup) or **login with Google/Github account** # @markdown **2** - If you didn't logged in with Google/Github, you will need to **verify your e-mail**! # @markdown **3** - Click [this link](https://dashboard.ngrok.com/get-started/your-authtoken) to get your auth token, and place it here: Token = '' # @param {type:"string"} # @markdown **4** - *(optional)* Change to a region near to you or keep at United States if increase latency # @markdown `Default Region: us - United States (Ohio)` Region = "us - United States (Ohio)" # @param ["ap - Asia/Pacific (Singapore)", "au - Australia (Sydney)","eu - Europe (Frankfurt)", "in - India (Mumbai)","jp - Japan (Tokyo)","sa - South America (Sao Paulo)", "us - United States (Ohio)"] #@markdown **5** - *(optional)* Other options: ClearConsole = True # @param {type:"boolean"} # --------------------------------- # DO NOT TOUCH ANYTHING DOWN BELOW! ```