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
/
scripts
RSK World
voice-cloning
Voice Cloning Dataset - Text-to-Speech + Voice Synthesis + TTS Models + Tacotron + WaveNet
scripts
  • __init__.py192 B
  • analyze_dataset.py6.4 KB
  • convert_format.py3.8 KB
  • extract_features.py4.8 KB
  • prepare_dataset.py4.8 KB
  • process_audio.py3.5 KB
  • validate_dataset.py7.1 KB
sample_processed_metadata.jsonvalidate_dataset.py
data/sample_processed_metadata.json
Raw Download
Find: Go to:
{
  "_comment": "Sample Processed Dataset Metadata - Developer: Molla Samser, Email: help@rskworld.in, Phone: +91 93305 39277, Website: https://rskworld.in, Year: 2026",
  "dataset_name": "Voice Cloning Dataset",
  "processing_date": "2026-01-15",
  "total_speakers": 50,
  "total_files": 1250,
  "train_test_split": {
    "train_ratio": 0.8,
    "validation_ratio": 0.1,
    "test_ratio": 0.1,
    "train_files": 1000,
    "validation_files": 125,
    "test_files": 125
  },
  "processing_settings": {
    "target_sample_rate": 22050,
    "normalize": true,
    "format": "wav",
    "channels": "mono"
  },
  "speakers": [
    {
      "speaker_id": "speaker_001",
      "train_files": 20,
      "validation_files": 2,
      "test_files": 3,
      "total_files": 25
    },
    {
      "speaker_id": "speaker_002",
      "train_files": 24,
      "validation_files": 3,
      "test_files": 3,
      "total_files": 30
    },
    {
      "speaker_id": "speaker_003",
      "train_files": 18,
      "validation_files": 2,
      "test_files": 2,
      "total_files": 22
    }
  ],
  "feature_extraction": {
    "mfcc_enabled": true,
    "mel_spectrogram_enabled": true,
    "pitch_enabled": true,
    "features_extracted": true
  },
  "contact": {
    "developer": "Molla Samser",
    "email": "help@rskworld.in",
    "phone": "+91 93305 39277",
    "website": "https://rskworld.in"
  }
}

58 lines•1.4 KB
json
scripts/validate_dataset.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
"""
Dataset Validation Script for Voice Cloning Dataset
Developer: Molla Samser
Email: help@rskworld.in
Phone: +91 93305 39277
Website: https://rskworld.in
Year: 2026
"""

import os
import json
import argparse
from pathlib import Path
import librosa


def validate_audio_file(audio_path):
    """
    Validate a single audio file.
    
    Returns:
        Dictionary with validation results
    """
    result = {
        'file': str(audio_path),
        'valid': False,
        'errors': [],
        'warnings': [],
        'info': {}
    }
    
    try:
        # Check if file exists
        if not Path(audio_path).exists():
            result['errors'].append('File does not exist')
            return result
        
        # Try to load audio
        try:
            audio, sr = librosa.load(audio_path, sr=None, mono=False)
            result['info']['sample_rate'] = sr
            result['info']['duration'] = librosa.get_duration(y=audio, sr=sr)
            result['info']['channels'] = 1 if len(audio.shape) == 1 else audio.shape[0]
            result['info']['shape'] = audio.shape
            
            # Check duration
            if result['info']['duration'] < 0.5:
                result['warnings'].append('Audio duration is very short (< 0.5s)')
            if result['info']['duration'] > 60:
                result['warnings'].append('Audio duration is very long (> 60s)')
            
            # Check sample rate
            if sr < 16000:
                result['warnings'].append(f'Sample rate is low ({sr} Hz)')
            if sr > 48000:
                result['warnings'].append(f'Sample rate is very high ({sr} Hz)')
            
            # Check for silence
            if abs(audio).max() < 0.01:
                result['warnings'].append('Audio appears to be silent or very quiet')
            
            result['valid'] = True
            
        except Exception as e:
            result['errors'].append(f'Error loading audio: {str(e)}')
            
    except Exception as e:
        result['errors'].append(f'Unexpected error: {str(e)}')
    
    return result


def validate_speaker_directory(speaker_dir):
    """Validate all files in a speaker directory."""
    speaker_path = Path(speaker_dir)
    results = {
        'speaker_id': speaker_path.name,
        'valid': True,
        'audio_files': [],
        'metadata_exists': False,
        'transcript_exists': False,
        'errors': [],
        'warnings': []
    }
    
    # Check for metadata.json
    metadata_file = speaker_path / 'metadata.json'
    if metadata_file.exists():
        results['metadata_exists'] = True
        try:
            with open(metadata_file, 'r') as f:
                metadata = json.load(f)
                results['metadata'] = metadata
        except Exception as e:
            results['errors'].append(f'Error reading metadata.json: {str(e)}')
    else:
        results['warnings'].append('metadata.json not found')
    
    # Check for transcripts.txt
    transcript_file = speaker_path / 'transcripts.txt'
    if transcript_file.exists():
        results['transcript_exists'] = True
    else:
        results['warnings'].append('transcripts.txt not found')
    
    # Validate audio files
    recordings_dir = speaker_path / 'recordings'
    if recordings_dir.exists():
        audio_extensions = ['.wav', '.flac', '.mp3']
        for ext in audio_extensions:
            for audio_file in recordings_dir.rglob(f'*{ext}'):
                validation = validate_audio_file(audio_file)
                results['audio_files'].append(validation)
                if not validation['valid']:
                    results['valid'] = False
    else:
        results['warnings'].append('recordings/ directory not found')
    
    return results


def validate_dataset(dataset_dir):
    """Validate entire dataset."""
    dataset_path = Path(dataset_dir)
    results = {
        'dataset_path': str(dataset_path),
        'total_speakers': 0,
        'valid_speakers': 0,
        'total_audio_files': 0,
        'valid_audio_files': 0,
        'speakers': [],
        'errors': [],
        'warnings': []
    }
    
    # Find all speaker directories
    for item in dataset_path.iterdir():
        if item.is_dir() and item.name.startswith('speaker_'):
            results['total_speakers'] += 1
            speaker_result = validate_speaker_directory(item)
            results['speakers'].append(speaker_result)
            
            if speaker_result['valid']:
                results['valid_speakers'] += 1
            
            results['total_audio_files'] += len(speaker_result['audio_files'])
            results['valid_audio_files'] += sum(
                1 for f in speaker_result['audio_files'] if f['valid']
            )
            
            if speaker_result['errors']:
                results['errors'].extend(speaker_result['errors'])
            if speaker_result['warnings']:
                results['warnings'].extend(speaker_result['warnings'])
    
    return results


def main():
    parser = argparse.ArgumentParser(description='Validate voice cloning dataset')
    parser.add_argument('--dataset', type=str, default='audio', 
                       help='Dataset directory (default: audio)')
    parser.add_argument('--output', type=str, 
                       help='Output JSON file for validation results')
    parser.add_argument('--verbose', action='store_true',
                       help='Show detailed validation information')
    
    args = parser.parse_args()
    
    print("=" * 60)
    print("Voice Cloning Dataset - Validation")
    print("Developer: Molla Samser")
    print("Website: https://rskworld.in")
    print("=" * 60)
    
    # Validate dataset
    results = validate_dataset(args.dataset)
    
    # Print summary
    print(f"\nValidation Summary:")
    print(f"  Total Speakers: {results['total_speakers']}")
    print(f"  Valid Speakers: {results['valid_speakers']}")
    print(f"  Total Audio Files: {results['total_audio_files']}")
    print(f"  Valid Audio Files: {results['valid_audio_files']}")
    
    if results['errors']:
        print(f"\n  Errors: {len(results['errors'])}")
        if args.verbose:
            for error in results['errors']:
                print(f"    - {error}")
    
    if results['warnings']:
        print(f"\n  Warnings: {len(results['warnings'])}")
        if args.verbose:
            for warning in results['warnings']:
                print(f"    - {warning}")
    
    # Save results if output specified
    if args.output:
        with open(args.output, 'w') as f:
            json.dump(results, f, indent=2)
        print(f"\nValidation results saved to {args.output}")
    
    # Exit with error code if validation failed
    if results['total_speakers'] > 0 and results['valid_speakers'] < results['total_speakers']:
        print("\n⚠ Validation completed with errors")
        return 1
    
    print("\n✓ Validation completed successfully")
    return 0


if __name__ == '__main__':
    exit(main())

217 lines•7.1 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