How can I get my code to speak with a voice

29 visualizaciones (últimos 30 días)
Rainaire Hansford
Rainaire Hansford el 24 de Jul. de 2017
Comentada: Image Analyst el 4 de Dic. de 2022
Im working on a big program and one of the few things I want it to do is speak. Does anyone have an idea. For example if my code is:
x=input('Hello','s');
if strcmpi(x,'Hello')
fprintf('Hello sir')
end
I want the hello sir to come out with a voice.
  3 comentarios
Image Analyst
Image Analyst el 8 de Dic. de 2018
Yes, that SpeechSynthesizer answer was already given below. Perhaps you didn't scroll down to the answers section to see it.
prathima k
prathima k el 6 de Jun. de 2019
How can i store the speech in a variable and produce audio output in raspberry pi 3

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 31 de Jul. de 2017
For text to speech, if you have Windows, you can try my demo program:
% Program to do text to speech.
% Get user's sentence
userPrompt = 'What do you want the computer to say?';
titleBar = 'Text to Speech';
defaultString = 'Hello World! MATLAB is an awesome program!';
caUserInput = inputdlg(userPrompt, titleBar, 1, {defaultString});
if isempty(caUserInput)
return;
end; % Bail out if they clicked Cancel.
caUserInput = char(caUserInput); % Convert from cell to string.
NET.addAssembly('System.Speech');
obj = System.Speech.Synthesis.SpeechSynthesizer;
obj.Volume = 100;
Speak(obj, caUserInput);
  8 comentarios
kim
kim el 4 de Dic. de 2022
@Edwin Cortez can I see your code please
Image Analyst
Image Analyst el 4 de Dic. de 2022
@kim my Answer and several of the comments below it have code in them. Did you overlook the code? It's there.

Iniciar sesión para comentar.

Más respuestas (2)

Stephen23
Stephen23 el 24 de Jul. de 2017
Editada: Stephen23 el 25 de Jul. de 2017
There is nothing built-in. Try downloading these:
Note that some rely on third-party apps or objects, and might only work on some versions of MATLAB. I know that at least some of them work, because I remember playing with them a year or two ago.
  2 comentarios
Rainaire Hansford
Rainaire Hansford el 30 de Jul. de 2017
Are theses like add-on for Matlab?
Walter Roberson
Walter Roberson el 30 de Jul. de 2017
The File Exchange contains MATLAB code (and possibly C or C++ code) that has been written by volunteers and made available for general use.
Some of the contributions for Text To Speech also need additional software packages beyond that.

Iniciar sesión para comentar.


Jan
Jan el 29 de Ag. de 2017

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by