|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object at.ofai.music.beatroot.AudioFile
public class AudioFile
A simple class for reading audio data from files.
Field Summary | |
---|---|
protected javax.sound.sampled.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 javax.sound.sampled.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. |
protected long |
length
The amount of audio data in bytes |
protected java.lang.String |
path
The path name of the audio file (relative or absolute) |
private at.ofai.music.util.RandomAccessInputStream |
underlyingStream
The raw stream from which data is read |
Constructor Summary | |
---|---|
AudioFile(java.lang.String pathName)
Constructor |
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Unit test for reading audio from jar file |
int[] |
read()
Reads a mono 16-bit audio file and returns the whole file as an int array |
int |
read(byte[] buffer)
Reads some number of bytes from the audio input stream and stores them into the buffer 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. |
java.lang.String |
toString()
Returns a String representation of the audio file, consisting of path name, length and frame size. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String path
private at.ofai.music.util.RandomAccessInputStream underlyingStream
protected javax.sound.sampled.AudioInputStream audioIn
protected javax.sound.sampled.AudioFormat format
protected long length
protected int frameSize
protected float frameRate
protected int channels
Constructor Detail |
---|
public AudioFile(java.lang.String pathName)
pathName
- The relative or absolute path name of the audio fileMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public double setPosition(double time) throws java.io.IOException
java.io.IOException
public long setPosition(long position) throws java.io.IOException
java.io.IOException
public int read(byte[] buffer)
buffer
- The buffer for storing audio data
public int[] read()
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |