Objective c NSSpeechSynthesis没有声音和声音?
我有这个Objective-C函数Objective c NSSpeechSynthesis没有声音和声音?,objective-c,xcode,macos,appkit,speech-synthesis,Objective C,Xcode,Macos,Appkit,Speech Synthesis,我有这个Objective-C函数 -(void)makeFunnySounds{ NSSpeechSynthesizer *synth = [[NSSpeechSynthesizer alloc] initWithVoice:@"com.apple.speech.synthesis.voice.Alex"]; [synth startSpeakingString:@"Hello"]; } 我好像没法让它工作。音量调大了。我可以在终端中执行打招呼,这样就可以了 通过Xcode
-(void)makeFunnySounds{
NSSpeechSynthesizer *synth = [[NSSpeechSynthesizer alloc] initWithVoice:@"com.apple.speech.synthesis.voice.Alex"];
[synth startSpeakingString:@"Hello"];
}
我好像没法让它工作。音量调大了。我可以在终端中执行打招呼
,这样就可以了
通过Xcode,我可以获得可用语音的列表。我尝试使用[synth setVolume:1]设置volume属性代码>这也不起作用
有什么想法吗?您确定正在调用您的方法吗?因为我刚刚拼凑了一个又快又脏的OSX应用程序,而你的代码运行得很好。是的,它正在被调用。你的计算机是静音的吗?(与音量被调低相反)不,我很确定音量是开着的。我能听到其他声音。NSLog(“%@,[NSSpeechSynthesizer availableVoices])代码>为您打印?