How to generate your own sound?

If I had code like:

var sampleRate = 44100;
function soundWave(x) {
    return sin(x*700)*exp(-x);
}
var duration = 10; //In seconds
var data = [];
for (var i=0;i<sampleRate*duration;i++) {
    data[i] = soundWave(i/sampleRate);
}

How should I able to play the sound?

Tagged:

Answers

Sign In or Register to comment.