Difference between revisions of "LiSa SndBuf.ck"

From CSWiki
Jump to: navigation, search
 
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
may be able to open soundfiles directly, but don't hold your breath.  
 
may be able to open soundfiles directly, but don't hold your breath.  
  
 +
<pre>
 
  //ugens
 
  //ugens
 
  SndBuf buf;
 
  SndBuf buf;
Line 10: Line 11:
 
   
 
   
 
  //set lisa buffer size to sample size
 
  //set lisa buffer size to sample size
  buf.samples() * 1::samp => lisa.duration;
+
  buf.samples()::samp => lisa.duration;
 
   
 
   
 
  //transfer values from SndBuf to LiSa
 
  //transfer values from SndBuf to LiSa
 +
//works properly for mono; need to skip samples for multichannel
 
  for ( 0 => int i; i < buf.samples(); i++ ) {
 
  for ( 0 => int i; i < buf.samples(); i++ ) {
 
   
 
   
  lisa.valueAt(buf.valueAt(i), i::samp);
+
  (buf.valueAt(i), i::samp) => lisa.valueAt;
 
 
 
 
 
  }
 
  }
Line 25: Line 27:
 
  //hang on until it's done...
 
  //hang on until it's done...
 
  lisa.duration() * 0.5  => now;
 
  lisa.duration() * 0.5  => now;
 +
</pre>

Latest revision as of 20:30, 23 February 2008

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()::samp => lisa.duration;
 
 //transfer values from SndBuf to LiSa
 //works properly for mono; need to skip samples for multichannel
 for ( 0 => int i; i < buf.samples(); i++ ) {
 
 	(buf.valueAt(i), i::samp) => lisa.valueAt;
 	
 }
 
 //party on...
 1  => lisa.play;
 2. => lisa.rate;
 
 //hang on until it's done...
 lisa.duration() * 0.5  => now;