### Install and Run Development Server (npm) Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/tools/midi_editor/README.md These commands install project dependencies and start the development server using npm. The `--host 0.0.0.0` flag allows the server to be accessible from other devices on the local network. ```bash npm install npm run dev npm run dev -- --host 0.0.0.0 ``` -------------------------------- ### Install Preprocess Dependencies Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/README.md Installs Python dependencies for the preprocess module from the requirements.txt file located in the 'preprocess' directory. ```bash cd preprocess pip install -r requirements.txt ``` -------------------------------- ### Download Pretrained Models (Bash) Source: https://github.com/soul-ailab/soulx-singer/blob/main/README.md Downloads the SoulX-Singer SVS model and necessary preprocessing models from Hugging Face Hub. Requires the `huggingface_hub` library to be installed. ```bash pip install -U huggingface_hub # Download the SoulX-Singer SVS model hf download Soul-AILab/SoulX-Singer --local-dir pretrained_models/SoulX-Singer # Download models required for preprocessing hf download Soul-AILab/SoulX-Singer-Preprocess --local-dir pretrained_models/SoulX-Singer-Preprocess ``` -------------------------------- ### Run Preprocessing Pipeline via CLI Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Provides command-line examples for running the preprocessing pipeline. It shows how to preprocess prompt audio without vocal separation and target audio with vocal separation, specifying various parameters like audio path, save directory, language, device, and merge duration. ```bash # Preprocess prompt audio (no vocal separation needed for clean vocals) python -m preprocess.pipeline \ --audio_path example/audio/zh_prompt.mp3 \ --save_dir example/transcriptions/zh_prompt \ --language Mandarin \ --device cuda \ --vocal_sep False \ --max_merge_duration 30000 # Preprocess target audio (with vocal separation for full songs) python -m preprocess.pipeline \ --audio_path example/audio/music.mp3 \ --save_dir example/transcriptions/music \ --language Mandarin \ --device cuda \ --vocal_sep True \ --max_merge_duration 60000 ``` -------------------------------- ### Run MIDI Parser via CLI Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Demonstrates command-line usage for the MidiParser. It includes examples for exporting metadata to MIDI and importing edited MIDI back into the metadata format, specifying necessary file paths and parameters. ```bash # Export metadata to MIDI for editing in external editors python -m preprocess.tools.midi_parser \ --meta2midi \ --meta example/transcriptions/music/metadata.json \ --midi example/transcriptions/music/vocal.mid # Import edited MIDI back to metadata format python -m preprocess.tools.midi_parser \ --midi2meta \ --midi example/transcriptions/music/vocal_edited.mid \ --meta example/transcriptions/music/edit_metadata.json \ --vocal example/transcriptions/music/vocal.wav \ --language Mandarin \ --rmvpe_model_path pretrained_models/SoulX-Singer-Preprocess/rmvpe/rmvpe.pt \ --device cuda ``` -------------------------------- ### Launch SoulX-Singer WebUI Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Shows how to launch the Gradio-based web interface for SoulX-Singer. It provides commands to start the UI on the default port and with a custom port, including an option for public sharing. ```bash # Launch WebUI on default port python webui.py # Launch with custom port and public sharing python webui.py --port 7860 --share ``` -------------------------------- ### Clone Repository and Set Up Environment (Bash) Source: https://github.com/soul-ailab/soulx-singer/blob/main/README.md Clones the SoulX-Singer repository and sets up a Conda environment with Python 3.10. It then installs project dependencies using pip, with an option for using a PyPI mirror in mainland China. ```bash git clone https://github.com/Soul-AILab/SoulX-Singer.git cd SoulX-Singer # Install Conda (if not already installed): https://docs.conda.io/en/latest/miniconda.html # Create and activate a Conda environment: conda create -n soulxsinger -y python=3.10 conda activate soulxsinger # Install dependencies: pip install -r requirements.txt # ⚠️ If you are in mainland China, use a PyPI mirror: pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com ``` -------------------------------- ### SoulX-Singer Metadata Format Example Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Illustrates the JSON structure used by SoulX-Singer to store metadata for singing segments. It includes fields for segment index, language, timestamps, note durations, lyrics, phonemes, pitch, note types, and F0 contours. ```json [ { "index": "vocal_320_10687", "language": "Mandarin", "time": [320, 10687], "duration": "0.23 0.34 0.26 0.70 0.52 0.46", "text": " 除 了 想 你 你", "phoneme": " zh_chu2 zh_le5 zh_xiang3 zh_ni3 zh_ni3", "note_pitch": "0 62 65 67 67 69", "note_type": "1 2 2 2 2 3", "f0": "0.0 0.0 294.1 288.2 290.6 294.6 295.7" } ] ``` -------------------------------- ### Initialize and Run PreprocessPipeline in Python Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Demonstrates how to initialize the PreprocessPipeline class with various models and parameters, and then run the full audio preprocessing pipeline on an input audio file. It outlines the expected output files. ```python from preprocess.pipeline import PreprocessPipeline # Initialize pipeline with all preprocessing models pipeline = PreprocessPipeline( device="cuda:0", language="Mandarin", # Language for ASR: Mandarin, English, Cantonese save_dir="outputs/transcriptions", vocal_sep=True, # Enable vocal/accompaniment separation max_merge_duration=60000 # Max segment duration in ms ) # Run full preprocessing pipeline pipeline.run( audio_path="input_song.mp3", vocal_sep=True, # Separate vocals from accompaniment max_merge_duration=60000, # Maximum segment length language="Mandarin" # Target language ) # Output files: # - outputs/transcriptions/vocal.wav (separated vocal) # - outputs/transcriptions/acc.wav (accompaniment) # - outputs/transcriptions/metadata.json (SoulX-Singer format) # - input_song.json (copy of metadata) ``` -------------------------------- ### Build and Preview Production Build (npm) Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/tools/midi_editor/README.md These commands are used to build the project for production and then preview the built application. This is typically done before deploying the application. ```bash npm run build npm run preview ``` -------------------------------- ### Initialize and Use MidiParser in Python Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Shows how to initialize the MidiParser with model paths and device, and then use it to convert between SoulX-Singer metadata JSON and standard MIDI files. It covers both metadata-to-MIDI and MIDI-to-metadata conversion. ```python from preprocess.tools.midi_parser import MidiParser # Initialize parser parser = MidiParser( rmvpe_model_path="pretrained_models/SoulX-Singer-Preprocess/rmvpe/rmvpe.pt", device="cuda" ) # Convert metadata to MIDI for editing parser.meta2midi( meta_path="example/transcriptions/music/metadata.json", midi_path="example/transcriptions/music/vocal.mid" ) # Convert edited MIDI back to metadata parser.midi2meta( midi_path="example/transcriptions/music/vocal_edited.mid", meta_path="example/transcriptions/music/edit_metadata.json", vocal_file="example/transcriptions/music/vocal.wav", # Optional: for F0 extraction language="Mandarin" ) ``` -------------------------------- ### Programmatic WebUI Usage in Python Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Illustrates the programmatic usage of the WebUI by importing the `render_interface` function from the `webui` module. ```python # Programmatic WebUI usage from webui import render_interface ``` -------------------------------- ### Launch Web UI with Python Source: https://github.com/soul-ailab/soulx-singer/blob/main/README.md This snippet shows how to launch the interactive web-based user interface for SoulX-Singer. It requires a Python environment to execute the webui.py script. ```python python webui.py ``` -------------------------------- ### Run Inference Demo (Bash) Source: https://github.com/soul-ailab/soulx-singer/blob/main/README.md Executes the inference demo script for SoulX-Singer. This script requires pre-generated metadata from the preprocessing pipeline, including vocal separation and transcription. Manual alignment correction using the Midi-Editor is recommended for optimal results. ```bash bash example/infer.sh ``` -------------------------------- ### Run Transcription Pipeline Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/README.md Executes the full singing transcription pipeline by running the preprocess.sh script. This script orchestrates vocal separation, F0 extraction, lyrics transcription, and note transcription. ```bash bash example/preprocess.sh ``` -------------------------------- ### Activate Conda Environment Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/README.md Activates the 'soulxsinger' conda environment. If the environment does not exist, it will be created with Python 3.10. ```bash conda activate soulxsinger conda create -n soulxsinger -y python=3.10 conda activate soulxsinger ``` -------------------------------- ### CLI Inference for Singing Voice Synthesis (Bash) Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Executes singing voice synthesis from the command line using preprocessed metadata. Requires a pretrained model, configuration, prompt audio, and target metadata. Supports melody or score control modes. ```bash # Basic inference with melody control python -m cli.inference \ --device cuda \ --model_path pretrained_models/SoulX-Singer/model.pt \ --config soulxsinger/config/soulxsinger.yaml \ --prompt_wav_path example/audio/zh_prompt.mp3 \ --prompt_metadata_path example/audio/zh_prompt.json \ --target_metadata_path example/audio/zh_target.json \ --phoneset_path soulxsinger/utils/phoneme/phone_set.json \ --save_dir outputs \ --control melody # Inference with score control and automatic pitch shifting python -m cli.inference \ --device cuda \ --model_path pretrained_models/SoulX-Singer/model.pt \ --config soulxsinger/config/soulxsinger.yaml \ --prompt_wav_path example/audio/zh_prompt.mp3 \ --prompt_metadata_path example/audio/zh_prompt.json \ --target_metadata_path example/audio/music.json \ --phoneset_path soulxsinger/utils/phoneme/phone_set.json \ --save_dir outputs \ --control score \ --auto_shift \ --pitch_shift 0 ``` -------------------------------- ### Render and Launch Gradio Interface Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Renders and launches the Gradio web interface for the SoulX-Singer project. It configures the interface to queue requests and sets the server address and port. ```python page = render_interface() page.queue() page.launch( share=False, # Create public link server_name="0.0.0.0", # Bind address server_port=7860 # Server port ) ``` -------------------------------- ### Build SoulX-Singer Model Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Builds the SoulX-Singer model from a specified checkpoint path and configuration. It loads the model onto the specified device and prints the model's parameter count. ```python from cli.inference import build_model from soulxsinger.utils.file_utils import load_config # Load configuration config = load_config("soulxsinger/config/soulxsinger.yaml") # Build model from checkpoint model = build_model( model_path="pretrained_models/SoulX-Singer/model.pt", config=config, device="cuda" ) # Output: Prints model parameters count, e.g., "Model parameters: 150.5 M" ``` -------------------------------- ### Convert Metadata to MIDI Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/README.md Converts SoulX-Singer metadata JSON file into a MIDI file, preparing it for editing in a MIDI editor. Requires specifying input metadata and output MIDI file paths. ```python preprocess_root=example/transcriptions/music python -m preprocess.tools.midi_parser \ --meta2midi \ --meta "${preprocess_root}/metadata.json" \ --midi "${preprocess_root}/vocal.mid" ``` -------------------------------- ### SoulXSinger Model API for Inference (Python) Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Provides the core `SoulXSinger` class for neural network-based singing voice synthesis. It takes preprocessed metadata and generates audio using flow matching. Requires PyTorch and model weights. ```python import torch from soulxsinger.utils.file_utils import load_config from soulxsinger.models.soulxsinger import SoulXSinger # Load configuration and initialize model config = load_config("soulxsinger/config/soulxsinger.yaml") model = SoulXSinger(config).to("cuda") # Load pretrained weights checkpoint = torch.load("pretrained_models/SoulX-Singer/model.pt", map_location="cuda") model.load_state_dict(checkpoint["state_dict"], strict=True) model.eval() # Run inference with processed data # infer_data contains 'prompt' and 'target' dictionaries with: # - phoneme: tensor of phoneme indices # - mel2note: tensor mapping mel frames to notes # - note_type: tensor of note types (1=silence, 2=normal, 3=slur) # - note_pitch: tensor of MIDI pitch values (for score control) # - f0: tensor of F0 values in Hz (for melody control) # - waveform: tensor of audio samples (prompt only) with torch.no_grad(): generated_audio = model.infer( infer_data, auto_shift=True, # Automatically shift pitch to match prompt pitch_shift=0, # Manual pitch shift in semitones n_steps=32, # Number of diffusion steps cfg=3, # Classifier-free guidance scale control="melody" # Control mode: "melody" or "score" ) # Output: generated_audio tensor shape [1, num_samples] at 24kHz ``` -------------------------------- ### CLI Inference Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Run singing voice synthesis from the command line using preprocessed metadata files. The inference script loads a pretrained model and generates audio by combining a prompt (reference voice) with target metadata (lyrics and melody). ```APIDOC ## CLI Inference Run singing voice synthesis from the command line using preprocessed metadata files. The inference script loads a pretrained model and generates audio by combining a prompt (reference voice) with target metadata (lyrics and melody). ### Basic inference with melody control ```bash python -m cli.inference \ --device cuda \ --model_path pretrained_models/SoulX-Singer/model.pt \ --config soulxsinger/config/soulxsinger.yaml \ --prompt_wav_path example/audio/zh_prompt.mp3 \ --prompt_metadata_path example/audio/zh_prompt.json \ --target_metadata_path example/audio/zh_target.json \ --phoneset_path soulxsinger/utils/phoneme/phone_set.json \ --save_dir outputs \ --control melody ``` ### Inference with score control and automatic pitch shifting ```bash python -m cli.inference \ --device cuda \ --model_path pretrained_models/SoulX-Singer/model.pt \ --config soulxsinger/config/soulxsinger.yaml \ --prompt_wav_path example/audio/zh_prompt.mp3 \ --prompt_metadata_path example/audio/zh_prompt.json \ --target_metadata_path example/audio/music.json \ --phoneset_path soulxsinger/utils/phoneme/phone_set.json \ --save_dir outputs \ --control score \ --auto_shift \ --pitch_shift 0 ``` ``` -------------------------------- ### DataProcessor for Metadata Preprocessing (Python) Source: https://context7.com/soul-ailab/soulx-singer/llms.txt The `DataProcessor` class handles the preprocessing of metadata into tensors suitable for the model. It includes phoneme encoding, duration alignment, and F0 extraction. Requires audio files and phoneme set definitions. ```python from soulxsinger.utils.data_processor import DataProcessor import json # Initialize processor processor = DataProcessor( hop_size=480, # Audio hop size in samples sample_rate=24000, # Target sample rate phoneset_path="soulxsinger/utils/phoneme/phone_set.json", device="cuda" ) # Load metadata from JSON with open("example/audio/zh_prompt.json", "r", encoding="utf-8") as f: prompt_meta = json.load(f)[0] # Use first segment with open("example/audio/zh_target.json", "r", encoding="utf-8") as f: target_meta = json.load(f)[0] # Process prompt (with audio) and target (metadata only) prompt_data = processor.process(prompt_meta, wav_path="example/audio/zh_prompt.mp3") target_data = processor.process(target_meta, wav_path=None) # Combine for inference infer_data = { "prompt": prompt_data, # Contains: phoneme, mel2note, note_type, note_pitch, f0, waveform "target": target_data # Contains: phoneme, mel2note, note_type, note_pitch, f0 } ``` -------------------------------- ### DataProcessor Source: https://context7.com/soul-ailab/soulx-singer/llms.txt The `DataProcessor` class handles preprocessing of metadata into model-ready tensors, including phoneme encoding, duration alignment, and F0 extraction. ```APIDOC ## DataProcessor The `DataProcessor` class handles preprocessing of metadata into model-ready tensors, including phoneme encoding, duration alignment, and F0 extraction. ### Method ```python from soulxsinger.utils.data_processor import DataProcessor import json # Initialize processor processor = DataProcessor( hop_size=480, # Audio hop size in samples sample_rate=24000, # Target sample rate phoneset_path="soulxsinger/utils/phoneme/phone_set.json", device="cuda" ) # Load metadata from JSON with open("example/audio/zh_prompt.json", "r", encoding="utf-8") as f: prompt_meta = json.load(f)[0] # Use first segment with open("example/audio/zh_target.json", "r", encoding="utf-8") as f: target_meta = json.load(f)[0] # Process prompt (with audio) and target (metadata only) prompt_data = processor.process(prompt_meta, wav_path="example/audio/zh_prompt.mp3") target_data = processor.process(target_meta, wav_path=None) # Combine for inference infer_data = { "prompt": prompt_data, # Contains: phoneme, mel2note, note_type, note_pitch, f0, waveform "target": target_data # Contains: phoneme, mel2note, note_type, note_pitch, f0 } ``` ### Parameters #### Initialization Parameters - **hop_size** (int) - Required - Audio hop size in samples. - **sample_rate** (int) - Required - Target sample rate. - **phoneset_path** (str) - Required - Path to the phoneme set JSON file. - **device** (str) - Required - Device to use (e.g., "cuda", "cpu"). #### `process` Method Parameters - **metadata** (dict) - Required - Dictionary containing metadata for processing. - **wav_path** (str) - Optional - Path to the audio waveform file. If None, only metadata is processed. ### Request Example #### `prompt_meta` and `target_meta` JSON Structure (example) ```json [ { "phoneme": "a b c", "note_type": "1 2 3", "note_pitch": "60 62 64", "f0": "440 493.88 523.25" } ] ``` ### Response #### Success Response (200) - **prompt_data** (dict) - Processed data for the prompt, including `phoneme`, `mel2note`, `note_type`, `note_pitch`, `f0`, and `waveform` tensors. - **target_data** (dict) - Processed data for the target, including `phoneme`, `mel2note`, `note_type`, `note_pitch`, and `f0` tensors. - **infer_data** (dict) - Combined prompt and target data ready for inference. ``` -------------------------------- ### Metadata Field Descriptions Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Provides detailed explanations for each field within the SoulX-Singer metadata JSON format. This includes descriptions for index, language, time, duration, text, phoneme, note_pitch, note_type, and f0. ```python # Field descriptions: # - index: Unique segment identifier # - language: Lyric language (Mandarin, English, Cantonese) # - time: [start_ms, end_ms] segment timestamps # - duration: Space-separated note durations in seconds # - text: Space-separated lyrics ( = silence, = breath) # - phoneme: Space-separated phonemes with language prefix # - note_pitch: Space-separated MIDI note numbers (0 = rest) # - note_type: Space-separated types (1=silence, 2=normal, 3=slur) # - f0: Space-separated F0 values in Hz per frame (0.0 = unvoiced) ``` -------------------------------- ### Run SoulX-Singer Inference Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Executes the inference process for SoulX-Singer using provided arguments and configuration. This function generates the synthesized singing voice audio file. ```python from cli.inference import process from soulxsinger.utils.file_utils import load_config from argparse import Namespace # Load configuration config = load_config("soulxsinger/config/soulxsinger.yaml") # Build model from checkpoint (assuming model is already built and available) # model = build_model(...) # Create inference arguments args = Namespace( device="cuda", model_path="pretrained_models/SoulX-Singer/model.pt", config="soulxsinger/config/soulxsinger.yaml", prompt_wav_path="example/audio/zh_prompt.mp3", prompt_metadata_path="example/audio/zh_prompt.json", target_metadata_path="example/audio/zh_target.json", phoneset_path="soulxsinger/utils/phoneme/phone_set.json", save_dir="outputs", auto_shift=True, pitch_shift=0, control="melody" # or "score" ) # Run inference # process(args, config, model) # Assuming 'model' is defined from build_model # Output: Generates "outputs/generated.wav" ``` -------------------------------- ### Convert Edited MIDI to Metadata Source: https://github.com/soul-ailab/soulx-singer/blob/main/preprocess/README.md Converts an edited MIDI file back into SoulX-Singer-style metadata JSON and cuts corresponding vocal wav files. This is used after manual corrections in a MIDI editor for SVS inference. ```python python -m preprocess.tools.midi_parser \ --midi2meta \ --midi "${preprocess_root}/vocal_edited.mid" \ --meta "${preprocess_root}/edit_metadata.json" \ --vocal "${preprocess_root}/vocal.wav" \ ``` -------------------------------- ### SoulXSinger Model API Source: https://context7.com/soul-ailab/soulx-singer/llms.txt The core `SoulXSinger` class provides the neural network model for singing voice synthesis. It accepts preprocessed metadata and generates audio through flow matching-based generation. ```APIDOC ## SoulXSinger Model API The core `SoulXSinger` class provides the neural network model for singing voice synthesis. It accepts preprocessed metadata and generates audio through flow matching-based generation. ### Method ```python import torch from soulxsinger.utils.file_utils import load_config from soulxsinger.models.soulxsinger import SoulXSinger # Load configuration and initialize model config = load_config("soulxsinger/config/soulxsinger.yaml") model = SoulXSinger(config).to("cuda") # Load pretrained weights checkpoint = torch.load("pretrained_models/SoulX-Singer/model.pt", map_location="cuda") model.load_state_dict(checkpoint["state_dict"], strict=True) model.eval() # Run inference with processed data # infer_data contains 'prompt' and 'target' dictionaries with: # - phoneme: tensor of phoneme indices # - mel2note: tensor mapping mel frames to notes # - note_type: tensor of note types (1=silence, 2=normal, 3=slur) # - note_pitch: tensor of MIDI pitch values (for score control) # - f0: tensor of F0 values in Hz (for melody control) # - waveform: tensor of audio samples (prompt only) with torch.no_grad(): generated_audio = model.infer( infer_data, auto_shift=True, # Automatically shift pitch to match prompt pitch_shift=0, # Manual pitch shift in semitones n_steps=32, # Number of diffusion steps cfg=3, # Classifier-free guidance scale control="melody" # Control mode: "melody" or "score" ) # Output: generated_audio tensor shape [1, num_samples] at 24kHz ``` ### Parameters #### Request Body - **infer_data** (dict) - Required - Dictionary containing 'prompt' and 'target' data. - **prompt** (dict) - Required - Data for the reference voice. - **phoneme** (tensor) - Required - Tensor of phoneme indices. - **mel2note** (tensor) - Required - Tensor mapping mel frames to notes. - **note_type** (tensor) - Required - Tensor of note types (1=silence, 2=normal, 3=slur). - **note_pitch** (tensor) - Optional - MIDI pitch values (for score control). - **f0** (tensor) - Optional - F0 values in Hz (for melody control). - **waveform** (tensor) - Required - Audio samples. - **target** (dict) - Required - Data for the target synthesis. - **phoneme** (tensor) - Required - Tensor of phoneme indices. - **mel2note** (tensor) - Required - Tensor mapping mel frames to notes. - **note_type** (tensor) - Required - Tensor of note types (1=silence, 2=normal, 3=slur). - **note_pitch** (tensor) - Optional - MIDI pitch values (for score control). - **f0** (tensor) - Optional - F0 values in Hz (for melody control). - **auto_shift** (bool) - Optional - Automatically shift pitch to match prompt. Defaults to False. - **pitch_shift** (int) - Optional - Manual pitch shift in semitones. Defaults to 0. - **n_steps** (int) - Optional - Number of diffusion steps. Defaults to 32. - **cfg** (float) - Optional - Classifier-free guidance scale. Defaults to 3.0. - **control** (str) - Optional - Control mode: "melody" or "score". Defaults to "melody". ### Response #### Success Response (200) - **generated_audio** (tensor) - The synthesized audio waveform tensor with shape [1, num_samples] at 24kHz. ``` -------------------------------- ### F0 Extraction using RMVPE Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Performs F0 (fundamental frequency) extraction from audio using the RMVPE model. It can process audio to extract F0 values or save them directly to a file. ```python from preprocess.tools import F0Extractor # F0 extraction using RMVPE f0_extractor = F0Extractor( model_path="pretrained_models/SoulX-Singer-Preprocess/rmvpe/rmvpe.pt", device="cuda" ) f0_values = f0_extractor.process("vocal.wav") # Save F0 to file f0_extractor.process("vocal.wav", f0_path="vocal_f0.npy") ``` -------------------------------- ### Note Transcription using ROSVOT Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Performs note transcription from audio segments using the ROSVOT model. This function takes segment data and segment information as input. ```python from preprocess.tools import NoteTranscriber # Note transcription using ROSVOT note_transcriber = NoteTranscriber( rosvot_model_path="pretrained_models/SoulX-Singer-Preprocess/rosvot/rosvot/model.pt", rwbd_model_path="pretrained_models/SoulX-Singer-Preprocess/rosvot/rwbd/model.pt", device="cuda" ) segment_with_notes = note_transcriber.process(segment_data, segment_info=segment_data) ``` -------------------------------- ### Lyric Transcription Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Transcribes lyrics from audio segments, supporting both Mandarin and English. It outputs words and their corresponding durations. ```python from preprocess.tools import LyricTranscriber # Lyric transcription lyric_transcriber = LyricTranscriber( zh_model_path="pretrained_models/SoulX-Singer-Preprocess/speech_seaco_paraformer_large_asr_nat-zh-cn-16k-common-vocab8404-pytorch", en_model_path="pretrained_models/SoulX-Singer-Preprocess/parakeet-tdt-0.6b-v2/parakeet-tdt-0.6b-v2.nemo", device="cuda" ) words, durations = lyric_transcriber.process("vocal_segment.wav", language="Mandarin") ``` -------------------------------- ### Vocal Separation and Dereverberation Source: https://context7.com/soul-ailab/soulx-singer/llms.txt Separates vocals from accompaniment and performs dereverberation on the vocal track using pre-trained models. The output includes the clean vocal track, instrumental track, and sample rate. ```python from preprocess.tools import VocalSeparator # Vocal separation and dereverberation separator = VocalSeparator( sep_model_path="pretrained_models/SoulX-Singer-Preprocess/mel-band-roformer-karaoke/mel_band_roformer_karaoke_becruily.ckpt", sep_config_path="pretrained_models/SoulX-Singer-Preprocess/mel-band-roformer-karaoke/config_karaoke_becruily.yaml", der_model_path="pretrained_models/SoulX-Singer-Preprocess/dereverb_mel_band_roformer/dereverb_mel_band_roformer_anvuew_sdr_19.1729.ckpt", der_config_path="pretrained_models/SoulX-Singer-Preprocess/dereverb_mel_band_roformer/dereverb_mel_band_roformer_anvuew.yaml", device="cuda" ) result = separator.process("song.mp3") # result.vocals_dereverbed - clean vocal track # result.accompaniment - instrumental track # result.sample_rate - audio sample rate ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.