AutoCloseable
, BitsPerSampleAccessor
, BitsPerSampleAccessor.BitsPerSampleBuilder<WavMonoSampleWriter>
, BitsPerSampleAccessor.BitsPerSampleMutator
, BitsPerSampleAccessor.BitsPerSampleProperty
, MonoSampleWriter<WavMonoSampleWriter>
, SampleWriter<MonoSample,B>
, SamplingRateAccessor
, SamplingRateAccessor.SamplingRateBuilder<WavMonoSampleWriter>
, SamplingRateAccessor.SamplingRateMutator
, SamplingRateAccessor.SamplingRateProperty
, WavSampleWriter<MonoSample,B>
, org.refcodes.io.RowWriter<WavMonoSampleWriter>
public class WavMonoSampleWriter extends AbstractWavSampleWriter<MonoSample,WavMonoSampleWriter> implements MonoSampleWriter<WavMonoSampleWriter>
WavMonoSampleWriter
provides means to write sound samples to a
WAV file. Information on the WAV file format has been taken from the
following article:
"https://web.archive.org/web/20120113025807/http://technology.niagarac.on.ca:80/courses/ctec1631/WavFileFormat.html".BitsPerSampleAccessor.BitsPerSampleBuilder<B extends BitsPerSampleAccessor.BitsPerSampleBuilder<B>>, BitsPerSampleAccessor.BitsPerSampleMutator, BitsPerSampleAccessor.BitsPerSampleProperty
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty
_bitsPerSample, _file, _outputStream, DATA, FORMAT, MAX_16_BIT, MAX_8_BIT, RIFF, WAVE
Constructor | Description |
---|---|
WavMonoSampleWriter(File aFile) |
Constructs the
WavMonoSampleWriter for writing sound samples to a
WAV file or stream. |
WavMonoSampleWriter(OutputStream aOutputStream) |
Constructs the
WavMonoSampleWriter for writing sound samples to a
WAV file or stream. |
Modifier and Type | Method | Description |
---|---|---|
int |
getSamplingRate() |
Retrieves the sampling rate from the sampling rate property.
|
void |
setSamplingRate(int aSamplingRate) |
Sets the sampling rate for the sampling rate property.
|
WavMonoSampleWriter |
withBitsPerSample(BitsPerSample aBitsPerSample) |
Sets the bits/sample per channel for the bits/sample per channel
property.
|
WavMonoSampleWriter |
withSamplingRate(int aSamplingRate) |
Sets the sampling rate for the sampling rate property.
|
void |
writeNext(double aSampleData) |
Writes the next samples, one sample for each channel.
|
void |
writeNext(MonoSample aSample) |
Writes the next samples, one sample for each channel.
|
close, getBitsPerSample, setBitsPerSample, toWavSample, writeHeader
letBitsPerSample
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
letSamplingRate
public WavMonoSampleWriter(File aFile) throws FileNotFoundException
WavMonoSampleWriter
for writing sound samples to a
WAV file or stream.aFile
- The File
where to write the CSV records to.FileNotFoundException
- If the given file object does not denote an
existing, writable regular file and a new regular file of that
name cannot be created, or if some other error occurs while
opening or creating the file.public WavMonoSampleWriter(OutputStream aOutputStream)
WavMonoSampleWriter
for writing sound samples to a
WAV file or stream.aOutputStream
- The OutputStream
where to write the CSV
records to.public WavMonoSampleWriter withBitsPerSample(BitsPerSample aBitsPerSample)
withBitsPerSample
in interface BitsPerSampleAccessor.BitsPerSampleBuilder<WavMonoSampleWriter>
aBitsPerSample
- The bits/sample per channel to be stored by the
sampling rate property.public void writeNext(double aSampleData) throws IOException
writeNext
in interface MonoSampleWriter<WavMonoSampleWriter>
aSampleData
- The samples, one for each channel.IOException
- thrown in case writing the sample caused an I/O
related problem.public void writeNext(MonoSample aSample) throws IOException
writeNext
in interface org.refcodes.io.RowWriter<WavMonoSampleWriter>
writeNext
in interface SampleWriter<MonoSample,B extends MonoSampleWriter<B>>
aSample
- The samples, one for each channel.IOException
- thrown in case writing the sample caused an I/O
related problem.public int getSamplingRate()
getSamplingRate
in interface SamplingRateAccessor
public void setSamplingRate(int aSamplingRate)
setSamplingRate
in interface SamplingRateAccessor.SamplingRateMutator
aSamplingRate
- The sampling rate to be stored by the sampling
rate property.public WavMonoSampleWriter withSamplingRate(int aSamplingRate)
withSamplingRate
in interface SamplingRateAccessor.SamplingRateBuilder<WavMonoSampleWriter>
aSamplingRate
- The sampling rate to be stored by the sampling
rate property.Copyright © 2021. All rights reserved.