SetSoundEffectParameter: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Remove obsolete Requirements section)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
{{New feature/item|3.0159|1.5.8|20914|This function sets the parameter of a sound effect.}}
{{Added feature/item|1.5.9|1.5.8|20914|This function sets the parameter of a [[sound]] effect.}}
{{Note|Using this function on a player voice sound element is not supported at this time.}}
{{Note|Using this function on a player voice sound element is not supported at this time.}}


Line 8: Line 8:
{{OOP||[[sound]]:setEffectParameter}}
{{OOP||[[sound]]:setEffectParameter}}
===Required Arguments===
===Required Arguments===
*'''sound''': the [[sound]] element.
*'''sound:''' The [[sound]] element.
*'''effectName''': the name of the effect whose parameter you want to change.
*'''effectName:''' The name of the effect whose parameter you want to change:
{{Sound_Effects}}
{{Sound_Effects}}
*'''effectParam''': the parameter [[#Effects Parameters|name]].
*'''effectParam:''' The parameter [[#Effects Parameters|name]].
*'''paramValue''': the parameter [[#Effects Parameters|value]].
*'''paramValue:''' The parameter [[#Effects Parameters|value]].
 
===Returns===
===Returns===
Returns '''true''' if everything went well, error is raised otherwise.
Returns ''true'' if effect have been set successfully, ''false'' otherwise.


===Effects Parameters===
===Effects Parameters===
{{Sound_Effects_Parameters}}
{{Sound_Effects_Parameters}}
==Requirements==
{{Requirements|n/a|1.5.8-9.20914|}}


==Example==  
==Example==  
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local sound = playSound3D("music.mp3", 0, 0, 10)
local sound = playSound3D ("music.mp3", 0, 0, 10)
setSoundEffectEnabled(sound, "echo", true)
 
setSoundEffectParameter(sound, "echo", "wetDryMix", 80)
setSoundEffectEnabled (sound, "echo", true)
setSoundEffectParameter(sound, "echo", "feedback", 30)
setSoundEffectParameter (sound, "echo", "wetDryMix", 80)
setSoundEffectParameter (sound, "echo", "feedback", 30)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client_audio_functions}}
{{Client_audio_functions}}

Latest revision as of 17:27, 7 November 2024

This function sets the parameter of a sound effect.

[[{{{image}}}|link=|]] Note: Using this function on a player voice sound element is not supported at this time.

Syntax

bool setSoundEffectParameter ( element sound, string effectName, string effectParam, var paramValue )

OOP Syntax Help! I don't understand this!

Method: sound:setEffectParameter(...)


Required Arguments

  • sound: The sound element.
  • effectName: The name of the effect whose parameter you want to change:
  • gargle
  • compressor
  • echo
  • i3dl2reverb
  • distortion
  • chorus
  • parameq
  • reverb
  • flanger
  • effectParam: The parameter name.
  • paramValue: The parameter value.

Returns

Returns true if effect have been set successfully, false otherwise.

Effects Parameters

Chorus 
http://www.un4seen.com/doc/#bass/BASS_DX8_CHORUS.html
Parameter Type Default value Valid range Description
wetDryMix float 50 0-100 Ratio of wet (processed) signal to dry (unprocessed) signal.
depth float 10 0-100 Percentage by which the delay time is modulated by the low-frequency oscillator (LFO).
feedback float 25 -99-99 Percentage of output signal to feed back into the effect's input.
frequency float 1.1 0-10 Frequency of the LFO.
waveform int 1 0-1 Waveform of the LFO... 0 = triangle, 1 = sine.
delay float 16 0-20 (ms) Number of milliseconds the input is delayed before it is played back.
phase int 1 0-4 Phase differential between left and right LFOs.
  • 0: -180
  • 1: -90
  • 2: 0
  • 3: 90
  • 4: 180
Compressor 
http://www.un4seen.com/doc/#bass/BASS_DX8_COMPRESSOR.html
Parameter Type Default value Valid range Description
gain float 0 -60-60 (dB) Output gain of signal after compression.
attack float 10 0.01-500 (ms) Time before compression reaches its full value.
release float 200 50-3000 (ms) Speed at which compression is stopped after input drops below threshold.
threshold float -20 -60-0 (dB) Point at which compression begins.
ratio float 3 1-100 Compression ratio.
predelay int 4 (ms) 0-4 Time after threshold is reached before attack phase is started.
Distortion 
http://www.un4seen.com/doc/#bass/BASS_DX8_DISTORTION.html
Parameter Type Default value Valid range Description
gain float -18 -60-0 (dB) Amount of signal change after distortion.
edge float 15 0-100 Percentage of distortion intensity.
postEQCenterFrequency float 2400 100-8000 (Hz) Center frequency of harmonic content addition.
postEQBandwidth float 2400 100-8000 (Hz) Width of frequency band that determines range of harmonic content addition.
preLowpassCutoff float 8000 100-8000 (Hz) Filter cutoff for high-frequency harmonics attenuation.
Echo 
http://www.un4seen.com/doc/#bass/BASS_DX8_ECHO.html
Parameter Type Default value Valid range Description
wetDryMix float 50 0-100 Ratio of wet (processed) signal to dry (unprocessed) signal.
feedback float 50 0-100 Percentage of output fed back into input.
leftDelay float 500 1-2000 (ms) Delay for left channel.
rightDelay float 500 1-2000 (ms) Delay for right channel.
panDelay bool false false, true Value that specifies whether to swap left and right delays with each successive echo.
Flanger  
http://www.un4seen.com/doc/#bass/BASS_DX8_FLANGER.html
Parameter Type Default value Valid range Description
wetDryMix float 50 0-100 Ratio of wet (processed) signal to dry (unprocessed) signal.
depth float 100 0-100 Percentage by which the delay time is modulated by the low-frequency oscillator (LFO).
feedback float -50 -99-99 Percentage of output signal to feed back into the effect's input.
frequency float 0.25 0-10 Frequency of the LFO.
waveform int 1 0-1 Waveform of the LFO... 0 = triangle, 1 = sine.
delay float 2 0-4 (ms) Number of milliseconds the input is delayed before it is played back.
phase int 2 0-4 Phase differential between left and right LFOs.
  • 0: -180
  • 1: -90
  • 2: 0
  • 3: 90
  • 4: 180
Gargle 
http://www.un4seen.com/doc/#bass/BASS_DX8_GARGLE.html
Parameter Type Default value Valid range Description
rateHz int 20 1-1000 (Hz) Rate of modulation.
waveShape int 0 0-1 Shape of the modulation waveform... 0 = triangle, 1 = square.
I3DL2 Reverb 
http://www.un4seen.com/doc/#bass/BASS_DX8_I3DL2REVERB.html
Parameter Type Default value Valid range Description
room int -1000 -10000-0 (mB) Attenuation of the room effect.
roomHF int -100 -10000-0 (mB) Attenuation of the room high-frequency effect.
roomRolloffFactor float 0 0-10 Rolloff factor for the reflected signals.
decayTime float 1.49 0.1-20 (s) Decay time.
decayHFRatio int 0.83 0.1-2 Ratio of the decay time at high frequencies to the decay time at low frequencies.
reflections int -2602 -10000-1000 (mB) Attenuation of early reflections relative to room.
reflectionsDelay float 0.007 0-0.3 (s) Delay time of the first reflection relative to the direct path.
reverb int 200 -10000-2000 (mB) Attenuation of late reverberation relative to room.
reverbDelay float 0.011 0-0.1 (s) Time limit between the early reflections and the late reverberation relative to the time of the first reflection.
diffusion float 100 0-100 Echo density in the late reverberation decay.
density float 100 0-100 Modal density in the late reverberation decay.
HFReference float 5000 20-20000 (Hz) Delay time of the first reflection relative to the direct path.
Parametric Equalizer 
http://www.un4seen.com/doc/#bass/BASS_DX8_PARAMEQ.html
Parameter Type Default value Valid range Description
center float 0 80-16000 (Hz) Center frequency.
bandwidth float 12 1-36 Bandwidth, in semitones.
gain float 0 -15-15 (dB) Output gain of signal.
Reverb 
http://www.un4seen.com/doc/#bass/BASS_DX8_REVERB.html
Parameter Type Default value Valid range Description
inGain float 0 -96-0 (dB) Input gain of signal.
reverbMix float 0 -96-0 (dB) Reverb mix.
reverbTime float 1000 0.001-3000 (ms) Reverb time.
highFreqRTRatio float 0.001 0.001-0.999 (ms) High-frequency reverb time ratio.

Example

local sound = playSound3D ("music.mp3", 0, 0, 10)

setSoundEffectEnabled (sound, "echo", true)
setSoundEffectParameter (sound, "echo", "wetDryMix", 80)
setSoundEffectParameter (sound, "echo", "feedback", 30)

See Also