-> for the File page, as usual, "if I can figure stuff out/help, .." ;P
-> for the SD card pic(s): I quickly posted the annotated one, in case someone stumble upon this post, but I'm willing to do it under illustrator, for a nicer rendering, as well as add annotation on the Pico pic as well, and also add the corresponding example code / pinout diagram
=> I guess I'll make such "page" with a github README.md & then post you the url for approval / fork to the Espruino repo, what'd be the easier for you ?
-> concerning the Waveform code ( posted below ), I can record what's happening: I get a beep out ( as when using only "analogWrite(BUZZER, 0.5)" ) + some "noise" ( which seems close to what I get when specifying wrong sample rate while opening a file in Audacity )
=> as far as I can tell, it seems that whatever smaple rate is chosen / whatever the file, I get the above results :/
/* works fine */
// debug test the buzzer
var BUZZER=B3;
analogWrite(BUZZER, 0.5); // simplest bip
analogWrite(BUZZER, 0.5, { freq: 1000 } ); // bip with freq ctrl ( here 1kHz )
digitalWrite(BUZZER,0); // stop the bip
/* does NOT work as expected */
// output a 4kHz 8 bit unsigned sound file loaded from the SD card:
var PICOSPK=B4;
var wave = require("fs").readFile("G01.raw");
var w = new Waveform(wave.length);
w.buffer.set(wave);
analogWrite(PICOSPK, 0.5);
w.startOutput(PICOSPK,15625);
/* does NOT work as expected either */
var f = E.openFile("G01.raw","r");
var w = new Waveform(2048, {doubleBuffer:true});
// load first bits of sound file
w.buffer.set(f.read(w.buffer.length));
w.buffer2.set(f.read(w.buffer.length));
var fileBuf = f.read(w.buffer.length);
// when one buffer finishes playing, load the next one
w.on("buffer", function(buf) {
buf.set(fileBuf);
fileBuf = f.read(buf.length);
if (fileBuf===undefined) w.stop(); // end of file
});
analogWrite(PICOSPK, 0.5);
w.startOutput(PICOSPK,15625,{repeat:true});
//w.startOutput(PICOSPK,4000,{repeat:true});
-> I'm about to record the output of the 8 ohms 0.25W speaker connected directly to B4, I'll post that right below
-> for the said-samples, I attached few ( none seems to work for me, even though I encoded some myself using Audacity as exposed)
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.
Haha, you up :)
-> for the File page, as usual, "if I can figure stuff out/help, .." ;P
-> for the SD card pic(s): I quickly posted the annotated one, in case someone stumble upon this post, but I'm willing to do it under illustrator, for a nicer rendering, as well as add annotation on the Pico pic as well, and also add the corresponding example code / pinout diagram
=> I guess I'll make such "page" with a github README.md & then post you the url for approval / fork to the Espruino repo, what'd be the easier for you ?
-> concerning the Waveform code ( posted below ), I can record what's happening: I get a beep out ( as when using only "analogWrite(BUZZER, 0.5)" ) + some "noise" ( which seems close to what I get when specifying wrong sample rate while opening a file in Audacity )
=> as far as I can tell, it seems that whatever smaple rate is chosen / whatever the file, I get the above results :/
-> I'm about to record the output of the 8 ohms 0.25W speaker connected directly to B4, I'll post that right below
-> for the said-samples, I attached few ( none seems to work for me, even though I encoded some myself using Audacity as exposed)