Designing Games with GameMaker
Sound effects
This functionality is only available in the Standard Edition of Game Maker.Sound effects can be used to change the way sounds and background music sounds. Realize that sound effects only apply to wave files and midi files, not to mp3 files. This section describes the functions that exist for using and changing sound effects. Realize that to use these functions you need to have a good understanding of how sound and synthesizers work. No explanation of the different parameters is given here. Search the web or books for further informations.
To apply a sound effect to a particular sound you can either indicate this when defining the sound resource or you can use the following function
sound_effect_set(snd,effect) Sets a (combination of) sound effect(s) for the indicated sound. effect can be any of the following values:se_noneYou can set a combination of effects by adding up the values. So e.g. you can use
se_chorus
se_echo
se_flanger
se_gargle
se_reverb
se_compressor
se_equalizer
sound_effect_set(snd,se_echo+se_reverb);to get a combination of echo and reverb effects.
All effects have some default settings. You can change these settings once an effect has been applied to a sound. The order here is crucial. You first apply the effect to the sound and next set the parameters for it. Once you reapply effects to the sound, the settings are gone and you have to set them again. Note that all parameters must lie in a particular range, which is indicated below. The following functions exist for changing effect parameters:
sound_effect_chorus(snd,wetdry,depth,feedback,frequency,wave,delay,phase) Sets the parameters for the chorus effect for the indicated sound. The following parameters can be set:wetdry Ratio of wet (processed) signal to dry (unprocessed) signal. (range: 0 to 100, default 50)sound_effect_echo(snd,wetdry,feedback,leftdelay,rightdelay,pandelay) Sets the parameters for the echo effect for the indicated sound. The following parameters can be set:
depth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. (range: 0 to 100, default 25)
feedback Percentage of output signal to feed back into the effect's input. (range: -99 to 99, default 0)
frequency Frequency of the LFO. (range: 0 to 10, default 0)
wave Waveform of the LFO. (0 = triangle, 1 = wave, default 1)
delay Number of milliseconds the input is delayed before it is played back. (range: 0 to 20, default 0)
phase Phase differential between left and right LFOs. (range: 0 to 4, default 2)
wetdry Ratio of wet (processed) signal to dry (unprocessed) signal. (range: 0 to 100, default 50)sound_effect_flanger(snd,wetdry,depth,feedback,frequency,wave,delay,phase) Sets the parameters for the flanger effect for the indicated sound. The following parameters can be set:
feedback Percentage fed back into input (range: 0 to 100, default 0)
leftdelay Delay for left channel, in milliseconds. (range: 1 to 2000, default 333)
rightdelay Delay for right channel, in milliseconds. (range: 1 to 2000, default 333)
pandelay Whether to swap left and right delays with each successive echo. (0 = don't swap, 1 = swap, default 0)
wetdry Ratio of wet (processed) signal to dry (unprocessed) signal. (range: 0 to 100, default 50)sound_effect_gargle(snd,rate,wave) Sets the parameters for the gargle effect for the indicated sound. The following parameters can be set:
depth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. (range: 0 to 100, default 25)
feedback Percentage of output signal to feed back into the effect's input. (range: -99 to 99, default 0)
frequency Frequency of the LFO. (range: 0 to 10, default 0)
wave Waveform of the LFO. (0 = triangle, 1 = wave, default 1)
delay Number of milliseconds the input is delayed before it is played back. (range: 0 to 20, default 0)
phase Phase differential between left and right LFOs. (range: 0 to 4, default 2)
rate Rate of modulation, in Hertz. (range: 1 to 1000, default 1)sound_effect_reverb(snd,gain,mix,time,ratio) Sets the parameters for the reverb effect for the indicated sound. The following parameters can be set:
wave Shape of the modulation wave. (0 = triangle, 1 = square, default 0)
gain Input gain of signal, in decibels (dB). (range: -96 to 0, default 0)sound_effect_compressor(snd,gain,attack,release,threshold,ratio,delay) Sets the parameters for the compressor effect for the indicated sound. The following parameters can be set:
mix Reverb mix, in dB. (range: -96 to 0, default 0)
time Reverb time, in milliseconds. (range: 0.001 to 3000, default 1000)
ratio Frequency ratio. (range: 0.001 to 0.999, default 0.001)
gain Output gain of signal after compression. (range: -60 to 60, default 0)sound_effect_equalizer(snd,center,bandwidth,gain) Sets the parameters for the equalizer effect for the indicated sound. The following parameters can be set:
attack Time before compression reaches its full value. (range: 0.01 to 500, default 0.01)
release Speed at which compression is stopped after input drops below threshold. (range: 50 to 3000, default 50)
threshold Point at which compression begins, in decibels. (range: -60 to 0, default -10)
ratio Compression ratio. (range: 1 to 100, default 10)
delay Time after threshold is reached before attack phase is started, in milliseconds. (range: 0 to 4, default 0)
center Center frequency, in hertz. (range: 80 to 16000)
bandwidth Bandwidth, in semitones. (range: 1 to 36)
gain Gain. (range: -15 to 15)
Alternative versions
Also available in:
Download helpfile