How can I get my code to speak with a voice

조회 수: 40 (최근 30일)
Rainaire Hansford
Rainaire Hansford 2017년 7월 24일
댓글: Image Analyst 2022년 12월 4일
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
Image Analyst
Image Analyst 2018년 12월 8일
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 2019년 6월 6일
How can i store the speech in a variable and produce audio output in raspberry pi 3

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2017년 7월 31일
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
kim
kim 2022년 12월 4일
@Edwin Cortez can I see your code please
Image Analyst
Image Analyst 2022년 12월 4일
@kim my Answer and several of the comments below it have code in them. Did you overlook the code? It's there.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Stephen23
Stephen23 2017년 7월 24일
편집: Stephen23 2017년 7월 25일
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
Rainaire Hansford
Rainaire Hansford 2017년 7월 30일
Are theses like add-on for Matlab?
Walter Roberson
Walter Roberson 2017년 7월 30일
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.

댓글을 달려면 로그인하십시오.


Jan
Jan 2017년 8월 29일

카테고리

Help CenterFile Exchange에서 AI for Audio에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by