Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: OUTLINE - Adding Sound to MP Map
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Thursday, May. 8, 2008 03:29 am
I'm writing this Outline because it seems that there are alot of posts about this topic due to unclear previous Tutorials.

There are a couple different ways you can add sounds to your map, both .wav and .mp3. The following is only one way to do it. I'm going to show you how to add one of each in this tutorial. If any of this tutorial shows to be untrue, please post and correct it.

For reference, there are specifics your sounds should be before even beginning this tutorial. If your using any Default COD sounds, they will work fine, but any sounds outside of the game should be double checked to have the following properties.

-----
Wave Files = 44,100hz, 16 Bit, Mono, Uncompressed
Wave Files = 22,050hz, 16 Bit, Mono, Uncompressed

MP3 Files = VBR, 22,050hz, Stereo, MPEG Layer-3
MP3 Files = VBR, 44,100hz, Stereo, MPEG Layer-3
MP3 Files = 320-192, 44,100hz, Stereo, MPEG Layer-3

Wav files need to be Mono.
MP3 files can be VBR or 320 or anything under 320.

-----
Some things to think about!

- How do I want my sound to play in my map?

- As Ambience?
- As player triggered by using a radius?

Please NOTE that in this Tutorial, the name of the Example map will be called "mp_swamp"

----------
Section 1
----------

Files needed for this tutorial.

- mp_swamp.gsc -----> located in ( raw\maps\mp\mp_swamp.gsc )
- mp_swamp_soundfx.gsc -----> located in ( raw\maps\mp\mp_swamp_soundfx.gsc )
- mp_swamp.csv -----> located in ( raw\soundaliases\mp_swamp.csv )

Two of these files don't exist yet, you will create them later.

Once you have your sound files picked out you need to find a place for them, so your game can call them. If your using sounds not from COD4, then you must pack them in your .FF file. If you are using sounds from the COD4 game then you need to note their path.

I'm going to begin with a .wav file. This first file I'm using as example is a .wav file called crickets.wav This file has the properties of 22,050hz, 16 Bit, Mono, Uncompressed. I'm going to place this file into the following path: raw\sound\my_sounds. All I did was make a folder called my_sounds in the sounds dir. You can make any name you want for this folder.

Now I have a forest in my map, so I want the crickets to only play when a player is in the forest or near it. So the first thing I'm going to do is get some ( x,y,z ) coordinates from Radiant, so my sound has an Origin to emit itself from. Looking at my forest I right click the 2D screen and say script/origin. You will notice an orange colored box appears. This will be our reference of where the sound will play from. I'm going to place this box near the terrain level, and in the middle of the forest. Remember, this script_origin is only used as a reference, it doesn't do anything other than help you remember where your sound is playing. Once you find where you want the sound to play from, press the N key to bring up your Entity Editor. Note those (x,y,z) coordinates. Mine are: 2206.5, 3704.5, 233.

Note those coordinates. Now you want to know how large is your bubble for the player to be able to hear this sound from. A good way to do this is to use a light. Right click your 2D screen and choose: light. Move this light to the exact position of your script_origin you placed earlier. Hit the N key to open your Entity Editor, and scroll down in the window till you see the lights properties of radius. Since my forest is pretty large, I want my sound to start playing a little bit outside the forest, so that the crickets slowly get louder the closer I get to the forest. I'm going to change the default radius value of 200 to 700, so I can see about how bit the radius of the sound would be. You do not need to save your map with the light in it. The light is only used so we can find a good size radius to play our sound from. You can delete it once you find a good radius. You can save your map though if you like with your script_origin in it, it won't hurt.

Note the size of your radius and your x,y,z.
Radius = 700
x,y,z = 2206.5, 3704.5, 233


Now we are done in Radiant.

----------
Section 2
----------

Let's get our files together now. You will need to start with creating a file called: mp_swamp.csv. Name it your map though! Navigate to "raw\soundaliases" and copy the file called multiplayer.csv. Rename this copy to your map name. I will rename mine to mp_swamp.csv. Open file with MS Excel.

Line 38 says # User Interface. highlight this line and everything below this line and delete it so the document is empty besides everything above this line. Once done, you have just created a soundalias file for your map. From here we can use this file to define sounds for our map to play.

