- All Implemented Interfaces:
AutoCloseable,SampleReader<SoundSample>,SamplingRateAccessor,SoundSampleReader,org.refcodes.io.RowReader<SoundSample>,org.refcodes.mixin.IndexAccessor
public class CsvSoundSampleReader
extends AbstractCsvSampleReader<SoundSample>
implements SoundSampleReader
The
CsvSoundSampleReader 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.IndexPropertyNested 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
ConstructorsModifierConstructorDescriptionCsvSoundSampleReader(File aFile) Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream.CsvSoundSampleReader(InputStream aInputStream) Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream.protectedCsvSoundSampleReader(org.refcodes.tabular.CsvStringRecordReader aCsvReader) Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream. -
Method Summary
Methods inherited from class org.refcodes.audio.AbstractCsvSampleReader
close, doProbeHeader, hasNextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.refcodes.io.RowReader
hasNextMethods inherited from interface org.refcodes.audio.SampleReader
nextSample
-
Constructor Details
-
CsvSoundSampleReader
Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream.- Parameters:
aFile- TheFilewhere 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.
-
CsvSoundSampleReader
Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream.- Parameters:
aInputStream- TheInputStreamwhere to write the CSV records to.- Throws:
IOException- thrown in case there was an I/O related problem.
-
CsvSoundSampleReader
protected CsvSoundSampleReader(org.refcodes.tabular.CsvStringRecordReader aCsvReader) Constructs theCsvSoundSampleReaderfor writing sound samples to a CSV file or stream.- Parameters:
aCsvReader- TheCsvStringRecordReaderwith which to write the CSV records with.
-
-
Method Details
-
nextRow
- Specified by:
nextRowin interfaceorg.refcodes.io.RowReader<SoundSample>- Throws:
IOException
-
nextRaw
- Specified by:
nextRawin interfaceorg.refcodes.io.RowReader<SoundSample>
-
nextSampleData
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:
nextSampleDatain interfaceSoundSampleReader- 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:
getSamplingRatein interfaceSamplingRateAccessor- Returns:
- The sampling rate stored by the sampling rate property.
-
getIndex
public long getIndex()- Specified by:
getIndexin interfaceorg.refcodes.mixin.IndexAccessor
-