目标c“说”命令

发布于 2024-09-13 05:37:23 字数 66 浏览 1 评论 0原文

在applescript中有一个say命令。 Objective c 有类似的东西吗?

谢谢, 以利亚

In applescript there is a say command. Is there something like this for objective c?

Thanks,
Elijah

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

零度℉ 2024-09-20 05:37:23

在 iPhone 上就没有办法了。如果您正在谈论 mac 代码,Cocoa 有一个类可以执行此操作(NSSpeechSynthesizer)。

代码:

NSSpeechSynthesizer * syn = [[NSSpeechSynthesizer alloc] init];
[syn startSpeakingString:@"my string"];

On the iPhone there is no way. If you are talking about mac code, Cocoa has a class to do this (NSSpeechSynthesizer).

Code:

NSSpeechSynthesizer * syn = [[NSSpeechSynthesizer alloc] init];
[syn startSpeakingString:@"my string"];
深府石板幽径 2024-09-20 05:37:23

您可以使用 NSTask 运行“say”命令行程序

SO 描述< /a>

You can just use NSTask to run the 'say' commandline program

SO Description

睡美人的小仙女 2024-09-20 05:37:23

你要切换到windows环境吗?如果是这样,您可以使用语音 SDK:

http:// /msdn.microsoft.com/en-us/library/ms723627(VS.85).aspx

以下是如何在 C# 中实现它的示例(抱歉,对 C 不太熟悉,希望它有所帮助):

http://www.c-sharpcorner.com/UploadFile/ssrinivas/ TextToSpeechConversioninCSharp11222005060134AM/TextToSpeechConversioninCSharp.aspx

如果您不切换到 Windows,希望有一种方法可以使用 SKD...

Are you switching to the windows environment?? If so, you can utilized the Speech SDK:

http://msdn.microsoft.com/en-us/library/ms723627(VS.85).aspx

Here is an example of how to implement it in C# (sorry, not that familiar with C, hopefully its helpful):

http://www.c-sharpcorner.com/UploadFile/ssrinivas/TextToSpeechConversioninCSharp11222005060134AM/TextToSpeechConversioninCSharp.aspx

If you aren't switching to windows, hopefully there is a way to use the say SKD...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文