Tree-Axis ``` Processing  


Back  
Class   AudioFile
   
Name  

read()

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioStream myStream;
AudioFile myFile;

void setup() {
  size(256,200);

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

  // get ready to stream our radio station (KXJC)
  // (Ess.READ does not require a sample rate)
  myFile=new AudioFile("http://66.225.205.51",0,Ess.READ);
  
  // create a new AudioStream and set the sample rate
  myStream=new AudioStream(128*1024); // 128k buffer
  myStream.sampleRate(myFile.sampleRate);
  myStream.start();
}

void draw() {
}

void audioStreamWrite(AudioStream theStream) {
  // read the next chunk
  int samplesRead=myFile.read(myStream);
}

// we are done, clean up Ess

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


Description   Reads from a sound stream opened for reading
   
Syntax  
file.read(buffer) 
file.read(buffer, offset, frames)
   
Parameters  
file   any instance of AudioFile

buffer   the instance of AudioChannel or AudioStream, or a floating point array in which to store read data

offset   int: the sample frame of the AudioChannel, AudioStream, or floating point array at which to start storing read data. The default is the first frame

frames   int: the number of frames to read. The default is the length of the AudioChannel, AudioStream, or floating point array

   
Returns   nothing
   
Usage   Web & Application
   
 
 






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


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