RedSampler playing soundfiles from memory


superclass: RedAbstractSampler


nothing fancy.  this version just loads complete soundfiles into ram and use PlayBuf to play them pack.


see also [RedDiskInSampler]



s.boot;

a= RedSampler(s);


//-- setting up which samples to use and preload them

a.preload(\snd1, "sounds/a11wlk01-44_1.aiff");

a.preload(\snd2, "sounds/break"); //add your own soundfile

a.preload(\snd3, "sounds/a11wlk01-44_1.aiff", 44100); //offset 44100 samples


//-- play

a.play(\snd1); //play the whole soundfile

a.voicesLeft(\snd1)

a.stop(\snd1); //stop


a.play(\snd1, 1, 0, 0.1); //play with slow attack and quick release


a.play(\snd2); //play another sample

a.play(\snd3); //and another

a.play(\snd3, 0.1, 0.1, 0.1); //very short


a.play(\snd2);

a.stop(\snd2, 1); //stop with 1 second fadetime


( //start many at once

a.play(\snd1);

a.play(\snd2);

a.play(\snd3);

)

a.flush(0); //stop all right away


a.play(\snd2);

a.play(\snd2);

a.voicesLeft(\snd2); //check if any free voices

a.stop(\snd2, 0);

a.stop(\snd2, 0);

a.voicesLeft(\snd2); //check if any free voices


a.loadedKeys; //report all keys that have soundfiles loaded

a.overlaps; //how many voices allowed to play simultaneously


a.length(\snd1); //how long is the soundfile in seconds

a.channels(\snd1); //how many channels

a.buffers(\snd1); //access buffers for a key.  one for each overlap


a.free; //stop and clear