Package ca.phon.audio

Class AudioFileSampled

java.lang.Object
ca.phon.audio.AbstractSampled
ca.phon.audio.AudioFileSampled
All Implemented Interfaces:
Sampled

public final class AudioFileSampled extends AbstractSampled
  • Constructor Details

    • AudioFileSampled

      public AudioFileSampled(AudioFile audioFile)
  • Method Details

    • getNumberOfChannels

      public int getNumberOfChannels()
      Description copied from interface: Sampled
      Get the number of channels.
      Returns:
      number of channels
    • getNumberOfSamples

      public int getNumberOfSamples()
      Description copied from interface: Sampled
      Return the number of samples
      Returns:
      number of samples
    • getSampleRate

      public float getSampleRate()
      Description copied from interface: Sampled
      Get sample rate.
      Returns:
      sample rate (samples/second)
    • valueForSample

      public double valueForSample(int channel, int sample)
      Description copied from interface: Sampled
      Get value for sample
      Parameters:
      sample - index
    • sampleForTime

      public int sampleForTime(float time)
      Description copied from interface: Sampled
      Convert a time value to a sample index
      Parameters:
      time - (in seconds)
      Returns:
      sample index or -1 if time is outside Sampled data range
    • valueForTime

      public double valueForTime(int channel, float time)
      Description copied from interface: Sampled
      Get value for specified time
      Returns:
      value at specified time
    • getStartTime

      public float getStartTime()
      Description copied from interface: Sampled
      Get start time
      Returns:
      start time in seconds
    • getEndTime

      public float getEndTime()
      Description copied from interface: Sampled
      End time in seconds
      Returns:
      end time in seconds
    • getLength

      public float getLength()
      Description copied from interface: Sampled
      Get length in seconds
      Returns:
      length in seconds
    • close

      public void close() throws IOException
      Description copied from interface: Sampled
      Release resources
      Throws:
      IOException
    • loadSampleData

      public int loadSampleData(double[][] buffer, int offset, int firstSample, int numSamples)