- java.lang.Object
-
- org.refcodes.audio.AbstractCsvSampleReader<MonoSample>
-
- org.refcodes.audio.CsvMonoSampleReader
-
- All Implemented Interfaces:
AutoCloseable
,MonoSampleReader
,SampleReader<MonoSample>
,SamplingRateAccessor
,org.refcodes.io.RowReader<MonoSample>
,org.refcodes.mixin.IndexAccessor
public class CsvMonoSampleReader extends AbstractCsvSampleReader<MonoSample> implements MonoSampleReader
TheCsvMonoSampleReader
provides means to read sound samples from a CSV file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.IndexAccessor
org.refcodes.mixin.IndexAccessor.IndexBuilder<B extends org.refcodes.mixin.IndexAccessor.IndexBuilder<B>>, org.refcodes.mixin.IndexAccessor.IndexMutator, org.refcodes.mixin.IndexAccessor.IndexProperty
-
Nested classes/interfaces inherited from interface org.refcodes.audio.SamplingRateAccessor
SamplingRateAccessor.SamplingRateBuilder<B extends SamplingRateAccessor.SamplingRateBuilder<B>>, SamplingRateAccessor.SamplingRateMutator, SamplingRateAccessor.SamplingRateProperty
-
-
Field Summary
-
Fields inherited from class org.refcodes.audio.AbstractCsvSampleReader
_csvReader
-
-
Constructor Summary
Constructors Modifier Constructor Description CsvMonoSampleReader(File aFile)
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.CsvMonoSampleReader(InputStream aInputStream)
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.protected
CsvMonoSampleReader(org.refcodes.tabular.CsvStringRecordReader aCsvReader)
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getIndex()
int
getSamplingRate()
Retrieves the sampling rate from the sampling rate property.double
nextMonoData()
Reads the next samples, one sample for each channel.String
nextRaw()
MonoSample
nextRow()
-
Methods inherited from class org.refcodes.audio.AbstractCsvSampleReader
close, doProbeHeader, hasNext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.AutoCloseable
close
-
Methods inherited from interface org.refcodes.audio.SampleReader
nextSample
-
-
-
-
Constructor Detail
-
CsvMonoSampleReader
public CsvMonoSampleReader(File aFile) throws ZipException, IOException
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.- Parameters:
aFile
- TheFile
where to write the CSV records to.- Throws:
IOException
- thrown in case there was an I/O related problem.ZipException
- Signals that a Zip exception of some sort has occurred.
-
CsvMonoSampleReader
public CsvMonoSampleReader(InputStream aInputStream) throws IOException
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.- Parameters:
aInputStream
- TheInputStream
where to write the CSV records to.- Throws:
IOException
- thrown in case there was an I/O related problem.
-
CsvMonoSampleReader
protected CsvMonoSampleReader(org.refcodes.tabular.CsvStringRecordReader aCsvReader)
Constructs theCsvMonoSampleReader
for writing sound samples to a CSV file or stream.- Parameters:
aCsvReader
- TheCsvStringRecordReader
with which to write the CSV records with.
-
-
Method Detail
-
nextRow
public MonoSample nextRow() throws IOException
- Specified by:
nextRow
in interfaceorg.refcodes.io.RowReader<MonoSample>
- Throws:
IOException
-
nextRaw
public String nextRaw()
- Specified by:
nextRaw
in interfaceorg.refcodes.io.RowReader<MonoSample>
-
nextMonoData
public double nextMonoData() throws IOException
Reads the next samples, one sample for each channel. Provide one sample for mono audio, two samples for stereo audio and so on. In case you provide more or less samples than channels being supported by the writer, then it is up to the writer whether to duplicate the samples or calculate an average or the like.- Specified by:
nextMonoData
in interfaceMonoSampleReader
- Returns:
- The samples, one for each channel.
- Throws:
IOException
- thrown in case there was an I/O related problem.
-
getSamplingRate
public int getSamplingRate()
Retrieves the sampling rate from the sampling rate property.- Specified by:
getSamplingRate
in interfaceSamplingRateAccessor
- Returns:
- The sampling rate stored by the sampling rate property.
-
getIndex
public long getIndex()
- Specified by:
getIndex
in interfaceorg.refcodes.mixin.IndexAccessor
-
-