SoundDuration for .mp3 files

Hello i am trying to get a code to play a sound then explode when its done, but the server has only .mp3 sounds and SoundDuration doesnt accurately guess how long the sound is!

upon comparing sound duration estimates between .mp3 and .wav heres what i got:

print(SoundDuration(“lolz/duke_nukem_intro.mp3”)) print(SoundDuration(“lolz/duke_nukem_intro.wav”))…
1.0306802721088
4.462947845805

> print(SoundDuration(“lolz/dew.mp3”)) print(SoundDuration(“lolz/dew.wav”))…
4.7007709750567
6.3897052154195

> print(SoundDuration(“lolz/lazer.mp3”)) print(SoundDuration(“lolz/lazer.wav”))…
1.2320408163265
3.3066666666667

I plotted them on a graph, no apparent pattern. it just spits out a random number when estimating .mp3 lengths!

any ideas?

This can be done with javascript, altho, why don’t you just open the sound in MP3 Player, write down the lenght and put it into some sort of a table?

how can i use javascript in gmod lua code?

and because i never thought of that.

Well, I asked about sound duration not so long ago (about a year) and someone gave me a javascript enclosed in HTML panel.