【发布时间】:2021-08-04 13:12:01
【问题描述】:
这是我当前的代码。我想在不使用 Web 浏览器的情况下使用 Node.js 中的 Tone.js 库。到目前为止,我知道AudioBuffer 是浏览器的一项功能,但我怎样才能让这段代码在 Node.js 中工作?
const Tone = require("Tone");
//create a synth and connect it to the main output (your speakers)
Tone = new Tone.Synth().toDestination();
//play a middle 'C' for the duration of an 8th note
Tone.triggerAttackRelease("C4", "8n");
这是我得到的错误:
ReferenceError: AudioBuffer is not defined
然后它链接到 node_modules 文件夹中的 Tone.js 文件。
【问题讨论】:
标签: javascript node.js tone.js