You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • How big are the sound files you're playing? One thing that won't help is:

      myPico.wave = require("fs").readFile( myPico.filename );
      myPico.waveform = new Waveform(myPico.wave.length);
      myPico.waveform.buffer.set(myPico.wave);­
    

    try:

      myPico.waveform = undefined; // get rid of old waveform
      var wave = require("fs").readFile( myPico.filename );
      myPico.waveform = new Waveform(wave.length);
      myPico.waveform.buffer.set(wave);
    

    As it was, you had 2 copies of the waveform kicking around (the string, and waveform.buffer). Also when you then went to load another waveform, you still had the first 2 in memory, so you ended up with 3 copies of the Waveform, all in RAM at the same time :)

    Another thing you could do is actually to read the waveform into waveform.buffer a bit at a time, so you're not needing double the size of the waveform just to load it.

    ... and yes, you could potentially copy from an SD card to flash, which would be nice and easy - but if you've gone to all the trouble of wiring up an SD card then it's probably just worth using that to store all your data :)

About

Avatar for Gordon @Gordon started