| 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 |  | ### beginSound()
Examples |  |
    void setup() {
      // Initiate sound engine with a 512 audio buffer length
      beginSound(512);
    }

    void soundEvent() {
      for (int i=0; i < length; i++) {
        // Generate a sound using a sine wave
        samples[i] =  int(127 * sin(i));
      }
    }
Description |  | The Processing sonic library allows for easy playback of sound files and the capability for more advanced sound manipulation. The sonic library is a sound engine which mixes BSound objects as they are played. Each BSound object is composed of many audio samples. To start the sound engine, call the beginSound() function in setup(). When beginSound(int length) is called, full sound processing is allowed as well as playback. That means that the samples[] array has a number of elements equal to length, and soundEvent() is called whenever a new audio frame is played. The sonic engine processes sounds at 8 bits, mono and 8000Hz. Note: Due to current limitation in the way Java 1.1 processes audio, the full sound processing mode has a time lag which varies among different machines and configurations. This may improve in future versions of Processing.
Syntax |  |
    beginSound()
    beginSound(length)
Usage |  | Web & Application
Related |  | BSound length samples[] soundEvent()

| © 2003- 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |