Confirmed users
656
edits
Line 238: | Line 238: | ||
// will give us one full period | // will give us one full period | ||
var samples = 44100 / freq; | var samples = 44100 / freq; | ||
sampledata = | // Could use Array() here too, typed array is faster | ||
sampledata = Float32Array(Math.round(samples)); | |||
for (var i=0; i<sampledata.length; i++) { | for (var i=0; i<sampledata.length; i++) { | ||
sampledata[i] = Math.sin(2*Math.PI * (i / sampledata.length)); | sampledata[i] = Math.sin(2*Math.PI * (i / sampledata.length)); |