You are reading a single comment by @stephaneAG and its replies. Click here to read the full conversation.
  • 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 & 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);
    analogWrite(PICOSPK, 0.5); 
    /* 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
    var fileBuf =;
    // when one buffer finishes playing, load the next one
    w.on("buffer", function(buf) {
      fileBuf =;
      if (fileBuf===undefined) w.stop(); // end of file
    analogWrite(PICOSPK, 0.5);

    -> 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)


Avatar for stephaneAG @stephaneAG started