#include <cafe.h>
#include <cafe/axfx.h>

typedef struct
    // User params
    f32 drive;          // -30.0  to  30.0 dB  The gain applied to the input signal before the distortion            
    u32 distortion_type;// 0, 1, 2             The type of distorion: 0=soft clip, 1=medium curve, 2=hard clip
    f32 tone;           //  -1.0  to   1.0     Negative values emphasize low frequencies. Positive values emphasize high frequenceis
    f32 out_gain;       // -30.0  to  10.0 dB  Gain applied after the distortion
    f32 dry_gain;       //   0.0  to   2.0     The level of the original dry signal mixed in to the output        

s32  AXFX2OverdriveGetMemSize     (AXFX_OVERDRIVE_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2OverdriveInit           (AXFX2_OVERDRIVE *overdrive, AXFX_OVERDRIVE_MODE mode, AXFX_SAMPLE_RATE sampleRate);
BOOL AXFX2OverdriveSettingsUpdate (AXFX2_OVERDRIVE *overdrive);
void AXFX2OverdriveShutdown       (AXFX2_OVERDRIVE *overdrive);
void AXFX2OverdriveCallback       (AXFX_6CH_BUFFERUPDATE *bufferUpdate, AXFX2_OVERDRIVE *overdrive, AXAUXCBSTRUCT *info);


drive Specify a float value in dB as -30.0 <= value <= 30.0. The drive parameter controls the gain going into the non-linearity. The amount of distortion applied to a sound depends on its level, and this parameter allows you to tune the amount.
distortion_type Specify a value as 0<= value < 2. This parameter allows you to choose one of three types of non-linearity.
  • 0 = the soft-clip distortion
  • 1 = the medium curve distortion
  • 2 = the hard-clip distortion
tone Specify a float value as -1.0 <= value <= 1.0. The tone parameter allows you to adjust the balance of high and low frequencies in the output of the distortion. Negative values boost the low frequencies while cutting the high frequencies, and positive values cut the low frequencies and boost the high. At 0.0 the tone filter has no effect.
out_gain Specify a float value in dB as -30.0 <= value <= 10.0. Out_gain allows you to adjust the level of the sound after being passed through the distortion and tone filter.
dry_gain Specify a value as 0.0 <= value <= 2.0. The input to the overdrive effect can be mixed with the output of the distorted and tone-adjusted sound. The dry_level parameter adjusts the level of the original input signal.


There are three overdrive effects that operate on 2, 4, and 6 channels. Appropriate values must be assigned to the parameters of the AXFX2_OVERDRIVE structure function before the call to AXFX2OverdriveInit.

For the two and four-channel overdrive, each channel of the gain of the input signal is adjusted by the drive parameter. The signal is then passed through the distortion, followed by the tone filter. The output of the tone filter is adjusted by the outgain, and then mixed with the original input signal, whose level is adjusted by the dry level.

The distortion is a memoryless non-linear function which returns an output value for each input value. Output values can be calculated directly from the input values, or input values can be used to lookup the appropriate entry in a stored table of output values.

The soft-clip uses a cubic non-linearity which fades smoothly into clipping at a threshold of 2/3. The medium curve uses an arctangent non-linearity. And the hard-clipping is linear until a sharp clip at the threshold. Since the non-linearities are all symmetric about zero only the positive values need to be stored in the table. In the current implementation the table output is linearly interpolated between the two nearest entries for a given input.


Library Version Availability
Sound 2.0 Yes
Sound 1.0 No


The following table lists the CPU utilization given the specified mode and channel settings. The Sound 2 Library Interactive Effects demo displays real time CPU usage metrics from which this data is derived.

mode 32k 48k
distortion_type 0 1 2 0 1 2
2ch 0.79% 0.96% 0.63% 1.17% 1.42% 0.93%
4ch 1.53% 1.87% 1.20% 2.28% 2.80% 1.79%
6ch 2.06% 2.48% 1.64% 3.07% 3.71% 2.44%

When the audio is silent, the CPU usage is as follows.

mode 32k 48k
distortion_type 0 1 2 0 1 2
2ch 0.63% 0.72% 0.62% 0.94% 1.07% 0.91%
4ch 1.21% 1.40% 1.18% 1.80% 2.08% 1.75%
6ch 1.65% 1.89% 1.61% 3.07% 3.71% 2.44%

See Also

AXFX2 Overdrive Overview
alleffects demo

Revision History

2014/03/11 CPU metrics
2013/08/26 Initial version.