Blitz3D+ Command Reference

AudioGroupEQ ( group,band,frequency#,gainDb#[,bandwidth#] )

Parameters

group - mixing group:
0: SFX (default for LoadSound/Load3DSound)
1: Music (default for non-MIDI PlayMusic)
2: UI
3: Ambience

band - EQ band index, 0 to 3
frequency# - band frequency from 20 to 20000 Hz
gainDb# - band gain from -18 to 18 dB

bandwidth# (optional) - native XAPOFX bandwidth setting from 0.1 to 2, not Hz or Q; 1 (default)

Description

Configures one band of a mixing group's four-band EQ.

Groups are 0=SFX, 1=Music, 2=UI and 3=Ambience. LoadSound/Load3DSound default to SFX; non-MIDI PlayMusic defaults to Music. Group processing includes dry sound and shared wet returns.

Configures one of four bands (0..3) and enables group EQ. Other bands are preserved and initially flat. EQ processes the combined dry/wet group mix. Boosts can produce levels above 1.

Call InitAudioEffects before the first WAV/Ogg playback. Configuration commands return 1 on success or 0 on failure; use AudioLastError for the reason. Finite numeric values and valid handles are required in Debug and Release. Queries preserve errors unless the query itself fails.

Audio effects process decoded WAV and mono/stereo Ogg at an internal 48 kHz. MIDI uses a separate backend. Sound defaults are copied to independent playing channels. Runtime pause freezes sources, tails and transition time; pausing one channel leaves shared tails running. Event waits service transitions and release completed source resources without ChannelPlaying polling. Lightweight completed handles are retained until program shutdown.

The interactive Audio Playground sample demonstrates the whole effects family together.

Requires Extended mode.

See also: AudioGroupEQEnabled, AudioGroupFilter, AudioGroupClearEffects.

Example

; AudioGroupEQ example. Compile in Extended mode; media ships with Audio Playground.
AppTitle "AudioGroupEQ"
If Not InitAudioEffects() Then RuntimeError AudioLastError$()
Graphics 680,240,0,2
SetBuffer BackBuffer()
sound = LoadSound("../../../samples/audio/media/machine.wav")
If sound = 0 Then RuntimeError "The installed audio sample media is missing."
LoopSound sound
SoundVolume sound,0.25
RequireAudio AudioMasterMeter(True)
RequireAudio AudioGroupMeter(0,True)
message$ = "AudioGroupEQ"
RequireAudio AudioGroupEQ(0,2,1760,-12,1)
channel = PlaySound(sound)
If channel = 0 Then RuntimeError "Unable to play the example sound."

started = MilliSecs()
While KeyDown(1) = False And MilliSecs()-started < 5000

    Cls
    Text 20,20,message
    Text 20,50,"Group 0 peak: " + AudioGroupPeak(0) + "   RMS: " + AudioGroupRMS(0)
    Text 20,80,"Master peak: " + AudioMasterPeak() + "   RMS: " + AudioMasterRMS()
    Text 20,120,"Listen for five seconds, or press Escape to finish."
    Flip
Wend
StopChannel channel
For group = 0 To 3
    RequireAudio AudioGroupClearEffects(group)
Next
Delay 60
FreeSound sound
EndGraphics
End

Function RequireAudio(success)
    If Not success Then RuntimeError AudioLastError$()
End Function

Index