@Gordon I'm getting fairly reliable readings now.
I guess my next question is how do I generate sounds of varying length. Out of my depth here I think.
I thought that this would generate 0.5seconds of...something, and then 0.5 seconds of silence, but I just get a click
AudioContext = window.AudioContext || window.webkitAudioContext; audioContext = new AudioContext(); gainNode = audioContext.createGain(); gainNode.gain.value = 1; var buffer = audioContext.createBuffer(1, 44100, 44100); var b = buffer.getChannelData(0); for (var i = 0; i < 22050; i++) { b[i] = 1.0; } for (var i = 22050; i < 44100; i++) { b[i] = -1.0; } source = audioContext.createBufferSource(); source.buffer = buffer; source.connect(gainNode); source.start(); gainNode.connect(audioContext.destination);
@dave_irvine started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon I'm getting fairly reliable readings now.
I guess my next question is how do I generate sounds of varying length. Out of my depth here I think.
I thought that this would generate 0.5seconds of...something, and then 0.5 seconds of silence, but I just get a click