|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsampled.AudioFileReader
public final class AudioFileReader
Use the AudioFileReader to read from an audio file. Supported are all kinds of raw, Mu- and A-law compressed data in various frame and bit rates. Check the RawAudioFormat class for more details on supported file types. Can use the WAV headers to automatically adjust the parameters.
Field Summary | |
---|---|
static double |
DEFAULT_PREEMPHASIS_FACTOR
|
static java.lang.String |
synopsis
|
Constructor Summary | |
---|---|
AudioFileReader(RawAudioFormat format,
byte[] data)
Construct an AudioFileReader which reads from an already available byte array. |
|
AudioFileReader(java.lang.String fileName,
boolean cacheFile)
Construct an AudioFileReader using WAV header data |
|
AudioFileReader(java.lang.String fileName,
RawAudioFormat format,
boolean cacheFile)
Construct an AudioFileReader using a custom RawAudioFormat |
Method Summary | |
---|---|
boolean |
getPreEmphasis()
Does the AudioSource perform pre-emphasis? |
int |
getSampleRate()
Return the sampling rate of the loaded audio file |
static void |
main(java.lang.String[] args)
|
static void |
preEmphasize(double[] buf,
double a,
double s0)
Perform a pre-emphasis on the given signal vector: x'(n) = x(n) - a * x(n-1) with s0 = x(-1) |
int |
read(double[] buf)
Read a number of samples from the audio file and save it to the given buffer. |
void |
setPreEmphasis(boolean applyPreEmphasis,
double a)
Toggle the pre-emphasis of the audio signal |
void |
tearDown()
Tear down the AudioSource (i.e. |
java.lang.String |
toString()
Get a string representation of the source |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static double DEFAULT_PREEMPHASIS_FACTOR
public static java.lang.String synopsis
Constructor Detail |
---|
public AudioFileReader(RawAudioFormat format, byte[] data) throws java.io.IOException
format
- RawAudioFormat describing the datadata
- byte array with read audio data
java.io.IOException
public AudioFileReader(java.lang.String fileName, boolean cacheFile) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException
fileName
- cacheFile
- use buffered reader?
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
public AudioFileReader(java.lang.String fileName, RawAudioFormat format, boolean cacheFile) throws java.io.IOException
fileName
- format
- if null, it will be determined by the headercacheFile
- use buffered reader?
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException
RawAudioFormat.create
Method Detail |
---|
public boolean getPreEmphasis()
AudioSource
getPreEmphasis
in interface AudioSource
public int getSampleRate()
getSampleRate
in interface AudioSource
public static void main(java.lang.String[] args) throws java.io.IOException, javax.sound.sampled.UnsupportedAudioFileException, MalformedParameterStringException
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
MalformedParameterStringException
public static void preEmphasize(double[] buf, double a, double s0)
buf
- audio frame; in-place transformation!a
- pre-emphasis factors0
- value to use for first elementpublic int read(double[] buf) throws java.io.IOException
read
in interface AudioSource
buf
- double buffer; will try to read as many samples as fit in the buffer
java.io.IOException
public void setPreEmphasis(boolean applyPreEmphasis, double a)
AudioSource
setPreEmphasis
in interface AudioSource
applyPreEmphasis
- apply pre-emphasis?a
- the pre-emphasis factor: x'(n) = x(n) - a*x(n-1)public void tearDown()
AudioSource
tearDown
in interface AudioSource
public java.lang.String toString()
AudioSource
toString
in interface AudioSource
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |