Difference between revisions of "LiSa SndBuf multichan.ck"

From CSWiki
Jump to: navigation, search
 
 
Line 1: Line 1:
 
<pre>
 
<pre>
 +
//this is broken in current release 1.2.1.4-dev-1 (dracula); something changed in SndBuf
 +
//will be fixed in next release.
 +
 
//ugens
 
//ugens
 
SndBuf buf;
 
SndBuf buf;
Line 8: Line 11:
  
 
//set lisa buffer size to sample size
 
//set lisa buffer size to sample size
( buf.samples() / buf.channels() )::samp => lisa.duration;
+
buf.samples()::samp => lisa.duration;
 +
//buf.samples() returns frames now!
  
 
//transfer values from SndBuf to LiSa
 
//transfer values from SndBuf to LiSa
for ( 0 => int i; i < buf.samples() / buf.channels(); i++ ) {
+
for ( 0 => int i; i < buf.samples(); i++ ) {
 
      
 
      
 
     (buf.valueAt(i * buf.channels()), i::samp) => lisa.valueAt;
 
     (buf.valueAt(i * buf.channels()), i::samp) => lisa.valueAt;
Line 22: Line 26:
  
 
//hang on until it's done...
 
//hang on until it's done...
lisa.duration() * 0.=> now;
+
lisa.duration() / lisa.rate() => now;
 +
 
 
</pre>
 
</pre>

Latest revision as of 23:23, 28 May 2010

//this is broken in current release 1.2.1.4-dev-1 (dracula); something changed in SndBuf
//will be fixed in next release.

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

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

//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  => lisa.play;
2. => lisa.rate;

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