Let's begin by adding our first sound. The crickets. Under name I'm going to select the empty line 38 and give my sound an alias or nickname. I can call this sound anything I want, but to make it simple, I'll just call it cricket_chirp.

NOTE: If you notice at the top of this document, each column is defined, what it does, and possible values can be added that the game understands.

So I have my alias defined now, I need to go to the file column now and tell the game where my sound file is. Since I created a folder earlier called my_sounds, I will add the following information into the space: my_sounds/crickets.wav. Continue down the line to add the following values under the specified columns for your sound. Only fill in the headers I have here, leave the rest blank. Just change the NAME and FILE to fit your sound.

name cricket_chirp
file my_sounds/crickets.wav
vol_min 0.99
vol_max 1
vol_mod element
pitch_min 0.95
pitch_max 1.05
dist_min 7
dist_max 700
channel element
loop looping
masterslave 0.5
loadspec all_mp
startdelay 250
lfe percentage 0.2

If you notice under the header "dist_max" I put in the radius I found earlier here of 700. Outside this distance in inches, the sound is not started. If left blank or set to 0, the sound will play from any distance.


Ok, so now we have our alias set up for this sound. If your sound needs to be ambient (meaning everywhere), then change "vol_mod element" to "vol_mod ambience" and then change "channel element" to "channel ambient". If your sound is an MP3, then under the header "type" it needs to say streamed.

Save this document and close. This document should be in "raw\soundaliases".

Now we need to make one more file. The file called: mp_swamp_soundfx.gsc. Create this file in ( raw\maps\mp\mp_swamp_soundfx.gsc ). Make a new .txt file and then change the extension to .gsc. Place the following information into this new file:
Code:

main()
{
	precacheFX();
	ambientFX();

	}

	precacheFX()
	{

}

	ambientFX()
	{

//My Forest Sounds
	maps\mp\_fx::loopSound("cricket_chirp", (2206.5, 3704.5, 233), 1);

		
}


Here in this file I'm defining where my sound is going to play from. Here you will change "cricket_chirp" to your alias. and change the x,y,z coordinates to your own that you found earlier with your script_origin. The "1" at the end is the delay, can be anything greater than or equal to 1 I believe. Once you get one sound working you can copy this line and edit the line to add more sounds to your map that are being used by a player radius. Start with one sound and get one sound working then add more after. Save this file and close

----------
Section 3
----------

Open your file called: mp_swamp.gsc. Your map of course. Located in (raw\maps\mp\mp_swamp.gsc). At the top of this file you need to call the soundfx file you just created. Call it like this, by adding this line.
Code:

	maps\mp\mp_swamp_soundfx::main();


Save and Close.

Now go to your compiler and click Update Zone File and add the following lines to your zone file.
Code:

sound,mp_swamp,,all_mp
rawfile,maps/mp/mp_swamp_soundfx.gsc
rawfile,sound/my_sounds/crickets.wav


SAVE.

If you notice any files added to your map, you need to call in the zone file. Only Mp3's don't need to be added because the aren't going to be packed into our .ff file. I'm also telling the map to play ALL SOUNDS in my soundalias to play in my map with the line: "sound,mp_swamp,,all_mp".

Now run your map, and see if the sound you did worked. Good LUCK!

If you get errors, you'll need to post them.

--------------
MP3 Sounds
--------------

Everything is the same, by following the same idea above, but your .mp3 needs to be placed in your map.iwd, with the same file structure defined in your alias. If the .mp3 was called "crickets.mp3" then in my .iwd I would have to make folders with the path of "sound\my_sounds\crickets.mp3". Mp3's do not get called in the zone file, and only gets placed in your .iwd. The only way to hear your .mp3 is to use your .iwd when running your map, obviously.

I hope I gave a decent outline for getting sounds to work in an MP map. Good luck guys, and I hope this is clear and simple. [thumbs_up]
Share |
zeroy
General Member
Since: Nov 26, 2007
Posts: 1060
Last: Mar 12, 2014
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Thursday, May. 8, 2008 09:53 am
Excellent Tutorial, the best i've seen so far [pimp]

Note that there are many ways to achieve this, especially on the scripting side.

