Tree-Axis ``` Processing  


Back  
Name  

TriangleWave

   
Examples  
// Example by Krister Olsson

import krister.Ess.*;

AudioChannel myChannel;
TriangleWave 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 triangle wave
  myWave=new TriangleWave(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   The TriangleWave class is used to generate a triangle wave
   
   
Constructors  
TriangleWave(frequency, volume)
TriangleWave(frequency, volume, phase)
   
Parameters  
frequency   float: the frequency of the triangle wave in Hz

volume   float: the volume of the triangle wave (between 0 and 1)

phase   float: the phase of the triangle wave (between 0 and the sample rate of the target AudioChannel, AudioStream, or floating point array)

   
Usage   Web & Application
   
 
 






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


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