I have a bit of a problem limiting the duration of this oscillator to about 10 seconds using audiolib.js. When I used the dsp.js library, I limited the duration to using bufferSize, but I absolutely do not know how to do this using the audiolib.js library ... Any help would be great! While I am in this, can anyone tell me the maximum and minimum frequency and amplitude?
$(document).ready(function () { //var context = new webkitAudioContext(); var playing; var dev = audioLib.AudioDevice(audioCallback, 2); var osc = audioLib.Oscillator(dev.sampleRate, 440); //var bfo = audioLib.Oscillator(dev.sampleRate, 1.0); //osc.addAutomation('frequency', bfo, 0.5, 'modulation'); osc.waveShape = 'pulse'; function audioCallback(buffer, channelCount) { if (playing) { //bfo.generateBuffer(buffer.length / channelCount); osc.append(buffer, channelCount); //remove the audiocallback function } } $('#playButton').click(function () { playing = true; }); });
Hooray!
source share