-
public class WaveReader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classWaveReader.InvalidWaveException
-
Constructor Summary
Constructors Constructor Description WaveReader(String path, String name)Constructor; initializes WaveReader to read from given file WaveReader(File file)Constructor; initializes WaveReader to read from given file
-
Method Summary
Modifier and Type Method Description voidopenWave()Open WAV file for reading intgetSampleRate()Get sample rate intgetChannels()Get number of channels intgetPcmFormat()Get PCM format, S16LE or S8LE intgetFileSize()Get file size intgetDataSize()Get input file's audio data sizeBasically file size without headers included intgetLength()Get input file length intread(Array<short> dst, int numSamples)Read audio data from input file (mono) intread(Array<short> left, Array<short> right, int numSamples)Read audio data from input file (stereo) voidcloseWaveFile()Close WAV file. -
-
Constructor Detail
-
WaveReader
WaveReader(String path, String name)
Constructor; initializes WaveReader to read from given file- Parameters:
path- path to input filename- name of input file
-
WaveReader
WaveReader(File file)
Constructor; initializes WaveReader to read from given file- Parameters:
file- handle to input file
-
-
Method Detail
-
openWave
void openWave()
Open WAV file for reading
-
getSampleRate
int getSampleRate()
Get sample rate
-
getChannels
int getChannels()
Get number of channels
-
getPcmFormat
int getPcmFormat()
Get PCM format, S16LE or S8LE
-
getFileSize
int getFileSize()
Get file size
-
getDataSize
int getDataSize()
Get input file's audio data sizeBasically file size without headers included
-
getLength
int getLength()
Get input file length
-
read
int read(Array<short> dst, int numSamples)
Read audio data from input file (mono)
- Parameters:
dst- mono audio data output buffernumSamples- number of samples to read
-
read
int read(Array<short> left, Array<short> right, int numSamples)
Read audio data from input file (stereo)
- Parameters:
left- left channel audio output bufferright- right channel audio output buffernumSamples- number of samples to read
-
closeWaveFile
void closeWaveFile()
Close WAV file. WaveReader object cannot be used again following this call.
-
-
-
-