Package ipsk.audio.dsp
Class AudioSampleProcessor
- java.lang.Object
-
- ipsk.audio.dsp.AudioSampleProcessor
-
- Direct Known Subclasses:
AudioFrameProcessor,AudioSampleProcessorTest.AudioSampleProcessorImpl
public abstract class AudioSampleProcessor extends java.lang.ObjectCalculates amplitude values for an audio sample.- Author:
- K.Jaensch, klausj@phonetik.uni-muenchen.de
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.sound.sampled.AudioFormat.Encodingaeprotected javax.sound.sampled.AudioFormatafstatic doubleAUDITORY_THRESHOLDprotected booleanbigEndianprotected intchannelsstatic doubleDEFAULT_0DB_SOUND_PRESSUREprotected intframeSizeprotected doublemaxValueprotected doubleminValueprotected doubleppprotected intresolutionBitsprotected intsampleSizeprotected booleansigned
-
Constructor Summary
Constructors Constructor Description AudioSampleProcessor()Creates new audio sample processor.AudioSampleProcessor(javax.sound.sampled.AudioFormat af)Creates new audio sample processor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleamplitudeToSoundPressure(double ampl)voidencodeValue(double f, byte[] buf, int offset)Encodes double values into byte array.intgetChannels()doublegetDoubleValue(byte[] sample, int offset)Returns the double value (amplitude) of the given data.byte[]getEncodedValue(double f)Encodes normalized double values to byte array.floatgetFloatValue(byte[] sample)Returns the normalized float value (amplitude) of the given sample.floatgetFloatValue(byte[] sample, int offset)Returns the normalized float value (amplitude) of the given data.intgetFrameSize()doublegetNormalizedValue(byte[] sample)Returns the normalized double value (amplitude) of the given sample.doublegetNormalizedValue(byte[] sample, int offset)Returns the float value (amplitude) of the given data.intgetSampleSize()voidsetAudioFormat(javax.sound.sampled.AudioFormat af)Sets audio format of the samples to process.
-
-
-
Field Detail
-
AUDITORY_THRESHOLD
public static final double AUDITORY_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_0DB_SOUND_PRESSURE
public static final double DEFAULT_0DB_SOUND_PRESSURE
- See Also:
- Constant Field Values
-
af
protected javax.sound.sampled.AudioFormat af
-
ae
protected javax.sound.sampled.AudioFormat.Encoding ae
-
bigEndian
protected boolean bigEndian
-
signed
protected boolean signed
-
channels
protected int channels
-
frameSize
protected int frameSize
-
sampleSize
protected int sampleSize
-
maxValue
protected double maxValue
-
minValue
protected double minValue
-
resolutionBits
protected int resolutionBits
-
pp
protected double pp
-
-
Constructor Detail
-
AudioSampleProcessor
public AudioSampleProcessor()
Creates new audio sample processor.
-
AudioSampleProcessor
public AudioSampleProcessor(javax.sound.sampled.AudioFormat af) throws AudioFormatNotSupportedExceptionCreates new audio sample processor.- Parameters:
af- audio format of the samples to process- Throws:
AudioFormatNotSupportedException
-
-
Method Detail
-
setAudioFormat
public void setAudioFormat(javax.sound.sampled.AudioFormat af) throws AudioFormatNotSupportedExceptionSets audio format of the samples to process.- Parameters:
af- audio format of the samples- Throws:
AudioFormatNotSupportedException
-
getNormalizedValue
public double getNormalizedValue(byte[] sample)
Returns the normalized double value (amplitude) of the given sample.- Parameters:
sample-- Returns:
- normalized value (-1.0 ... +1.0)
-
getFloatValue
public float getFloatValue(byte[] sample)
Returns the normalized float value (amplitude) of the given sample.- Parameters:
sample- audio sample data buffer- Returns:
- double value (-0.5 ... +0.5)
-
getDoubleValue
public double getDoubleValue(byte[] sample, int offset)Returns the double value (amplitude) of the given data.- Parameters:
sample- audio sample data bufferoffset- offset in the buffer- Returns:
- double value
-
getNormalizedValue
public double getNormalizedValue(byte[] sample, int offset)Returns the float value (amplitude) of the given data.- Parameters:
sample- audio sample data bufferoffset- offset in the buffer- Returns:
- normalized float value (-1.0 ... +1.0)
-
getFloatValue
public float getFloatValue(byte[] sample, int offset)Returns the normalized float value (amplitude) of the given data.- Parameters:
sample- audio sample data bufferoffset- offset in the buffer- Returns:
- normalized float value (-0.5 ... +0.5)
-
encodeValue
public void encodeValue(double f, byte[] buf, int offset)Encodes double values into byte array.- Parameters:
f- normalized amplitude value (-1.0 ... 1.0)buf- target data bufferoffset- offset in the buffer
-
amplitudeToSoundPressure
public double amplitudeToSoundPressure(double ampl)
-
getEncodedValue
public byte[] getEncodedValue(double f)
Encodes normalized double values to byte array.- Parameters:
f- normalized amplitude value (-1.0 ... 1.0)- Returns:
- encoded buffer
-
getChannels
public int getChannels()
-
getFrameSize
public int getFrameSize()
-
getSampleSize
public int getSampleSize()
-
-