Update: tried new headphone its much louder than the last one and your code worked. Though still having similar problems as before with playing a voice recording. The code we are using is posted below.
// SD card setup
//DI(mosi) = B15
//DO(miso) = B14
//CK(sck = B10
//CS(CD pin) = B1
var spi = new SPI();
spi.setup({mosi:B15, miso:B14, sck:B10});
E.connectSDCard(spi, B1);
console.log(require("fs").readdirSync());
var f = E.openFile("X-File.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(A7, 0.5);
w.startOutput(A7,8000,{repeat:true});
Where "X-File.raw" is a file I made in audacity using the guide lines provided in the waveform documentation and is in the proper format of .raw(header-less) unsigned 8-bit PCM with a 8000hz playback speed. As I play the file I can accurately make out each spoken word in the sentence however it is very fuzzy to the point where you can barely make out the words and a single high pitch tone can be heard overtop of that audio. Can you recommend anything that can possibly fix this?
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.
Update: tried new headphone its much louder than the last one and your code worked. Though still having similar problems as before with playing a voice recording. The code we are using is posted below.
Where "X-File.raw" is a file I made in audacity using the guide lines provided in the waveform documentation and is in the proper format of .raw(header-less) unsigned 8-bit PCM with a 8000hz playback speed. As I play the file I can accurately make out each spoken word in the sentence however it is very fuzzy to the point where you can barely make out the words and a single high pitch tone can be heard overtop of that audio. Can you recommend anything that can possibly fix this?