Author Topic: How to: Looped Music In A Map  (Read 1774 times)

ViciouZ

  • Map Committee
  • Autococker
  • Posts: 2227
How to: Looped Music In A Map
« on: February 17, 2008, 10:49:59 AM »
For those who have tried, you will know it is very hard to have looping sounds/music throughout your entire map.

First of all, you need your music. This can be of whatever length you like. Next we need to convert it into a format the game can understand: wave/pcm. I used dbPoweramp converter which can be found here. The game is a bit picky about what type of wave files it likes: I recommend using the 'Radio Quality' setting, or 22050Hz, 8 bit, mono. Your converted file should be 2 to 8MB in size. Previously such sizes would have not been feasible but with fast UDP downloads that problem is solved. Place this file in pball/sound/<yourname>/. Give it a good short name like 4winds.wav or ultradancebeetz.wav.

Next we need to get it in the map. Open up your map and make a target_speaker. Put it anywhere you want, within the bounds of your map. Enter the following keys and values, replacing yourname and soundname with the directory and file you created earlier:
'noise' '<yourname>/<soundname>.wav'
'attenuation' '-1'
'targetname' 'music'

Now we must start and loop the sound. We will use a func_timer to do this. Create a func_timer and give it the following keys, where length is the length of your music in seconds (3:30 would be 210):
'target' 'music'
'wait' '<length>'
'targetname' 'musictimer'

Finally, we need to set off the timer. It only needs to be set off once, so we will use a trigger_once. Create a brush and place it at a spawn point in your map, or the way out of a base. Somewhere that is often travelled. Select it. Select trigger_once from the entities box and click make entity. Now give it the following key:
'target' 'musictimer'

You should be all set. Export your map and test it. Finally, don't forget to include the sound file when you release your map!

-ViciouZ
Tutorial is GPL

Zorchenhimer

  • Autococker
  • Posts: 2614
Re: How to: Looped Music In A Map
« Reply #1 on: February 17, 2008, 06:50:17 PM »
Tutorial is GPL

Hahahahahaha.

On a more on-topic-ish note:  Awesome!

Deranged

  • 68 Carbine
  • Posts: 409
Re: How to: Looped Music In A Map
« Reply #2 on: February 18, 2008, 01:51:19 PM »
Great tutorial vic, only problem is wav files can still be annoyingly huge, just being uncompressed sound afterall... Sure hope we get ogg vorbis support soon :)

EDIT: Just tested it, works flawlessly though finding a place for the trigger is a little annoying..

ViciouZ

  • Map Committee
  • Autococker
  • Posts: 2227
Re: How to: Looped Music In A Map
« Reply #3 on: February 18, 2008, 01:55:13 PM »
Lol, my 3 min song at good-ish quality is 4mb. Like I said in the tutorial, that used to be unfeasible but is now fine.
« Last Edit: May 04, 2009, 01:12:10 PM by ViciouZ »

Leg1t

  • PGP
  • Posts: 13
Re: How to: Looped Music In A Map
« Reply #4 on: September 18, 2011, 01:33:28 PM »
V, can uadd the music to my map cus i cant seem do do it ill email u the sound to if ull do it its supossed to be a rave map wit deadmua5 as the dj