tech_tip_carUse the Vizard sound mixer library to apply volume, pitch, and filter effects to global (non-spatialized) sounds. The mixer supports playing single and multi channel WAV files.

The following code adds a sound mixer and plays a sound. Run the code and press the spacebar to apply a pitch effect:

import viz
import vizact
viz.go()mixer = viz.addSoundMixer()
mixer.play(‘sounds/beep.wav’, viz.LOOP)
vizact.onkeydown(‘ ‘,mixer.setPitch,0.5)

Multiple mixers can be added, each with its own effect settings. In addition, mixers can have parent/child relationships where the child inherits the settings of the parent. The final effect output from the child mixer is a product of both the child and parent settings. Run the script again after adding the following code. The sub-mixer plays a second sound with a pitch value that’s 0.25 times the original (0.5 x 0.5):

subMixer = viz.addSoundMixer(mixer)
subMixer.setPitch(0.5)
subMixer.play(‘sounds/beep.wav’, viz.LOOP)

Lowpass, highpass, bandpass, and notch filters can be applied to the mixer. Add the following code and press ‘1’ to apply a lowpass filter and ‘2’ to remove it:

#Add audio filter objects 
filterLow = viz.AudioFilter(mode=viz.FILTER_LOWPASS,frequency=300)
filterNone = viz.AudioFilter(mode=viz.FILTER_NONE)
vizact.onkeydown(‘1’,mixer.setFilter,filterLow)
#Disable filtering 
vizact.onkeydown(‘2’,mixer.setFilter,filterNone)

See the sound mixer documentation for a complete description of the commands available.