Author Topic: Playsound and adding sound help.  (Read 4663 times)

0 Members and 1 Guest are viewing this topic.

Offline Hot Nachos

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Playsound and adding sound help.
« on: January 22, 2019, 09:04:42 AM »
This sub-forum is only for help or discussion regarding projects created by Team Ulysses. If you are requesting help, please search the forums FIRST to make sure your question has not already been answered. If you still need help, fill in the following information.

There is a video link at the bottom if you want to watch me recreate my problems first.

My ULib/ULX versions (run "ulx version" in console):
ULib v2.63d (05/12/18)
ULX v3.73d (05/20/18)

Game mode(s) I am having this problem on:
GarrysMod TTT

Lua errors shown in console, if any:
Code: [Select]
ulx playsound innobeat1.wav
You played sound innobeat1.wav
[LC ULib ERROR] Received invalid sound

So I'm trying to add end round music to my server. After following mods guide I'm trying to play sound to see if it works. I'll post my command and a snip of what shows in console and what I see in FTP.

Trying to play sound in directory.
Commands used:
ulx playsound sound/endroundmusic/traitor/tttfightback.mp3
ulx playsound /sound/endroundmusic/traitor/tttfightback.mp3
ulx playsound /garrysmod/sound/endroundmusic/traitor/tttfightback.mp3
error given:
That sound doesn't exist on the server!

I'm hosting through NFO and I have made a lua/autorun/resource.lua file with
Code: [Select]
resource.AddFile( "sound/endroundmusic/traitor/tttfightback.mp3" )
resource.AddFile( "sound/endroundmusic/innocent/innobeat1.mp3" )
resource.AddFile( "sound/endroundmusic/timeout/ashes.mp3" )
resource.AddFile( "sound/ashes.mp3" )
resource.AddFile( "sound/innobeat1.mp3" )
resource.AddFile( "sound/tttfightback.mp3" )

I also aded the mp3 directly in the sound folder for playsound testing.

After reading through topics on how to fix this https://forums.ulyssesmod.net/index.php?topic=9548.0 and https://forum.facepunch.com/gmodhelp/goaa/How-to-add-a-sound-to-the-Ulx-Playsound/1/, it still wont fix my problem. Now when trying to use command to play sound directly in sound folder I get the following.

Code: [Select]
ulx playsound tttfightback.mp3
You played sound tttfightback.mp3
[LC ULib ERROR] Received invalid sound
] ulx playsound ashes.mp3
You played sound ashes.mp3
[LC ULib ERROR] Received invalid sound

So the server is trying to play the mp3 in sound/ashes.mp3 but im getting [LC ULib ERROR] Received invalid sound.

Here is a video of my exact problem with pictures attached to post.
https://youtu.be/MneGItaK2y8

Any help would be appreciated.
« Last Edit: January 22, 2019, 09:32:23 AM by Hot Nachos »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Playsound and adding sound help.
« Reply #1 on: January 22, 2019, 07:33:11 PM »
Any help would be appreciated.

All your examples attempt to include the /sound directory.
Virtually (as an addon, /addons/blah/sounds/...anything here.wav), or literally (gmod_root/sounds/...anything here.wav"
Don't do that.
99% of all Gmod sound commands EXPECT to have the file in the /sound directory, so what you're asking scripts to do is look in /sound/sound/...folder.../file...
For your first resource.addfile example, simply try "ulx playsound /endroundmusic/traitor/tttfightback.mp3"

If that doesn't fix,
Make sure the sounds are truly downloading to your local game client. They won't play if they aren't stored locally.
Check your local Gmod folder, On windows, usually
D:\Program Files(x86)\Steam\steamapps\common\GarrysMod\garrysmod\download\sound\... your folders...\files.mp3




"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Hot Nachos

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Playsound and adding sound help.
« Reply #2 on: January 23, 2019, 07:38:40 AM »
Thanks for the reply and help.

Ok I think I got the problem solved. Must have been something with resource.lua not downloading files. Files are downloading fine now.

There is another problem now. I'm using shotcut and Audacity.

I got the server to ulx playsound ashes.wav and fightback.wav but innobeat1.wav I'm getting
Code: [Select]
You played sound innobeat1.wav
*** Invalid sample rate (48000) for sound 'innobeat1.wav'.

Keep In mind that I'm testing the sounds in sound/ folder not sound/endroundmusic/ so they are working but innobeat1 even though I exported the files as sample rate 48000. Then I exported the files as sample rate 44100 and that got ashes.wav and fightback.wav to play but innobeat1 is still giving me
Code: [Select]
*** Invalid sample rate (48000) for sound 'innobeat1.wav'.Even though i exported as 44100.

Now I copied the working sounds Directly FTP to
Code: [Select]
sound/endroundmusic/timeout/ashes.wav and
Code: [Select]
sound/endroundmusic/traitor/fightback.wav and even through the files play in sound folder the same file gives me
Code: [Select]
*** Invalid sample rate (48000) for sound 'endroundmusic\traitor\fightback.wav'.

Any speculation on why the same file works in sound and has a different sample rate in sub directories?

Here is the full console
Code: [Select]
This server is running ULX Admin Mod v3.73d (05/20/18) by Team Ulysses from ulyssesmod.net
] ulx playsound ashes.wav   <------Works (I exported as sample rate 44100)
You played sound ashes.wav
] ulx playsound fightback.wav   <------Works (I exported as sample rate 44100)
You played sound fightback.wav
] ulx playsound innobeat1.wav   <------Doesn't Work (I exported as sample rate 44100)
You played sound innobeat1.wav
*** Invalid sample rate (48000) for sound 'innobeat1.wav'.
] ulx playsound endroundmusic/timeout/ashes.wav                   <------Doesn't Work (I exported as sample rate 44100)
You played sound endroundmusic/timeout/ashes.wav
*** Invalid sample rate (48000) for sound 'endroundmusic\timeout\ashes.wav'.
] ulx playsound endroundmusic/traitor/fightback.wav                                             <------Doesn't Work (I exported as sample rate 44100)
You played sound endroundmusic/traitor/fightback.wav
*** Invalid sample rate (48000) for sound 'endroundmusic\traitor\fightback.wav'.
] ulx playsound endroundmusic/innocent/innobeat1.wav                                             <------Doesn't Work (I exported as sample rate 44100)
You played sound endroundmusic/innocent/innobeat1.wav
*** Invalid sample rate (48000) for sound 'endroundmusic\innocent\innobeat1.wav'.
« Last Edit: January 23, 2019, 07:41:41 AM by Hot Nachos »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Playsound and adding sound help.
« Reply #3 on: January 23, 2019, 02:14:08 PM »
New working files probably aren't being downloaded to client if they already exist as non working format.
Clear client download folder sound files. Make sure server resource files are all correct format.
Reconnect to server.

And to be clear, sound format is a Source game limitation, not ULx.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming