Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

BSound

   
Examples  
BSound hello; 
void setup() { 
  hello = loadSound("Hello.wav"); 
  play(hello); 
} 


BSound beep; 
void setup() { 
  beep = new BSound(400); // create an empty sound 
  for (int i = 0; i < beep.length; i++) { 
    // fill the sound with a sine wave 
    beep.samples[i] = int(127 * sin(float(i))); 
  } 
  repeat(beep); 
} 

Description   Datatype for storing sounds. Before a sound is played it must be created using one of the following methods: it could be loaded into Processing with the loadSound() function (both .wav and .au files can be loaded), it can be created from scratch using the new keyword, or it can be created with the microphone() and generate() functions. The BSound object contains an array called samples[] which stores the values for every audio sample in the sound object.
   
Syntax  
BSound name 
name.samples[]
name.length
   
Parameters  
name   the name of the sound can be any legal variable name

   
Usage   Web & Application
   
Related   samples[]
length
loadSound()
   
© 2003- 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas