Pico.js is a JavaScript library for real-time audio processing that runs a browser and node.js.
<script src="pico.js"></script>
$ npm install node-pico
var pico = require("node-pico");
function sinetone(freq) {
var phase = 0,
phaseStep = freq / pico.samplerate;
return {
process: function(L, R) {
for (var i = 0; i < L.length; i++) {
L[i] = R[i] = Math.sin(6.28318 * phase) * 0.25;
phase += phaseStep;
}
}
};
}
pico.play(sinetone(880));
2013 02 13 - 0.0.8
- Performance improvement
- Fixed: a better? Float32Array (for IE9)
2013 01 15 - 0.0.7
- Bugfix
2013 01 15 - 0.0.6
- Fixed: stream size for WindowsXP (8192->4096)
2013 01 15 - 0.0.5
- Fixed: stream size for WindowsXP/Linux (1024->8192)
- Fixed: interval of processing for Firefox (using mozCurrentSampleOffset)
2012 12 11 - 0.0.4
- Added fake Float32Array (for IE9)
- Fixed: default samplerate (webkit=auto, moz,node.js=44.1KHz, flash=22.05KHz)
2012 12 08 - 0.0.3
- Fixed issue #2, added support cross-platform node.js
2012 12 07 - 0.0.2
- Fixed issue #1, the sound does not stop when switching browser tabs (Firefox)
2012 12 05 - 0.0.1
- First release