Synthesize speech from text
synthesizes a speech signal from the provided text.
fs] = text2speech(
interfaces with third-party speech services (Google®, IBM®, Microsoft®, or Amazon®) to perform the synthesis.
text2speech, you must download the extended Audio Toolbox™ functionality from File Exchange. The File Exchange submission includes a tutorial to get started
with the third-party services.
Synthesize Speech from Text
speechClient object that interfaces with the IBM Watson Text to Speech service.
synthesizer = speechClient("IBM");
text2speech with a string to synthesize a speech signal.
[speech,fs] = text2speech(synthesizer,"hello world");
Listen to the synthesized speech.
clientObj — Client object
Client object, specified as an object returned by
speechClient. The object is an interface to a third-party speech
You cannot use
text2speech with a
object that interfaces with the wav2vec 2.0 pretrained model.
To use the third-party speech services, you must download the extended Audio Toolbox functionality from File Exchange. The File Exchange submission includes a tutorial to get started with the third-party services.
text — Text
string | character array
Text to synthesize into speech, specified as a string or character array.
Example: "Hello world"
timeout — Time to wait for server connection in seconds
Time to wait for initial server connection in seconds, specified as a positive
scalar. This sets the
TimeOut property of
speech — Synthesized speech
Synthesized speech signal, returned as a column vector (single channel).
fs — Sample rate (Hz)
Sample rate of speech signal in Hz, returned as a positive double. The sample rate
depends on the third-party service and the server options set through the
See the documentation for the specific speech service for more information.
rawOutput — Unprocessed server output
ResponseMessage | structure
Unprocessed server output, returned as a
matlab.net.http.ResponseMessage object containing the HTTP response from the
third-party speech service. If the third-party speech service is Amazon,
text2speech returns the server output as a
Introduced in R2022b