GetSoundProperties: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 17: | Line 17: | ||
==Example== | ==Example== | ||
'''Example 1:''' This example would return three float values representing the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not, every 5 seconds. | '''Example 1:''' This example would return three float values representing the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not, every 5 seconds. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
Line 35: | Line 34: | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client_audio_functions}} | {{Client_audio_functions}} | ||
[[AR:getSoundProperties]] | [[AR:getSoundProperties]] |
Revision as of 10:36, 18 January 2014
This function gets the properties of a specific sound.
Syntax
float, float, float, bool getSoundProperties( element sound )
Required Arguments
- sound: A sound element that is created using playSound or playSound3D
Returns
This function returns 3 floats and a boolean value:
The first float is the sound's sample rate, the second one the sound's tempo, and the third one the pitch of the sound. The boolean representing whether the sound is reversed or not.
Example
Example 1: This example would return three float values representing the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not, every 5 seconds.
local sound local timer addCommandHandler("playsound", function () sound = playSound("wasted.mp3") timer = setTimer(function() soundProperties(sound) end, 5000, 0) end ) function soundProperties(sound) local sampleRate, tempo, pitch, isReversed = getSoundProperties(sound) --gets the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not. outputChatBox(sampleRate.." "..tempo.." "..pitch.." "..tostring(isReversed)) end
See Also
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX3D
- playSFX
- playSound3D
- playSound
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound
- Shared
- playSoundFrontEnd