surface.PlaySound Problem

Okay, I am really confused about this. For some reason I cannot get the the sound to play. The functions goes through everything since I used a print, I know, just it wont play the sound. No errors are given either.

[lua]
surface.PlaySound(“boom/boomsound.mp3”)
[/lua]

Again no errors, it gets to that ( I used a print to find out ). I just dont know what is going on :stuck_out_tongue:

Thanks in advance.

Does the file “boom/boomsound.mp3” exist?

Yup. In this exact dir: “garrysmod/sound/boom/boomsound.mp3”

Nobody knows whats causing this not to work?

.mp3 files usually don’t play well with gmod… have you tried converting the file to a .wav?

Yea I tried that, didn’t work. I’ll try and do it again, but I’m sure it still wont work.

Anything in console at all?

You need to put it like this:



surface.PlaySound("sound/boom/boomsound.mp3")


I’m 75% sure it will look in “garrysmod/sound/sound/boom/boomsound.mp3” if I did it like that. Though I could be wrong.

[editline]21st June 2016[/editline]

Nothing that points to this not working. Just the usual stuff.

will you send me the file?

I don’t see the actual solution in that? No disrespect though. Is there anything you plan on doing with it? Since if there is anything I can do to check it or what ever, I can most likely do it myself. Do you suspect a corrupt file?

I works I assure you. I placed the .mp3 in FL Studio and exported to .wav also trying .ogg as well.

no i suspect the wrong audio rate, it should be 44100Hz

Yea it is, I rendered it in FL Studio at 44100Hz at a 512 Point Sinc (for the .wav).

Okay then why not just do this:



surface.PlaySound(Sound("boom/boomsound.mp3"))


Precaching wouldn’t really do anything but cause less lag (like loading a 1 sec clip is hard on the client).

Dude I am just giving random ideas, because for me it works, idk what’s wrong with yours. Especially because you made it print something in the console and it did, but the sound didn’t play is kind of weird.

What’s the Bit Depth of the sound file? It should be 16-Bit integer if it’s not.

I know this is years and years late, but I only found out the problem today:

You don’t need the filepath.

So, instead of this:



surface.PlaySound("boom/boomsound.mp3")


You just need this:



surface.PlaySound("boomsound.mp3")


You sure? Because it still doesn’t work for me.

Try using

resource.AddFile as well. It seems to work for me.