Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you get the audio file's length?

Asked by 10 years ago

If at all possible, is there a way to get the total length of an audio file? I have seen some new implementations to the roblox sound system consisting of a TimeLength and TimePosition. I still have no clue if these are working, as the TimeLength doesn't change based on audio id. So to finish, is there anyway besides stating the time in a script, to get the length of the file?

2 answers

Log in to vote
2
Answered by
Muoshuu 580 Moderation Voter
10 years ago

No, it is not possible unless you have the original audio file.

ROBLOX is still working on updates for the sound system.

0
Okay thanks for the answer, I hope they add this soon. It will be very useful for music players and such legobuildermaster 220 — 10y
Ad
Log in to vote
1
Answered by
Wutras 294 Moderation Voter
9 years ago

Use the property .TimeLength of a Sound. It should be used like this:

soundlength = workspace.Sound.TimeLength
soundlengthinminutes = soundlength/60
print("This is the audio file's length in seconds: "soundlength)
print("This is the audio file's length in minutes: "soundlengthinminutes")

.TimeLength is the length of the audio file in seconds, NOT the length of the actual audio.

Answer this question