How to add music?

Avatar
yohoat9
274 Posts
Posted Feb 21, 2011
Okay, this has probably been asked before, but how do I add music to my map? I've tried everything, but can't find a single tutorial anywhere. I can't even figure out how to play existing tracks, can somebody try to answer as soon as possible?
Advertisement
Registered users don’t see ads! Register now!
Avatar
Mevious
205 Posts
Posted Feb 21, 2011
Replied 45 minutes later
Use an ambient_generic and mark the "play everywhere" flag. For music you'll want to reference the name in "level_sounds_music_portal.txt" (i.e., use "Portal.song1" rather than "music/portal_subject_name_here.mp3"). This way the game will recognize the sound as music, and the music volume knob will work correctly.
Avatar
Whysopro?
154 Posts
Posted Feb 21, 2011
Replied 20 minutes later
EDIT: Exactly what Mevious said...
Avatar
HMW
806 Posts
Posted Feb 21, 2011
Replied 1 hour later

Mevious wrote:
[...]and the music volume knob will work correctly.

Hey, I never thought about that. Better check if mine are set up correctly! Thanks for the tip.

Avatar
yohoat9
274 Posts
Posted Feb 21, 2011
Replied 20 minutes later
I'm sorry, some of that is kinda vague. I set it up like you said but it still doesn't play, you have to explain better I think.
Avatar
Whysopro?
154 Posts
Posted Feb 21, 2011
Replied 2 minutes later
Oh it's actually sound...not sounds.

My mistake, see if it works now.

Avatar
yohoat9
274 Posts
Posted Feb 21, 2011
Replied 1 hour later
No, I understand that, but somethings being left out, if I could have a step by step walkthrough of it that would be great.

WOOHOO!!! 100th POST!!!

Advertisement
Registered users don’t see ads! Register now!
Avatar
Mevious
205 Posts
Posted Feb 21, 2011
Replied 5 hours later
I find that ambient_generics have a lot of unexpected behaviors and bugs. For example, sometimes I have trouble with "Start Silent" unselected. Go here and you'll see loads of documented bugs http://developer.valvesoftware.com/wiki/Ambient_generic. Other possible problems are that it can't find your sound file or your sound is the wrong bitrate. You'll need to debug it yourself. Take a look at your console for errors after the sound is triggered. Set ent_messages_show 1 to see entity IO in the map and make sure the ambient_generic is triggered in the first place. You can also use VMEX to decompile an official map and copy exactly what they do.