With the soundaliase created i add scrip_origin with a targetname of cricket_chirp where i want the sound to play in the map then here is the code i use:

Code:
main()
{
	maps\mp\_load::main();
	
	ambientPlay("ambient_backlot_ext");
	
	game["allies"] = "usmc";
	game["axis"] = "opfor";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "desert";
	game["axis_soldiertype"] = "desert";
	
	setdvar( "r_specularcolorscale", "1" );
	
	setdvar("r_glowbloomintensity0",".25");
	setdvar("r_glowbloomintensity1",".25");
	setdvar("r_glowskybleedintensity0",".3");
	//setdvar("compassmaxrange","1800");
	
    thread alert_sound1();
}

alert_sound1()
{
    alerts = getentarray ("cricket_chirp", "targetname");
    while (1)
    {
              {
            for (i=1;i<alerts.size;i++)
                alerts[0] playsound("cricket_chirp");

            alerts[0] playsound("cricket_chirp");
            
            wait (15.0); // Time before playing again

     self thread alert_sound1();

     return;
        }
        }

}


Sound will play every 15 seconds in this example.

What i like with this scripting is that you just need to add more script_origin where you need sound and no need to worry about coordiantes.
Share |
{UST}Hogan
General Member
Since: Aug 21, 2005
Posts: 238
Last: May 7, 2010
[view latest posts]
Level 4
Category: CoD4 MP Mapping
Posted: Thursday, May. 8, 2008 10:25 am
I am giving Deek a special thank you for helping the United Snipe Team Mappers out with our sounds. like Grimmy said if there is anything you ever need help with in mapping just ask.
thank you again from all of us.
Share |
QuBeck
General Member
Since: May 25, 2006
Posts: 88
Last: Jun 8, 2008
[view latest posts]
Level 3
Category: CoD4 MP Mapping
Posted: Sunday, May. 25, 2008 08:49 am
It's not working out for me.
Everything i try, it give me error in game:

ERROR: Missing soundallias "radio.mp3"

Somebody to help please?
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 MP Mapping
Posted: Sunday, May. 25, 2008 08:56 am
Post your soundalias .csv file please. And the script you're using to play the sound.
Share |
QuBeck
General Member
Since: May 25, 2006
Posts: 88
Last: Jun 8, 2008
[view latest posts]
Level 3
Category: CoD4 MP Mapping
Posted: Sunday, May. 25, 2008 08:58 am
Sorry, you mean this?

name radio,sequence sound/my_sound/radio.mp3,vol_min 0.3,vol_max 1,vol_mod element,pitch_min 0.95,pitch_max 1.05,dist_min 7,dist_max 700,type streamed,channel element,loop looping,masterslave 0.5,loadspec all_mp,startdelay 250,lfe percentage 0.2
Share |
Mystic
General Member
Since: Apr 10, 2004
Posts: 6147
Last: Apr 15, 2018
[view latest posts]
Level 10
Forum Moderator
Im a fan of MODSonair
Category: CoD4 MP Mapping
Posted: Sunday, May. 25, 2008 09:03 am
You soundalias should look something like

Code:
radio,,my_sound/radio.mp3,0.95,,max,,,,,music,streamed,,,master,MAPNAME,,,,,,music,nowetlevel fulldrylevel,,,
Share |
QuBeck
General Member
Since: May 25, 2006
Posts: 88
Last: Jun 8, 2008
[view latest posts]
Level 3
Category: CoD4 MP Mapping
Posted: Tuesday, May. 27, 2008 11:55 am
I'm to stupid for this......[banghead]
What ever i try...... nothing ... [cry]




edited on May. 27, 2008 08:03 am by QuBeck
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD4 MP Mapping
Posted: Tuesday, May. 27, 2008 05:26 pm
what is the exact error you'e getting? And post the .csv and .gsc files you're using, please.
Share |
QuBeck
General Member
Since: May 25, 2006
Posts: 88
Last: Jun 8, 2008
[view latest posts]
Level 3
Category: CoD4 MP Mapping
Posted: Tuesday, May. 27, 2008 07:42 pm
In my frustration i deleted everything [mad]
I will start over again for the fourth time ....[lol]

My error is in game:
Error: missing soundalias "radio.mp3"

I will come back on this in a couple of days..... [crazy]
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»