Back
Class   LiveOutput
   
Name  

startStream()

   
Examples  
// Start the LiveOutput engine with a streamSize of 512 frames, and a streamBuffer twice the size. 
// Use the LiveOutputEvent(){} to update the LiveOutput.data[] array with Sine wave information. 
// The Y value of the mouse will determine the Sine wave's frequency. 
// Draw the current sound data on the stage. 
 
int streamSize = 512; // holds the streamSize value for the liveOutput.data[] array. 
 
void setup(){ 
  size(512,200); 
  Sonia.start(this,11025); // Start Sonia at a lower sampling-rate for better performance. 
  LiveOutput.start(streamSize,streamSize*2); // Start LiveOutput with a buffer. 
  LiveOutput.startStream(); // Start the liveOutput stream, and activate the liveOutputEvent(){} 
} 
 
void loop(){ 
  background(0); 
  stroke(255); 
  // Draw the current sample information in the LiveOutput.data[] stream array. 
  for(int i = 0; i < LiveOutput.data.length-1; i++){ 
    line(i,height/2 - LiveOutput.data[i]*30,i+1,height/2 - LiveOutput.data[i+1]*30); 
  } 
} 
 
// This event is automatically called when the system requests new data for the stream. 
void liveOutputEvent(){ 
// Populate the LiveOutput.data[] data array with a sine-wave. 
  for(int i = 0; i < LiveOutput.data.length; i++){ 
    float oneCycle = TWO_PI/streamSize; 
    int freq = (height - mouseY)/10; 
    float sinData = (freq*2) * oneCycle * i; 
    LiveOutput.data[i] = sin(sinData); 
  } 
} 
 
public void stop(){ 
  Sonia.stop(); 
  super.stop(); 
} 

Description   Starts calling the liveOutputEvent(), which runs at a higher framerate than the Processing environment, to handle audio data in real time. Use the liveOutputEvent() event to update the LiveOutput.data[] array with 'fresh' sound data.
   
Syntax  
LiveOutput.startStream()
   
Returns   None
   
Usage   Web & Application
   
Related   start()
stop()
stopStream()