正在 Google 主页中播放短 wav 文件

Playing short wav files in Google Home

我想播放一段简短的声音以获得更有趣的输出。如果我正确理解文档,应该可以在 api.ai 中回复类似这样的 SSML:

<speak>Okay here we go: <audio src="http://example.com/boing.wav">boing</audio>. You are welcome!</speak>

仅供参考 SSML 表示 Speech Synthesis Markup Language

web simulator 不播放此声音,而是所有标签似乎都被删除了。是不支持还是我做错了什么?

这就是我的代码。它在文本响应字段中是我的意图。

 <speak> One second <break time="3s"/> OK, I have used the best quantum processing algorithms known to computer science! Your silly name is $color $number. I hope you like it. <audio src="https://www.partnersinrhyme.com/files/sounds1/WAV/sports/baseball/Ball_Hit_Cheer.wav"></audio> </speak>

它在api(dot)ai 领域的测试区不起作用,但当我打开集成并在Google 模拟器上尝试时它确实起作用。这里:https://developers.google.com/actions/tools/web-simulator

The src URL must also be an https URL (Google Cloud Storage can host your audio files on an https URL).

https://developers.google.com/actions/reference/ssml

没有看到您的来源,可能有以下几个原因:

我的 node.js 服务器有以下可用的(好吧,URL 除外):

  var msg = `
  <speak>
    Tone one
    <audio src="https://examaple.com/wav/Dtmf-1.wav"></audio>
    Tone two
    <audio src="https://example.com/wav16/Dtmf-2.wav"></audio>
    Foghorn
    <audio src="https://example.com/mp3/foghorn.mp3"></audio>
    Done
  </speak>
  `;

  var reply = {
    speech: msg,
    data:{
      google:{
        "expect_user_response": true,
        "is_ssml": true
      }
    }
  };

  res.send( reply );