Class 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
The CsvMonoSampleReader provides means to read sound samples from a CSV file.
  • Constructor Details

    • CsvMonoSampleReader

      public CsvMonoSampleReader(File aFile) throws ZipException, IOException
      Constructs the CsvMonoSampleReader for writing sound samples to a CSV file or stream.
      Parameters:
      aFile - The File 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 the CsvMonoSampleReader for writing sound samples to a CSV file or stream.
      Parameters:
      aInputStream - The InputStream 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 the CsvMonoSampleReader for writing sound samples to a CSV file or stream.
      Parameters:
      aCsvReader - The CsvStringRecordReader with which to write the CSV records with.
  • Method Details

    • nextRow

      public MonoSample nextRow() throws IOException
      Specified by:
      nextRow in interface org.refcodes.io.RowReader<MonoSample>
      Throws:
      IOException
    • nextRaw

      public String nextRaw()
      Specified by:
      nextRaw in interface org.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 interface MonoSampleReader
      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 interface SamplingRateAccessor
      Returns:
      The sampling rate stored by the sampling rate property.
    • getIndex

      public long getIndex()
      Specified by:
      getIndex in interface org.refcodes.mixin.IndexAccessor