Package wavFiles
Class WavFileWriter
java.lang.Object
wavFiles.WavFile
wavFiles.WavFileWriter
-
Field Summary
Fields inherited from class wavFiles.WavFile
byteConverter, currentFormat, fileMode, fileName, wavHeader, windowsFile -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanappend(double[][] rawData) Append data to a file which may or may not be closed already.voidclose()protected voidfinalize()longbooleanwrite(double[][] doubleArray) Writes an array of double values to an existing WAV file.static booleanWrites an array of double values to a WAV file.static booleanwriteSingleChannel(String file, AudioFormat format, double[] doubleArray) Writes an array of double values to a WAV file.Methods inherited from class wavFiles.WavFile
getCurrentFormat, getFileName, getWavHeader, positionAtData, readWavHeader, reportError, setPosition
-
Constructor Details
-
WavFileWriter
-
-
Method Details
-
writeSingleChannel
Writes an array of double values to a WAV file. This method only writes single channel data.- Parameters:
format-AudioFormatobject describing the desired filedoubleArray- the array of double values to save- Returns:
- boolean indicating success or failure of the write
-
finalize
-
write
public boolean write(double[][] doubleArray) Writes an array of double values to an existing WAV file. This method writes single and multi-channel data. This method writes the data with any bit depth, depending on how the wav file object was created using an AudioFormat.- Parameters:
doubleArray- the array of double values to save. Note that this is defined as a 2D array. If a single-channel 1D vector is passed, it doesn't seem to be a problem.- Returns:
- boolean indicating success or failure of the write
-
append
public boolean append(double[][] rawData) Append data to a file which may or may not be closed already.
If the file is still open then this simply calls the write function, otherwise it has to reopen the file.- Parameters:
rawData- Raw data to write. Must match audio format file was opened with.- Returns:
- true if write was OK.
-
write
Writes an array of double values to a WAV file. This method writes single and multi-channel data. This method always writes the data as 16-bit. It shoul dbe used only for one off writing of short files.- Parameters:
sampleRate- The sample rate of the raw acoustic datadoubleArray- the array of double values to save. Note that this is defined as a 2D array. If a single-channel 1D vector is passed, it doesn't seem to be a problem.numChannels- The number of channels to save- Returns:
- boolean indicating success or failure of the write
-
close
public void close() -
getFileFrames
public long getFileFrames()
-