sampled
Interface AudioSource

All Known Implementing Classes:
AudioCapture, AudioFileListReader, AudioFileReader, ConstantGenerator, SineGenerator, Synthesizer

public interface AudioSource

Any audio source must support the basic operations: read samples, provide the sample rate (samples per seconds) and should be printable for debug purposes. It should also support pre-emphasis.

Author:
sikoried
See Also:
AudioFileReader.preEmphasize

Method Summary
 boolean getPreEmphasis()
          Does the AudioSource perform pre-emphasis?
 int getSampleRate()
          Get the frame rate
 int read(double[] buf)
          Read buf.length samples from the AudioSource.
 void setPreEmphasis(boolean applyPreEmphasis, double a)
          Toggle the pre-emphasis of the audio signal
 void tearDown()
          Tear down the AudioSource (i.e.
 java.lang.String toString()
          Get a string representation of the source
 

Method Detail

getPreEmphasis

boolean getPreEmphasis()
Does the AudioSource perform pre-emphasis?


getSampleRate

int getSampleRate()
Get the frame rate

Returns:
number of samples per second

read

int read(double[] buf)
         throws java.io.IOException
Read buf.length samples from the AudioSource.

Parameters:
buf - Previously allocated buffer to store the read audio samples.
Returns:
Number of actually read audio samples.
Throws:
java.io.IOException

setPreEmphasis

void setPreEmphasis(boolean applyPreEmphasis,
                    double a)
Toggle the pre-emphasis of the audio signal

Parameters:
applyPreEmphasis - apply pre-emphasis?
a - the pre-emphasis factor: x'(n) = x(n) - a*x(n-1)

tearDown

void tearDown()
              throws java.io.IOException
Tear down the AudioSource (i.e. release file handlers, etc)

Throws:
java.io.IOException

toString

java.lang.String toString()
Get a string representation of the source

Overrides:
toString in class java.lang.Object