You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm evaluating Play HT for potential use. While SSML is apparently supported, I can't seem to figure out how to access it using the python interface. Is it simply not implemented yet or is there a flag of some sort that I'm missing?
Here's the simple test case that leads to my confusion:
# import the playht SDKfrompyhtimportClient, TTSOptions, FormatimportioimportpyaudiofrompydubimportAudioSegmentdefplay_audio_stream(byte_iterator):
# Combine the bytes from the iterator into a single bytes objectmp3_data=b"".join(byte_iterator)
# Load the mp3 data into an AudioSegmentaudio=AudioSegment.from_file(io.BytesIO(mp3_data), format="mp3")
# Convert the AudioSegment to raw audio dataraw_data=audio.raw_datasample_rate=audio.frame_ratenum_channels=audio.channelssample_width=audio.sample_width# Initialize PyAudiop=pyaudio.PyAudio()
# Open a streamstream=p.open(format=p.get_format_from_width(sample_width),
channels=num_channels,
rate=sample_rate,
output=True)
# Play the audio by writing to the streamstream.write(raw_data)
# Stop and close the streamstream.stop_stream()
stream.close()
# Terminate PyAudiop.terminate()
# Initialize PlayHT API with your credentialsclient=Client("<id>", "<key>")
# configure your streamoptions=TTSOptions(
# this voice id can be one of our prebuilt voices or your own voice clone id, refer to the`listVoices()` method for a list of supported voices.# voice="s3://voice-cloning-zero-shot/d9ff78ba-d016-47f6-b0ef-dd630f59414e/female-cs/manifest.json",voice="s3://voice-cloning-zero-shot/a59cb96d-bba8-4e24-81f2-e60b888a0275/charlottenarrativesaad/manifest.json",
# you can pass any value between 8000 and 48000, 24000 is defaultsample_rate=44_100,
# the generated audio encoding, supports 'raw' | 'mp3' | 'wav' | 'ogg' | 'flac' | 'mulaw'format=Format.FORMAT_MP3,
# playback rate of generated speechspeed=1,
)
# start streaming!text='<speak><p>This is the beginning of a beautiful <break time="1.0s"/> friendship</p></speak>'# must use turbo voice engine for the best latencyaudio_stream=client.tts(text=text, voice_engine="PlayHT2.0-turbo", options=options)
play_audio_stream(iter(audio_stream))
The text was updated successfully, but these errors were encountered:
Hi folks,
I'm evaluating Play HT for potential use. While SSML is apparently supported, I can't seem to figure out how to access it using the python interface. Is it simply not implemented yet or is there a flag of some sort that I'm missing?
https://docs.play.ht/reference/api-convert-tts-ssml-standard-premium-voices
Here's the simple test case that leads to my confusion:
The text was updated successfully, but these errors were encountered: