Tree-Axis ``` Processing  


Back  
Class   AudioChannel
   
Name  

buffer2[]

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioChannel myChannel;

void setup() {
  size(256,200);
  background(0,0,255);

  // start up Ess
  Ess.start(this);

  // load "cell.aif" into a new AudioChannel
  myChannel=new AudioChannel("cell.aif");

  // start playing
  myChannel.play();
}

void draw() {
  stroke(255,10);

  // overlay an average of the samples in the buffer being played 
  // plus the previous buffer
  float inc=myChannel.buffer2.length/256.0f;
  for (int i=0;i<256;i++) {
    int y=(int)(100+myChannel.buffer2[(int)(i*inc)]*100);
    
    line(i-200,y-200,i+200,y+200);
  }
}

// we are done, clean up Ess

public void stop() {
  Ess.stop();
  super.stop();
}


Description   The float array buffer2 will at any given moment contain a copy of the data previously sent to the sound playback engine, immediately followed by the data currently being sent to the engine. buffer2 can be accessed to process sample data as it is being played (see the example Analysis to learn how to produce an oscilloscope effect). buffer2.length is equal to buffer.length*2
   
Syntax  
channel.buffer2[]
   
Parameters  
channel   any instance of AudioChannel

   
Usage   Web & Application
   
 
 






   
 
Updated: Tue May 31 04:52:43 PDT 2006


 
  Questions, comments, corrections: e-mail Krister Olsson.