Sure, I just tried it and the following works great for me:
var f = E.openFile("music.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
});
// start output
analogWrite(A4, 0.5);
w.startOutput(A4,4000,{repeat:true});
just copy the file to the root of the SD card as music.raw
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.
Sure, I just tried it and the following works great for me:
just copy the file to the root of the SD card as
music.raw
1 Attachment