LiSa SndBuf

From CSWiki
Jump to: navigation, search
//this is broken in current release (dracula); something changed in SndBuf
//will be fixed in next release.

SndBuf buf;
LiSa lisa => dac;

//change this path to your own sample
"/Applications/Max5/examples/sounds/cello-f2.aif" =>;

//set lisa buffer size to sample size
buf.samples()::samp => lisa.duration;
//buf.samples() returns frames now!

//transfer values from SndBuf to LiSa
for ( 0 => int i; i < buf.samples(); i++ ) {
    (buf.valueAt(i * buf.channels()), i::samp) => lisa.valueAt;

//party on...
1  =>;
2. => lisa.rate;

//hang on until it's done...
lisa.duration() / lisa.rate() => now;