 |
 |
 |
Name |
|
soundEvent() |
 |
|
|
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 |
|
Called every time there is a new audio frame available. An audio frame is an array of audio samples that can be accessed using samples[] before it is sent to the audio device. An audio frame, similar to a video frame, has a finite size stored in the length variable. To use soundEvent(), beginSound(length) should be called inside setup(), where length is the dimension of each audio frame. |
 |
|
|
Syntax |
|
soundEvent() {
statements
}
|
 |
|
|
Parameters |
|
statements |
|
any valid statements
|
|
 |
|
|
Usage |
|
Web & Application |
 |
|
|
Related |
|
beginSound() samples[] length |