micromod
Class WaveScaler
java.lang.Object
micromod.WaveScaler
- public class WaveScaler
- extends java.lang.Object
The WaveScaler class reduces the amplitude of audio.
The idea is that this could be extended to provide a dithering
algorithm in the future. This class only does some simple rounding
at the moment.
Method Summary |
void |
scaleWaves(short[] inputBuffer,
int[] outputBuffer,
int length,
int scale)
Scale the amplitude of signed 16 bit audio in buffer. |
void |
scaleWavesAccumulate(short[] inputBuffer,
int[] outputBuffer,
int length,
int scale)
As scaleWaves(), except add the output values to those in outputBuffer, instead
of overwriting them. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WaveScaler
public WaveScaler()
scaleWaves
public void scaleWaves(short[] inputBuffer,
int[] outputBuffer,
int length,
int scale)
- Scale the amplitude of signed 16 bit audio in buffer.
Perform the operation on indexes 0 to length-1.
- Parameters:
inputBuffer
- The audio input buffer.outputBuffer
- The audio output buffer.length
- The number of samples to scale.scale
- The amount to scale the audio by. This is in fixed
point format, with 8192 representing a scale factor of 1.0.
The maximum scale factor is 8.0
scaleWavesAccumulate
public void scaleWavesAccumulate(short[] inputBuffer,
int[] outputBuffer,
int length,
int scale)
- As scaleWaves(), except add the output values to those in outputBuffer, instead
of overwriting them. This method is good for efficiency.