This utility helps you create a personal voice using Azure AI Speech Services. It creates a voice profile that you can use for text-to-speech synthesis that sounds like your own voice.
- An Azure Speech resource with Personal Voice feature enabled
- Python 3.6+ with the following libraries:
requestsfor API communicationpydubfor audio conversion (optional, but recommended)- Alternatively, FFmpeg installed on your system for audio conversion
- Audio files:
- One consent recording (clear statement giving consent to use your voice)
- At least two sample audio recordings of your voice (clear, high-quality recordings)
- Format: WAV, M4A, MP3, or other common audio formats (will be converted to the proper format automatically)
- Consent file: Recording of you saying the required consent statement
- Sample files: Clear recordings of your natural speech (30+ seconds each recommended)
- Record in a quiet environment with minimal background noise
The script will automatically convert your audio files to the required format (16-bit PCM WAV, 16kHz, mono):
- If
pydubis installed, it will be used for the conversion - If
pydubfails or isn't available, FFmpeg will be used as a fallback - If neither is available, the script will provide installation instructions
# Basic usage
python create_personal_voice.py --consent /path/to/consent.wav --samples /path/to/sample1.wav /path/to/sample2.wav --name "Your Name"
# Advanced usage with all parameters
python create_personal_voice.py \
--consent /path/to/consent.wav \
--samples /path/to/sample1.wav /path/to/sample2.wav /path/to/sample3.wav \
--name "Your Name" \
--company "Your Company" \
--locale "en-US" \
--project-id "YourProjectID" \
--consent-id "YourConsentID" \
--voice-id "YourVoiceID"python create_personal_voice.py --consent voice/consent2.wav --samples voice/sample3.wav voice/sample4.wav --name "Elena Neroslavskaya"For the consent recording, you should record yourself clearly saying:
"I [state your name], am aware that [state company name] will use recordings of my voice to create and use a synthetic version of my voice."
Once your personal voice is created, you'll receive a Speaker Profile ID that you can use in your text-to-speech applications with the Azure Speech Service.
To use it with the existing text_to_speech.py script:
speaker_profile_id = "your_speaker_profile_id_here"
personal_voice_text_to_speech("This is my personal voice.", speaker_profile_id, "my_voice_output.wav")