AIVoiceModels / dataseting.py
muhammedAdnan3's picture
Create dataseting.py
bf922be verified
import json
# Define a function to create a dataset with unique names
def create_voice_model_dataset(num_names):
# Generate a dataset with unique names
dataset = {"voiceModels": []}
for i in range(1, num_names + 1):
voice_model = {
"name": f"VoiceModel_{i}",
"description": f"Description for Voice Model {i}",
"version": "1.0",
"language": "en-US",
"voiceSettings": {
"gender": "neutral",
"age": "adult",
"accent": "American",
"tone": "natural",
"speakingRate": 1.0,
"volumeGain": 0.0
},
"speechSynthesis": {
"voiceName": f"VoiceModel_{i}_Voice",
"sampleRateHertz": 24000,
"pitch": 1.0,
"range": {
"min": 80,
"max": 250
},
"intelligibility": 0.8,
"emotionalTone": {
"happy": 0.6,
"sad": 0.3,
"angry": 0.2,
"neutral": 0.9
}
},
"phoneticModels": [
{
"name": f"VoiceModel_{i}_Phonetic_Model",
"description": "Basic phonetic model for standard American English pronunciation.",
"phonemes": [
"AA", "AE", "AH", "AO", "AW", "AY", "B", "CH", "D", "DH", "EH", "ER", "EY", "F", "G", "HH", "IH", "IY", "JH", "K", "L", "M", "N", "NG", "OW", "OY", "P", "R", "S", "SH", "T", "TH", "UH", "UW", "V", "W", "Y", "Z", "ZH"
]
}
],
"sampleVoices": [
{
"name": f"VoiceModel_{i}_Sample_Voice_1",
"description": "Sample voice for formal contexts.",
"gender": "male",
"age": "adult",
"audioFiles": [
f"sample_{i}_1.wav",
f"sample_{i}_2.wav",
f"sample_{i}_3.wav"
]
},
{
"name": f"VoiceModel_{i}_Sample_Voice_2",
"description": "Sample voice for informal contexts.",
"gender": "female",
"age": "adult",
"audioFiles": [
f"sample_{i}_4.wav",
f"sample_{i}_5.wav",
f"sample_{i}_6.wav"
]
}
],
"performanceMetrics": {
"accuracy": 0.95,
"latency": "100ms",
"responseTime": "250ms"
},
"additionalFeatures": {
"emotionRecognition": True,
"contextualAdaptation": True,
"multiLanguageSupport": False
}
}
dataset["voiceModels"].append(voice_model)
return dataset
# Create the dataset
num_names = 4000
dataset = create_voice_model_dataset(num_names)
# Save the dataset to a JSON file
with open('voice_model_dataset.json', 'w') as f:
json.dump(dataset, f, indent=4)
print(f"Dataset with {num_names} voice models has been created and saved to 'voice_model_dataset.json'.")