Tree-Axis ``` Processing  


Back  
Class   SineWave
   
Name  

generate()

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioChannel myChannel;
SineWave myWave;

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

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

  // create a new AudioChannel
  myChannel=new AudioChannel();

  // set the channel size to 5 seconds
  myChannel.initChannel(myChannel.frames(5000));

  // generate 3 seconds of a soft sine wave
  myWave=new SineWave(480,.1);
  myWave.generate(myChannel,0,myChannel.frames(3000));

  // play
  myChannel.play();
}

void draw() {
}

// we are done, clean up Ess

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


Description   Generates sample data and stores it in, adds it to, or subtracts it from an AudioChannel, AudioStream, or a floating point array
   
Syntax  
sine.generate(out)
sine.generate(out, mode)
sine.generate(out, offset, frames) 
sine.generate(out, mode, offset, frames)

sine.generate(outArray, rate)
sine.generate(outArray, rate, mode)
sine.generate(outArray, rate, offset, frames)
sine.generate(outArray, rate, mode, offset, frames) 
   
Parameters   ,
sine   any instance of SineWave

out   the output AudioChannel or AudioStream instance

outArray   float[]: the output array

rate   float: the sample rate of the output floating point array

mode   replace, add, or subtract once generated: Ess.REPLACE, Ess.ADD, Ess.SUBRACT

offset  int: the sample frame from which to start generating. The default is the first frame

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

   
Returns   nothing
   
Usage   Web & Application
   
 
 






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


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