Skip to content

Commit

Permalink
Update Custom Voice sample code (#2405)
Browse files Browse the repository at this point in the history
* Update Custom Voice sample code
Show instruction when dev didn't copy customvoice folder.

* Personal Voice audio prompt file duration reduced from 50 seconds to 5 seconds.
Changed voice data structure. Now, consent file will not be used a audio prompt file.

* follow up code review feedback

---------

Co-authored-by: Jun-wei Gan <[email protected]>
  • Loading branch information
ForrestGumb and Jun-wei Gan authored Jun 6, 2024
1 parent 35a3845 commit 37eab67
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
Binary file not shown.
13 changes: 8 additions & 5 deletions samples/custom-voice/python/personal_voice_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
from time import sleep
import os
import logging
import customvoice
try:
import customvoice
except ImportError:
print('Pleae copy folder https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/custom-voice/python/customvoice and keep the same folder structure as github.' )
quit()
import azure.cognitiveservices.speech as speechsdk


Expand Down Expand Up @@ -104,15 +108,14 @@ def clean_up(project_id: str, consent_id: str, personal_voice_id: str):
# I [voice talent name] am aware that recordings of my voice will be used by [company name] to create and use a synthetic version of my voice.
# You can find sample consent file here
# https://github.com/Azure-Samples/Cognitive-Speech-TTS/blob/master/CustomVoice/Sample%20Data/Individual%20utterances%20%2B%20matching%20script/VoiceTalentVerbalStatement.wav
consent_file_path = r'voice\\VoiceTalentVerbalStatement.wav'
consent_file_path = r'TestData\\VoiceTalentVerbalStatement.wav'
voice_talent_name = 'Sample Voice Actor'
company_name = 'Contoso'

# Need 50 - 90 seconds audio file.
# Need 5 - 90 seconds audio file.
# You can find sample audio file here.
# https://github.com/Azure-Samples/Cognitive-Speech-TTS/blob/master/CustomVoice/Sample%20Data/Individual%20utterances%20%2B%20matching%20script/SampleAudios.zip
# Pleae unzip audio file, and put the first 14 files in folder below.
audio_folder = r'voice\\'
audio_folder = r'TestData\\voice\\'
speaker_profile_id = create_personal_voice(project_id,
consent_id, consent_file_path, voice_talent_name, company_name,
personal_voice_id, audio_folder)
Expand Down
6 changes: 5 additions & 1 deletion samples/custom-voice/python/professional_voice_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
import os
import datetime
import logging
import customvoice
try:
import customvoice
except ImportError:
print('Pleae copy folder https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/custom-voice/python/customvoice and keep the same folder structure as github.' )
quit()


def create_project():
Expand Down
Binary file removed samples/custom-voice/python/voice/sample.wav
Binary file not shown.

0 comments on commit 37eab67

Please sign in to comment.