at.ofai.music.beatroot
public class AudioFile extends Object
Field Summary | |
---|---|
protected AudioInputStream | audioIn The stream from which audio is read (after conversion if necessary) |
protected int | channels The number of channels in the audio stream |
protected AudioFormat | format The format of the audio data |
protected float | frameRate The sampling rate |
protected int | frameSize The size of an audio frame (i.e. one sample for each channel) |
protected long | length The amount of audio data in bytes |
protected String | path The path name of the audio file (relative or absolute) |
RandomAccessInputStream | underlyingStream The raw stream from which data is read |
Constructor Summary | |
---|---|
AudioFile(String pathName) Constructor |
Method Summary | |
---|---|
static void | main(String[] args) Unit test for reading audio from jar file |
int | read(byte[] buffer) Reads some number of bytes from the audio input stream and stores them into the buffer array. |
int[] | read() Reads a mono 16-bit audio file and returns the whole file as an int array |
double | setPosition(double time) Moves the read pointer to the specified time in seconds. |
long | setPosition(long position) Moves the read pointer to the specified byte position. |
String | toString() Returns a String representation of the audio file, consisting of
path name, length and frame size. |
Parameters: pathName The relative or absolute path name of the audio file
Parameters: buffer The buffer for storing audio data
Returns: The number of bytes read, or -1 if there is no more data (EOS)
Returns: The content of the audio file