Tutorial: Making Music Play in Maps Last edited 4 years ago2020-04-22 15:45:01 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

INTRODUCTION

So, let's say you're midway through making your map and you want your own epic soundtrack to play, or you want music from the original Half-Life. This tutorial will show you how to make music play during your map.

PREPARING THE MUSIC FOR PLAYBACK

You can skip this step if you're not using your own music.
First, you need to prepare the music. There's nothing much you have to do like adding cue points, etc. because music playback uses the Miles Sound System and not GoldSource's one. You need to have an MP3 with a sample rate of 44100Hz. Next, you need to set its file name. GoldSource only supports certain filenames for your MP3 files. If you set the filename to gamestartup.mp3, the track will play in a loop on the main menu when the game starts. You need to use one of these 28 filenames: You can apply any metadata, including album artwork and composer info to your MP3s. It won't effect in-game playback.
Once you have prepared your music for playback, we will now make it play in-game.

MAKING THE MUSIC PLAY

In your map, there are two ways to make music play. You can use the brush entity trigger_cdaudio to make the music play when the player walks through it, or you can use the target_cdaudio point entity to make the music play when it is triggered. Both entities have the exact same properties. If you're using target_cdaudio, you will need to add something in the targetname/Name key. In the Track to play key, there are tracks 1-30, though you can only really use tracks 2-28.
ValueMp3 file to play
1None
2Half-Life01.mp3
3Prospero01.mp3
4Half-Life12.mp3
5Half-Life07.mp3
6Half-Life10.mp3
7Suspense01.mp3
8Suspense03.mp3
9Half-Life09.mp3
10Half-Life02.mp3
11Half-Life13.mp3
12Half-Life04.mp3
13Half-Life15.mp3
14Half-Life14.mp3
15Half-Life16.mp3
16Suspense02.mp3
17Half-Life03.mp3
18Half-Life08.mp3
19Prospero02.mp3
20Half-Life05.mp3
21Prospero04.mp3
22Half-Life11.mp3
23Half-Life06.mp3
24Prospero03.mp3
25Half-Life17.mp3
26Prospero05.mp3
27Suspense05.mp3
28Suspense07.mp3
Once you've set up the entity correctly corresponding to your MP3, you can compile your map. If the MP3 files aren't in your mod folder, the game will play the files from the valve folder.

Comments

You must log in to post a comment. You can login or register a new account.