• sound and music help
    8 replies, posted
so basically i have gathered music and shoved it all into a neat file the files are .mp3 I'm unsure if .wav is the only source correct me if it is but anyway i basically wan't to add this to my server so we may use the file directories like so !playsound "name" and upload it to the workshop so people can download to hear the confusing part is i honestly can't find a tutorial or any info that can help me with this any idea? also if you can is there anything i can add to a script inside it that will make it auto download from the workshop.
You can use resource.AddWorkshop to let a person download the sounds from the workshop and surface.PlaySound to play the music when using a chat command. The chat command will need a little lua script, obviously
That is very helpful thank you just the issue im trying to figure out is would it go "Addon name" then inside that file music and just call on it from there?
You mean calling a specific music with a chat command?
Yes so do i have 2 folders one as the addon and one within as music but the scripts in the addonds folder that can call it with (example):"music/example.mp3
About stopping a music not sure. Surface.playsound only starts a music, until it stops because the end. To have like a menu to choose a sound wou will have to make a derma window that opens on the chat command. If you dont know how derma works, this is a great tutorial https://www.youtube.com/watch?v=3bGo95GcywU&t
Okay so now i'm making a derma but i wanna focus on the soundlist first how would i put this in my addons so i can hear it on the server its currently on the server but i cannot hear it since i don't have it installed properly how would the folder directory look in the addons folder to hear it in the server or the code?
To have the music on the server and be able to use resource.AddWorkshop you have to put all music in a addon and have the server subscribed to it. Which you can either just give the client with a collection as well, or you still us resource.AddWorkshop which will do the same thing. Make the client download the music addon. So lets say in your addon you have the folder sound, and inside you make a second named music, the music path will always look like this surface.Playsound("music/music1.mp3") surface.Playsound("music/music2.mp3") you get the idea
The only advantage I know about WAV files is that you can use SoundDuration on them Serverside for some things, but other than that they aren't worth it. By the way, I don't know when this happened, but garrysmod now supports OGG files, which are even more optimized than MP3s in terms of filesize. Might be something to look into if you're sound folder is getting too big.
Sorry, you need to Log In to post a reply to this thread.