- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个奇怪的要求,即在我现有的应用程序中我有 Text2Speech
并且为此,我使用了 AVSpeechSynthesizer
来语音文本,但现在要求改变了,现在我需要将 HTML 文件数据转换为类似于 HTML2Speech
的文本。
我们可以想到的一种解决方案:
use
HTML
parsing and get all text from HTML and use same frameworkfor Text2Speech.
但客户不想要那种类型的解析,他想要任何直接提供 HTML2Speech
功能的 API
或框架。
任何建议或帮助将不胜感激。
最佳答案
由于我在此处使用 HTML 解析和 text2speech,您可以执行 2 个步骤1.使用以下代码从 HTML 文件中获取属性字符串适用于 iOS7+
As per your client perspective : if there is any API in market for HTML2Speech may be its Paid or you are depended on that API if you use any. While Native framework will help same what you/client wants.
第 1 步:
[[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUTF8StringEncoding]
options:@{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)}
documentAttributes:nil error:nil];
然后你可以在AVSpeechUtterance
中传递这个属性字符串
第 2 步:使用以下方法获取 HTML2String:
/**
* "ConvertHTMLtoStrAndPlay" : This method will convert the HTML to String
synthesizer.
*
* @param aURLHtmlFilePath : "object of html file path"
*/
-(void)ConvertHTMLtoStrAndPlay:(UIButton*)aBtnPlayPause
isSpeechPaused:(BOOL)speechPaused
stringWithHTMLAttributes:(NSAttributedString*)aStrWithHTMLAttributes
{
if (synthesizer.speaking == NO && speechPaused == NO) {
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:aStrWithHTMLAttributes.string];
//utterance.rate = AVSpeechUtteranceMinimumSpeechRate;
if (IS_ARABIC) {
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"ar-au"];
}else{
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-au"];
}
[synthesizer speakUtterance:utterance];
}
else{
[synthesizer pauseSpeakingAtBoundary:AVSpeechBoundaryImmediate];
}
if (speechPaused == NO) {
[synthesizer continueSpeaking];
} else {
[synthesizer pauseSpeakingAtBoundary:AVSpeechBoundaryImmediate];
}
}
和往常一样,当您需要停止使用下面的代码来停止语音时。
/**
* "StopPlayWithAVSpeechSynthesizer" : this method will stop the playing of audio on the application.
*/
-(void)StopPlayWithAVSpeechSynthesizer{
// Do any additional setup after loading the view, typically from a nib.
[synthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate];
}
希望这将帮助您获得 HTML2Speech 功能。
关于html - 是否可以使 "HTML to speech"与 "Text to speech"相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39285959/
我只是尝试使用 Microsoft.Speech.dll; 为文本转语音运行简单的 Microsoft 示例 using System; using Microsoft.Speech.Synthesi
微软似乎提供了不少语音识别产品,我想知道它们之间的区别。 有Microsoft Speech API ,或 SAPI。但不知何故Microsoft Cognitive Service Speech A
我希望编写一个应用程序,将语音到文本转换为仓库应用程序,反之亦然。主要用例是运算符(operator)将在仓库中佩戴耳机并将指令发送回服务器并从仓库软件接收指令以拣选和打包订单。我们将使用由 Wind
我正在探索 python 中的谷歌云语音 api。我正在关注这个 link .我也提到了这个 stackoverflow link .但是我对设置环境变量感到震惊。 我做过的事情: 1.安装gclou
在尝试让 Speech to Text(IBM 语音网关 IVR 应用程序)识别字母数字字符串时,我想知道我是否可以创建一个自定义语法或实体来限制 STT 仅识别单个字母和数字,不包括完全的话。例如,
是否可以将来自Web Speech API的合成语音用作Web Audio API音频上下文中的SourceNode? 最佳答案 实际上,我问过要在Web Speech邮件列表中添加此内容,并且基本上
使用 Microsoft Speech API 转录中/大型音频文件(每个文件约 6-10 分钟)的最佳方法是什么?像批处理音频文件转录这样的东西? 我使用了 https://docs.microso
我的 .wav 文件长度只有 4 秒。即使在多次重试并在云端运行后,我仍然不断收到以下错误 * upload completely sent off: 12 out of 12 bytes
我找到了一些描述如何使用 Google 语音 API 的文章 ( http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/
我使用 google 语音转文本 API 从音频中获取字幕,但是当音频太长时,通常超过 60 分钟,重试次数过多会失败。它说:google.api_core.exceptions.GoogleAPIC
我有一些来自 System.Speech.Recognition 的简单代码可以正常工作: using (var recognizer = new SpeechRecognitionEngine(ne
Windows 10。我在“设置”中安装了日语 TTS 语音。现在,当我在 Speech API 5.4 OneCore 中使用语音枚举时(虽然不是在 5.4 中),我得到 6 个语音: 大卫 齐拉
当我提交对太长文本的综合请求时,我收到以下错误: google.api_core.exceptions.ResourceExhausted: 429 Received message larger t
我是 C# 的新手,也是 Speech.Recognition 的新手。我搜索了很长时间的教程,但没有找到那么多,我什至不确定我是否正确包含了所有内容。 我下载了: SDK Runtime Langu
我有一个奇怪的要求,即在我现有的应用程序中我有 Text2Speech 并且为此,我使用了 AVSpeechSynthesizer 来语音文本,但现在要求改变了,现在我需要将 HTML 文件数据转换为
我使用 Google Speech API 通过 Python 识别 .OGG 文件音频中的越南语语音。但它不会返回任何结果。 最佳答案 至少在英文版的Google Speech API中,需要使用F
我想从手机录制音频,然后将其发送到谷歌语音非流媒体 API。我可以使用 Capture.captureAudio() 进行录音,但是我不知道音频编码和采样率是什么,因为它们是必需的 for the a
我使用谷歌云语音到文本 API 将音频转换为文本。 对于 .raw文件它工作正常 但是对于 .wav文件它给了我类似的错误: Google::Gax::RetryError Exception: Ga
.NET 中有两个类似的用于语音识别的命名空间和程序集。我试图了解其中的差异以及何时适合使用其中之一。 程序集 System.Speech(在 System.Speech.dll 中)有 System
通过流式 API (Performing Streaming Speech Recognition on an Audio Stream) 使用 Google Cloud Speech API, 我们
我是一名优秀的程序员,十分优秀!