help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
voice-cloning
RSK World
voice-cloning
Voice Cloning Dataset - Text-to-Speech + Voice Synthesis + TTS Models + Tacotron + WaveNet
voice-cloning
  • audio
  • config
  • data
  • scripts
  • .gitignore700 B
  • COMPLETE_DOCUMENTATION.md21.8 KB
  • GITHUB_PUSH_SUMMARY.md3.9 KB
  • LICENSE380 B
  • README.md1.3 KB
  • RELEASE_NOTES.md3.1 KB
  • example_usage.py4.3 KB
  • index.html93.5 KB
  • project_info.json1.3 KB
  • project_info.php1.5 KB
  • requirements.txt486 B
  • setup.py3.2 KB
  • styles.css32.5 KB
train_model.pyexample_usage.py
example_usage.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
"""
Example Usage Script for Voice Cloning Dataset
Developer: Molla Samser
Email: help@rskworld.in
Phone: +91 93305 39277
Website: https://rskworld.in
Year: 2026
"""

import librosa
import soundfile as sf
import numpy as np
import json
from pathlib import Path


def example_load_audio():
    """Example: Load and display audio file information."""
    print("=" * 60)
    print("Example: Loading Audio File")
    print("=" * 60)
    
    # Example audio file path (replace with actual path)
    audio_path = "audio/speaker_001/recordings/sample_001.wav"
    
    if Path(audio_path).exists():
        # Load audio
        audio, sr = librosa.load(audio_path, sr=22050)
        
        print(f"Audio file: {audio_path}")
        print(f"Sample rate: {sr} Hz")
        print(f"Duration: {len(audio) / sr:.2f} seconds")
        print(f"Shape: {audio.shape}")
        print(f"Min value: {audio.min():.4f}")
        print(f"Max value: {audio.max():.4f}")
    else:
        print(f"Audio file not found: {audio_path}")
        print("Please add audio files to the audio/ directory")


def example_extract_features():
    """Example: Extract basic features from audio."""
    print("\n" + "=" * 60)
    print("Example: Extracting Features")
    print("=" * 60)
    
    audio_path = "audio/speaker_001/recordings/sample_001.wav"
    
    if Path(audio_path).exists():
        # Load audio
        audio, sr = librosa.load(audio_path, sr=22050)
        
        # Extract MFCC
        mfccs = librosa.feature.mfcc(y=audio, sr=sr, n_mfcc=13)
        print(f"MFCC shape: {mfccs.shape}")
        print(f"MFCC mean: {mfccs.mean():.4f}")
        
        # Extract mel spectrogram
        mel_spec = librosa.feature.melspectrogram(y=audio, sr=sr, n_mels=80)
        mel_spec_db = librosa.power_to_db(mel_spec, ref=np.max)
        print(f"Mel spectrogram shape: {mel_spec_db.shape}")
        
        # Extract pitch
        pitches, magnitudes = librosa.piptrack(y=audio, sr=sr)
        pitch_values = []
        for t in range(pitches.shape[1]):
            index = magnitudes[:, t].argmax()
            pitch = pitches[index, t]
            if pitch > 0:
                pitch_values.append(pitch)
        
        if pitch_values:
            print(f"Average pitch: {np.mean(pitch_values):.2f} Hz")
    else:
        print(f"Audio file not found: {audio_path}")


def example_process_audio():
    """Example: Process and save audio file."""
    print("\n" + "=" * 60)
    print("Example: Processing Audio")
    print("=" * 60)
    
    input_path = "audio/speaker_001/recordings/sample_001.wav"
    output_path = "processed/sample_001_processed.wav"
    
    if Path(input_path).exists():
        # Load and process
        audio, sr = librosa.load(input_path, sr=22050, mono=True)
        audio = librosa.util.normalize(audio)
        
        # Save processed audio
        Path(output_path).parent.mkdir(parents=True, exist_ok=True)
        sf.write(output_path, audio, sr)
        
        print(f"Processed audio saved to: {output_path}")
    else:
        print(f"Input file not found: {input_path}")


def example_load_config():
    """Example: Load dataset configuration."""
    print("\n" + "=" * 60)
    print("Example: Loading Configuration")
    print("=" * 60)
    
    config_path = "config/dataset_config.json"
    
    if Path(config_path).exists():
        with open(config_path, 'r') as f:
            config = json.load(f)
        
        print("Dataset Configuration:")
        print(f"  Name: {config.get('dataset_name')}")
        print(f"  Version: {config.get('version')}")
        print(f"  Sample Rate: {config['audio_settings']['target_sample_rate']} Hz")
        print(f"  Train Ratio: {config['train_test_split']['train_ratio']}")
    else:
        print(f"Config file not found: {config_path}")


def main():
    """Run all examples."""
    print("\n" + "=" * 60)
    print("Voice Cloning Dataset - Example Usage")
    print("Developer: Molla Samser")
    print("Website: https://rskworld.in")
    print("=" * 60 + "\n")
    
    example_load_config()
    example_load_audio()
    example_extract_features()
    example_process_audio()
    
    print("\n" + "=" * 60)
    print("Examples completed!")
    print("=" * 60)


if __name__ == '__main__':
    main()

144 lines•4.3 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer