You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Yes, I think it'd make a difference - as would getting rid of the function call... So:

      bufferEventHandler = function(b) {
        b.set(newData);
        if (pos >= len) { // loop sample
          flash.seek(0, 0);
          pos = 0;
        }    
        newData = flash.send(b);
        pos += b.length;
      };
    
    //....
    var newData = flash.send(w.buffer);
    

    While it still has to finish execution in time for the next one, there will be a slight delay between when the buffers are swapped and when the function is called. By filling the buffer at the start, the Waveform can actually swap buffers before execution of your callback has finished, and it'll still be fine.

    I'd definitely try something other than the saw wave just in case there are glitches - maybe something like voice?

    That Winbond chip seems great. Espruino's SPI can hit around 16Mhz I think (I'm not 100% sure on that - it'll depend on what chip, and I think some SPI devices might be able to go a little faster than others too). The chip itself can handle the 4 pin SPI thing too (SDIO-style interface?) but it's not exposed in Espruino - too much work I'm afraid and not enough call for it...

About

Avatar for Gordon @Gordon started