|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cycling74.msp.AudioFileBuffer
public class AudioFileBuffer
A utility class for loading audio data off of disk and into memory. The data is translated from the native file format into the the floating point format used by msp.
| Field Summary | |
|---|---|
float[][] |
buf
buf contains the audio samples loaded off of disk deinterleaved by channel into a 2 dimensional floating point array. |
static int |
FINISHED_READING
If an instance of MessageReceiver is passed into the constructor the FINISHED_READING message will be sent to it when the requested file is successfully loaded into memory. |
| Constructor Summary | |
|---|---|
AudioFileBuffer(java.lang.String filename)
Constructor. |
|
AudioFileBuffer(java.lang.String filename,
MessageReceiver client)
Constructor. |
|
| Method Summary | |
|---|---|
int |
getChannels()
Get the number of channels of the current audio file. |
long |
getFrameLength()
Get the number of sample frames in the audio file.A frame consists of sample data for all channels at a particular instant in time.Thus a mono audio file which has 1000 samples will have a frame length of 1000 with each frame containing one sample. |
float |
getLengthMs()
Get the length of the current audio file in milliseconds. |
float |
getSampleRate()
Get the sample rate of the current audio file. |
int |
getSampleSizeInBits()
Get the sample size in bits of the current audio file. |
boolean |
isBigEndian()
Was the current audio file big endian format. |
void |
open(java.lang.String filename)
Load a different audio file into memory using this instance of AudioFileBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FINISHED_READING
public float[][] buf
| Constructor Detail |
|---|
public AudioFileBuffer(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException,
javax.sound.sampled.UnsupportedAudioFileException
filename - Absolute native path of the audio file to be loaded into memory.
java.io.FileNotFoundException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
public AudioFileBuffer(java.lang.String filename,
MessageReceiver client)
throws java.io.FileNotFoundException,
java.io.IOException,
javax.sound.sampled.UnsupportedAudioFileException
filename - Absolute native path of the audio file to be loaded into memory.client - instance of MessageReceiver which will be notified when file is finished being loaded into memory.
This information may or may not be relevant since the member buffer,buf[][], containing the audio data will be valid and zero filled
when the constructor returns.
java.io.FileNotFoundException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException| Method Detail |
|---|
public void open(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException,
javax.sound.sampled.UnsupportedAudioFileException
filename - Absolute native path of the audio file to be loaded into memory.
java.io.FileNotFoundException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileExceptionpublic float getSampleRate()
public int getSampleSizeInBits()
public boolean isBigEndian()
public long getFrameLength()
public int getChannels()
public float getLengthMs()
frame length / (sample rate / 1000)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||