 |
 |
 |
Class |
|
Sample |
 |
|
|
Name |
|
readChannel() |
 |
|
|
Examples |
|
// Populate the data[] array with sample data.
// Notes: Make sure to include the specified audio file in your project's 'data' folder.
Sample mySample;
float[] data;
void setup() {
size(100,100);
Sonia.start(this);
mySample = new Sample("sine.aif");
data = new float[mySample.getNumFrames()];//creates a new array the length of the sample
mySample.readChannel(Sonia.RIGHT, data);
}
public void stop(){
Sonia.stop();
super.stop();
}
|
|
|
Description |
|
Populates an array with the data from a one of two channels of a stereo file. The sample data comes in floats of -1.0 to 1.0 per frame. A 44.1 kHz sample has 44100 frames per second. |
 |
|
|
Syntax |
|
mySample.readChannel(channel, dataArray);
mySample.readChannel(channel, dataArray, firstDataFrame, firstSampleFrame, numFrames)
|
 |
|
|
Parameters |
|
channel |
|
int: 0 or Sonia.LEFT for Left channel, 1 or Sonia.RIGHT for Right channel
|
dataArray |
|
float[]: an array that can hold float values
|
firstDataFrame |
|
int: First index element to populate in the data[] array
|
firstSampleFrame |
|
int: First sample frame to read
|
numFrames |
|
int: number of sample frames to read
|
|
 |
|
|
Returns |
|
None |
 |
|
|
Usage |
|
Web & Application |
 |
|
|
Related |
|
write() writeChannel() read() |