public final class AudioEffects
- Object
- AudioEffects
Small PCM effects that operate on AudioBuffer data.
The methods in this class are platform-neutral and work on interleaved
normalized float PCM samples in the [-1, 1] range. They return new
AudioBuffer instances and leave the source buffer unchanged.
Methods
Inherited methods
Method details
isSimdOptimizationsEnabled
public static boolean isSimdOptimizationsEnabled()AudioEffects should use SIMD-backed kernels when
the current platform supports them. Scalar fallbacks are always used for
effects whose stateful filters don’t map to the current SIMD API.Returns
setSimdOptimizationsEnabled
public static void setSimdOptimizationsEnabled(boolean enabled)Enables or disables SIMD-backed AudioEffects optimizations.
This only changes internal implementation choices. It doesn’t change output format or API behavior.
Parameters
enabledboolean- true to use SIMD where supported, false to force scalar loops.
resetSimdOptimizationsEnabled
public static void resetSimdOptimizationsEnabled()gain
public static AudioBuffer gain(AudioBuffer source, float gain)Parameters
sourceAudioBuffer- The source buffer.
gainfloat- Gain multiplier.
1.0fpreserves level.
Returns
[-1, 1].normalize
public static AudioBuffer normalize(AudioBuffer source, float targetPeak)targetPeak.Parameters
sourceAudioBuffer- The source buffer.
targetPeakfloat- Desired peak amplitude in the range
[0, 1].
Returns
equalize
public static AudioBuffer equalize(AudioBuffer source, float lowGain, float midGain, float highGain)Applies a simple three-band equalizer using default crossover points.
Low frequencies are shaped below roughly 250 Hz, high frequencies above roughly 4 kHz, and the middle band contains the remaining signal.
Parameters
sourceAudioBuffer- The source buffer.
lowGainfloat- Gain for the low band.
midGainfloat- Gain for the middle band.
highGainfloat- Gain for the high band.
Returns
[-1, 1].equalize
public static AudioBuffer equalize(AudioBuffer source, float lowGain, float midGain, float highGain, float lowCutoffHz, float highCutoffHz)Applies a simple three-band equalizer.
This is intended for lightweight tone shaping and demos, not as a mastering-grade parametric equalizer.
Parameters
sourceAudioBuffer- The source buffer.
lowGainfloat- Gain for samples below
lowCutoffHz. midGainfloat- Gain for samples between the crossover bands.
highGainfloat- Gain for samples above
highCutoffHz. lowCutoffHzfloat- Low/mid crossover frequency.
highCutoffHzfloat- Mid/high crossover frequency.
Returns
[-1, 1].removeCenter
public static AudioBuffer removeCenter(AudioBuffer source)Reduces center-panned content in a stereo buffer.
This is the classic mid/side “vocal remover” technique. It only works when the content to remove is centered and similar in both channels.
Parameters
sourceAudioBuffer- A stereo source buffer.
Returns
isolateCenter
public static AudioBuffer isolateCenter(AudioBuffer source)Isolates center-panned content in a stereo buffer.
This can be useful for centered dialog or vocals, but it isn’t true speech separation. It preserves only content common to the left and right channels, so it requires a stereo source where the target content is actually centered.
Parameters
sourceAudioBuffer- A stereo source buffer.
Returns
midSide
public static AudioBuffer midSide(AudioBuffer source, float midGain, float sideGain)Applies mid/side processing to a stereo buffer.
Use a larger midGain and smaller sideGain for simple voice/dialog
enhancement, or midGain=0 and sideGain=1 for center removal.
Parameters
sourceAudioBuffer- A stereo source buffer.
midGainfloat- Gain for content common to left and right channels.
sideGainfloat- Gain for content that differs between channels.