The URL of the free Google Text-to-Speech service is:
https://cloud.google.com/text-to-speech
This service offers a variety of features, including the ability to convert text to speech in a variety of languages, choose from a variety of voices, adjust the speed and pitch of the voice, and download the audio file.
To use the service, you will need to create a Google Cloud Platform account and enable the Text-to-Speech API. Once you have enabled the API, you can use the following code to convert text to speech:
import iofrom google.cloud import texttospeech# Create a clientclient = texttospeech.TextToSpeechClient()# Set the text to be convertedtext = "Hello, world!"# Set the voicevoice = client.voices().list()[0]# Set the output formatoutput_format = texttospeech.OutputFormat.MP3# Convert the text to speechresponse = client.synthesize_speech( { "text": text, "voice": voice, "output_format": output_format, })# Get the audio bytesaudio_bytes = response.audio_content# Write the audio bytes to a filewith io.open("output.mp3", "wb") as f: f.write(audio_bytes)
This code will convert the text "Hello, world!" to speech and write the audio bytes to a file called "output.mp3". You can then play the audio file to hear the text being read aloud.
Sure. Here is the URL for the IBM Watson Text to Speech service:
https://cloud.ibm.com/text-to-speech
This service offers a variety of features, including the ability to convert text to speech in a variety of languages, choose from a variety of voices, adjust the speed and pitch of the voice, and download the audio file.
To use the service, you will need to create an IBM Cloud account and enable the Text to Speech service. Once you have enabled the service, you can use the following code to convert text to speech:
import iofrom ibm_watson import text_to_speech# Create a clientclient = text_to_speech.TextToSpeechV1()# Set the text to be convertedtext = "Hello, world!"# Set the voicevoice = client.list_ voices()[0]# Set the output formatoutput_format = text_to_speech.AudioFormat.MP3# Convert the text to speechresponse = client.synthesize_speech( { "text": text, "voice": voice, "output_format": output_format, })# Get the audio bytesaudio_bytes = response.get_result().content# Write the audio bytes to a filewith io.open("output.mp3", "wb") as f: f.write(audio_bytes)
This code will convert the text "Hello, world!" to speech and write the audio bytes to a file called "output.mp3". You can then play the audio file to hear the text being read aloud.
|