howler.js
How to Download a Binary File Into a Javascript Object using XHR.
如何使用XHR将二进制文件下载到Javascript对象中。
This article uses the Korerorero project as an example. Korerorero is an open source implementation of an animated chatbot with voice recognition.
本文以Korerorero项目为例。 Korerorero是具有语音识别功能的动画聊天机器人的开源实现。
To implement the voice of the chatbot, the voice audio is created by korerorero-marytts service. This data needed to be downloaded async, then stored in memory and passed to the audio player library. The howler.js audio library expects a URL to the file.
为了实现聊天机器人的语音,语音音频由korerorero-marytts服务创建。 该数据需要异步下载,然后存储在内存中并传递到音频播放器库。 howler.js音频库需要文件的URL。
To set the stage, the API has returned the URL of the WAV file to download. The following code initiates a GET
request to the audio service and stores the resulting