LiSa SndBuf.ck

From CSWiki
Revision as of 13:47, 18 October 2007 by Dtrueman (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

this example shows how to open a soundfile and use it in LiSa. someday LiSa may be able to open soundfiles directly, but don't hold your breath.

//ugens
SndBuf buf;
LiSa lisa => dac;

//change this path to your own sample
"/Users/dan/Files/Chuck/LiSa_examples/TomVega.wav" => buf.read;

//set lisa buffer size to sample size
buf.samples() * 1::samp => lisa.duration;

//transfer values from SndBuf to LiSa
for ( 0 => int i; i < buf.samples(); i++ ) {

	lisa.valueAt(buf.valueAt(i), i::samp);
	
}

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

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