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
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundFFTData
- getSoundEffects
- getSoundLength
- getSoundMaxDistance
- getSoundLevelData
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundSpeed
- getSoundWaveData
- getSoundVolume
- isSoundPaused
- isSoundPanningEnabled
- playSFX
- isSoundLooped
- getSoundProperties
- playSound
- playSFX3D
- setRadioChannel
- playSound3D
- setSoundEffectParameter
- setSoundEffectEnabled
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPaused
- setSoundPanningEnabled
- setSoundSpeed
- setSoundPosition
- setSoundProperties
- setSoundVolume
- stopSound