当前位置: 首页 > 知识库问答 >
问题:

超过5000个字符限制使用SSML与文本输入:谷歌文本到语音(TTS)

陆昕
2023-03-14

根据使用Google Cloud平台的文本到语音API创建语音音频文件的文档,使用语音合成标记语言(SSML)时会出现以下错误,而使用与标准文本格式相同的内容时不会出现错误。

这是使用SSML时出现的错误,因为SSML的字符数远低于5000个限制(2979个):

错误:3个无效参数:超过5000个字符的限制。

const Speech = require('ssml-builder');
const textToSpeech = require('@google-cloud/text-to-speech');

...

const client = new textToSpeech.TextToSpeechClient();
const speech = new Speech();

...
console.log('Convert Article ' + data.id + ': ' + data.text);

return client.synthesizeSpeech({
        input: { text: data.text},
        voice: {
          languageCode: '[language-code]',
          name: '[language-option]',
        },
        audioConfig: {
          audioEncoding: '[encoding-type]',
          pitch: "[pitch]",
          speakingRate: "[speaking-rate]"
        },
      })

使用ssml builder包。

console.log('Convert Article ' + data.id + ': ' + speech.say(data.text).ssml());

return client.synthesizeSpeech({
        input: { ssml: speech.say(data.text).ssml()},
        voice: {
          languageCode: '[language-code]',
          name: '[language-option]',
        },
        audioConfig: {
          audioEncoding: '[encoding-type]',
          pitch: "[pitch]",
          speakingRate: "[speaking-rate]"
        },
      })

文章:比特币消亡的报道被“严重夸大”

字符数:2904

The current bitcoin bear market, labeled crypto winter for its debilitating effect on the broader market and industry, has seen more than $700 billion wiped from the total value of all cryptocurrencies so far this year, some 80% of its value since its all-time high.

Bitcoin has seen similar price percentage declines before, however, and has managed to recover from them. Now, researchers from the University of Cambridge Judge Business School have found the bitcoin industry will "likely" bounce back again.

"Statements proclaiming the death of the crypto-asset industry have been made after every global ecosystem bubble," researchers wrote in the second Global Cryptoasset Benchmarking Study. "While it is true that the 2017 bubble was the largest in bitcoin's history, the market capitalization of both bitcoin and the crypto-asset ecosystem still exceeds its January 2017 levels-prior to the start of the bubble.

"The speculation of the death of the market and ecosystem has been greatly exaggerated, and so it seems likely that the future expansion plans of industry participants will, at most, be delayed."

While the bitcoin industry still has many supporters despite the price collapse, others have been quick to brand bitcoin as dead, something that's happened more than 300 times according to the loosely-updated tracking website 99bitcoins.

Elsewhere, bitcoin bulls, such former Goldman Sachs partner and founder of cryptocurrency merchant bank Galaxy Digital Holdings Mike Novogratz, have sobered up since the giddy highs of late 2017.

Researchers also found that millions of new users have entered the ecosystem over the last 12 months, though most are passive -- buying bitcoin or other cryptocurrencies with newly created wallets and then not moving or using them.

Total user accounts at service providers now exceed 139 million with at least 35 million identity-verified users, the latter growing nearly four-fold in 2017 and doubling again in the first three quarters of 2018, according to the report.

Only 38% of all users can be considered active, although definitions and criteria of activity levels vary significantly across service providers.

Meanwhile, the study found that the top six proof-of-work cryptocurrencies (including bitcoin and ethereum) collectively consume between 52 TWh and 111 TWh of electricity per year: the mid-point of the estimate (82 TWh) is the equivalent of the total energy consumed by the entire country of Belgium -- but also constitutes less than 0.01% of the world's global energy production per year.

A "notable" share of the energy consumed by these facilities is supplied by renewable energy sources in regions with excess capacity, the researchers revealed.

The report also found that cryptocurrency mining appears to be less concentrated geographically, in hashing power ownership, and in manufacturer options, than is widely thought.

字符数:2979

<speak>The current bitcoin bear market, labeled crypto winter for its debilitating effect on the broader market and industry, has seen more than $700 billion wiped from the total value of all cryptocurrencies so far this year, some 80% of its value since its all-time high.

Bitcoin has seen similar price percentage declines before, however, and has managed to recover from them. Now, researchers from the University of Cambridge Judge Business School have found the bitcoin industry will &quot;likely&quot; bounce back again.

&quot;Statements proclaiming the death of the crypto-asset industry have been made after every global ecosystem bubble,&quot; researchers wrote in the second Global Cryptoasset Benchmarking Study. &quot;While it is true that the 2017 bubble was the largest in bitcoin&apos;s history, the market capitalization of both bitcoin and the crypto-asset ecosystem still exceeds its January 2017 levels-prior to the start of the bubble.

&quot;The speculation of the death of the market and ecosystem has been greatly exaggerated, and so it seems likely that the future expansion plans of industry participants will, at most, be delayed.&quot;

While the bitcoin industry still has many supporters despite the price collapse, others have been quick to brand bitcoin as dead, something that&apos;s happened more than 300 times according to the loosely-updated tracking website 99bitcoins.

Elsewhere, bitcoin bulls, such former Goldman Sachs partner and founder of cryptocurrency merchant bank Galaxy Digital Holdings Mike Novogratz, have sobered up since the giddy highs of late 2017.

Researchers also found that millions of new users have entered the ecosystem over the last 12 months, though most are passive -- buying bitcoin or other cryptocurrencies with newly created wallets and then not moving or using them.

Total user accounts at service providers now exceed 139 million with at least 35 million identity-verified users, the latter growing nearly four-fold in 2017 and doubling again in the first three quarters of 2018, according to the report.

Only 38% of all users can be considered active, although definitions and criteria of activity levels vary significantly across service providers.

Meanwhile, the study found that the top six proof-of-work cryptocurrencies (including bitcoin and ethereum) collectively consume between 52 TWh and 111 TWh of electricity per year: the mid-point of the estimate (82 TWh) is the equivalent of the total energy consumed by the entire country of Belgium -- but also constitutes less than 0.01% of the world&apos;s global energy production per year.

A &quot;notable&quot; share of the energy consumed by these facilities is supplied by renewable energy sources in regions with excess capacity, the researchers revealed.

The report also found that cryptocurrency mining appears to be less concentrated geographically, in hashing power ownership, and in manufacturer options, than is widely thought.</speak>

共有1个答案

於功
2023-03-14

例如:

console.log('Convert Article ' + data.id + ': ' + (new Speech()).say(data.text).ssml())

Speech对象创建了一次,但使用了两次。创建后,它既用于记录文本的内容以用于调试(讽刺的是),又用于写入导致配额达到的文件。

const speech=new speech()

console.log('Convert Article ' + data.id + ': ' + speech.say(data.text).ssml())
  input: { ssml: speech.say(data.text).ssml()}

 类似资料:
  • 我正在使用谷歌云语音到文本AP,并试图转录长音频文件。但是,无法检测到桶中的音频文件。我得到一个错误,说明:IOError:[Errno 2]没有这样的文件或目录: transcribe_gcs(gcs_uri):

  • Android谷歌语音转文本SDK,语音录制由SDK控制。我需要将其设置为手动按钮,用于启动和停止语音录制,以便将语音转换为文本。例如:当单击按钮开始语音识别时,它会继续录制音频,直到单击停止按钮。但在android SDK中,它会自动停止录制并将录制的音频传递给处理。

  • 我能够使用链接中包含的教程转录音频(https://cloud.google.com/speech-to-text/docs/async-recognize),但它仅适用于WAV格式的音频。我想让它与MP3或M4A格式的音频一起工作。 我已经测试了链接中包含的所有可能性(https://github.com/GoogleCloudPlatform/java-docs-samples/blob/ma

  • 我想通过Google Cloud文本到语音API使用SSML标记来请求音频流中这些标记的计时。这些时间戳是必要的,以便为效果、单词/部分突出显示和用户反馈提供线索。 我发现这个问题是相关的,尽管这个问题指的是每个单词的时间戳,而不是SSML

  • 我正在使用spyder IDE进行我的语音到文本转换项目,该项目使用谷歌语音到文本api。我在代码中集成了谷歌语音和文本,出现了类似“配额耗尽”的错误。在谷歌控制台的仪表板上,我可以看到可用的配额。 > 错误 文件"C:\Program Data\Anaconda3\lib\site-包\speech_recognition__init__. py",第932行,在recognize_google

  • 我想用nodejs和googlespeech-to-text api制作一个实时转录应用程序。 我正在使用RecordRTC和socket。io将音频块获取到后端服务器。目前,我正在录制1秒长的块,并且转录工作正常,但它没有将其视为流,而是在处理每个块后发送响应。这意味着我要收回半句话,谷歌无法利用上下文帮助自己识别演讲。 我的问题是,如何让谷歌将我的块视为一个连续的流。或者是否有其他解决方案可以