public class WavFile extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the WavFile.
|
long |
getFramesRemaining()
Get the number of frames remaining.
|
int |
getNumChannels()
Gets the number of channels.
|
long |
getNumFrames()
Get the number of frames.
|
long |
getSampleRate()
Get the sample rate.
|
int |
getValidBits()
Get the number of valid bits.
|
static WavFile |
newWavFile(File file,
int numChannels,
long numFrames,
int validBits,
long sampleRate)
Initialize a new WavFile object for writing into the specified file.
|
static WavFile |
openWavFile(File file)
Read WAV contents from a provided file.
|
int |
readFrames(double[][] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a multi-dimensional double array.
|
int |
readFrames(double[][] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a multi-dimensional
double array.
|
int |
readFrames(double[] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a flat double array.
|
int |
readFrames(double[] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a flat double array.
|
int |
readFrames(int[][] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a multi-dimensional int array.
|
int |
readFrames(int[][] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a multi-dimensional int
array.
|
int |
readFrames(int[] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a flat int array.
|
int |
readFrames(int[] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a flat int array.
|
int |
readFrames(long[][] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a multi-dimensional long array.
|
int |
readFrames(long[][] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a multi-dimensional long
array.
|
int |
readFrames(long[] sampleBuffer,
int numFramesToRead)
Read some number of frames from the buffer into a flat long array.
|
int |
readFrames(long[] sampleBuffer,
int offset,
int numFramesToRead)
Read some number of frames from a specific offset in the buffer into a flat long array.
|
int |
writeFrames(double[][] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a multi-dimensional double array.
|
int |
writeFrames(double[][] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a multi-dimensional
double array.
|
int |
writeFrames(double[] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a flat double array.
|
int |
writeFrames(double[] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a flat double array.
|
int |
writeFrames(int[][] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a multi-dimensional int array.
|
int |
writeFrames(int[][] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a multi-dimensional int
array.
|
int |
writeFrames(int[] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a flat int array.
|
int |
writeFrames(int[] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a flat int array.
|
int |
writeFrames(long[][] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a multi-dimensional long array.
|
int |
writeFrames(long[][] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a multi-dimensional
long array.
|
int |
writeFrames(long[] sampleBuffer,
int numFramesToWrite)
Write some number of frames into the buffer from a flat long array.
|
int |
writeFrames(long[] sampleBuffer,
int offset,
int numFramesToWrite)
Write some number of frames into the buffer at a specific offset from a flat long array.
|
public int getNumChannels()
public long getNumFrames()
public long getFramesRemaining()
public long getSampleRate()
public int getValidBits()
public static WavFile newWavFile(File file, int numChannels, long numFrames, int validBits, long sampleRate) throws IOException, WavFileException
file - the file to write tonumChannels - the number of channels to usenumFrames - the number of frames to usevalidBits - the number of alid bits to usesampleRate - the sample rate for the new fileIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic static WavFile openWavFile(File file) throws IOException, WavFileException
file - the fileIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(int[] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(int[] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(int[][] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(int[][] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(int[] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(int[] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(int[][] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(int[][] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(long[] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(long[] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(long[][] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(long[][] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(long[] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(long[] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(long[][] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(long[][] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(double[] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(double[] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(double[][] sampleBuffer,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intonumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int readFrames(double[][] sampleBuffer,
int offset,
int numFramesToRead)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples intooffset - the buffer offset to read fromnumFramesToRead - the number of frames to readIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(double[] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(double[] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(double[][] sampleBuffer,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromnumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic int writeFrames(double[][] sampleBuffer,
int offset,
int numFramesToWrite)
throws IOException,
WavFileException
sampleBuffer - the buffer to read samples fromoffset - the buffer offset to write intonumFramesToWrite - the number of frames to writeIOException - Signals that an I/O exception has occurredWavFileException - a WavFile-specific exceptionpublic void close()
throws IOException
IOException - Signals that an I/O exception has occurredCopyright © 2020. All rights reserved.