フィルターのクリア

Changing system('say') command values

1 回表示 (過去 30 日間)
william
william 2014 年 4 月 2 日
回答済み: Carlos Gonzalez 2019 年 4 月 1 日
Making MATLAB to speak on a Mac can be done with system('say hello world') but how to modify the existing system('say') function values? how to specify the system voice name and speak the text from a file or a variable?
Does anybody have tried and succeeded for Chinese? system('say 你好')

回答 (2 件)

Walter Roberson
Walter Roberson 2014 年 4 月 2 日
system('say -v VoiceNameHere -f FileNameHere')
  3 件のコメント
Walter Roberson
Walter Roberson 2014 年 4 月 8 日
str = char([20320 22909]);
system( sprintf('say -v VoiceNameHere %s', str) )
My expectation would be that that will fail, considering the error message you saw. To get the UTF-8 using a file:
fid = fopen('FileNameHere', 'w', 'UTF-8');
fwrite(fid, char([20320 22909]), 'char');
fclose(fid);
and then the system() I showed above.
Why did I use [20320 22909] ? I looked up the characters at http://www.khngai.com/chinese/tools/codechar.php?code=%E5%A5%BD
With my Mac and MATLAB set up the way it is at the moment, I am not able to copy-and-paste the Chinese characters from another window into a MATLAB string. I am not certain if that could be changed.
william
william 2014 年 4 月 9 日
編集済み: william 2014 年 4 月 9 日
Thank you for your comment,,,I was able to perform this with the following script
feature('DefaultCharacterSet', 'UTF-8')%twice
str = char([20320 22909]);
system( sprintf('say -v Mei %s', str) ) %Taiwanese voice
system( sprintf('say -v Ting %s', str) ) %Main land China voice

サインインしてコメントする。


Carlos Gonzalez
Carlos Gonzalez 2019 年 4 月 1 日
myString = "hello world";
command = strcat('say',{' '},myString);
system(command)
Where myString is the text you wish for your mac to speak.

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by