getSoundLength
Client-side
Server-side
Shared
This function is used to return the playback length of the specified sound element. If the element is a player, this function will use the players voice.
OOP Syntax Help! I don't understand this!
- Method: sound:getLength(...)
- Variable: .length
Syntax
float|false getSoundLength ( sound/player theSound )
Required Arguments
- theSound: The sound element which length you want to return.
Returns
- float|false: length
Returns an float value indicating the playback length of the sound element in seconds.
Code Examples
client
Plays a sound then outputs the sound length.
local sound = playSound("money.mp3", false) -- Play a soundlocal soundLength = getSoundLength(sound) -- Get the length of the soundoutputChatBox("This sound is " .. soundLength .. " seconds long.")
Changelog
See Also
Audio Functions
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBufferLength
- getSoundBPM
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundLevelData
- getSoundPan
- getSoundPosition
- getSoundVolume
- getSoundProperties
- isSoundLooped
- getSoundWaveData
- isSoundPanningEnabled
- isSoundPaused
- getSoundSpeed
- playSFX3D
- playSFX
- playSound
- playSound3D
- setRadioChannel
- setSoundEffectEnabled
- setSoundLooped
- setSoundMaxDistance
- setSoundEffectParameter
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- stopSound
- setSoundVolume