Wenn ich erfolgreich einen Ton mit einem Web Audio Oszillator (mit noteOn
) erstellen, dann rufen Sie seine noteOff
Funktion, nachfolgende Aufrufe an noteOn
nicht den Ton wiederzugeben. Ich muss einen neuen Oszillator erzeugen, um eine neue Note spielen zu können. Warum ist das?Warum spielt ein Web Audio Oszillator nur einmal eine Note?
var ctx = new webkitAudioContext();
var osc = ctx.createOscillator();
osc.connect(ctx.destination);
osc.start(0); // tone is heard (previously noteOn(0))
// ... some time later
osc.stop(0); // tone falls silent (previously noteOff(0))
// ... some time later
osc.start(0); // no effect! (previously noteOn(0))
Diese Antwort des FAQ hier bestätigt: http://updates.html5rocks.com/2012/01/Web-Audio-FAQ – aaaidan