Music - Fade between versions of music between rooms, for multiplayer

I’m having a gameplay problem with a multiplayer map. I want to have different versions of songs, play in different parts of my map.

For reference, this effect from Banjo Kazooie shows exactly what I’d like to have happen.

Is there any way, using source tools, I can do this without the song resetting between rooms?

My best guess would be have all versions playing at once, but only have the “Active” version unmuted.
To switch between versions, have the active version fade to mute, and the target version fade to full volume.

That would be great for singleplayer, but the problem there is multiplayer, which means that everyone would get affected, and the effect is destroyed.

Unless there’s a way to make sounds work to the client, rather than to the server? is that possible?

I honestly have no idea as I’ve only messed with music on one map for gmod. I also have no idea if what I suggested will work.

Is this for Garry’s mod?

custom soundscapes. If you need help I’ll work with you, I actually used some of Rare’s N64 music on my maps, so heres a custom soundscape example from my map.

the following is the script file which would be named “soundscapes_ctf_map_name_example” < exact name of the map, and would be located in tf/scripts
I’m sure your familiar with custom ambient_generic entities so you should know where the sounds go

In this case, this soundscape plays the DK64 island theme and some nice ocean sounds at the same time, 1.0 is the max volume

This gets the fading job done, but it still resets the other sounds once it’s fully faded out, which is what he wants to prevent.

What you could try is having 2 soundscapes with both loops playing in each, but have one be at max volume, and the other at a non-audible volume. Same would be done to the second soundscape, but vice versa.
No idea if it would actually work, but it might.

Like this:

This actually works, but I need the other ones completely silent. Can that be done? whenever I swap them toany number between 0.0 to 0.09, they just seem to reset when moving to other soundscapes!

Edit: here’s a video. unfortunately, you can hear the other 5 tracks in the background, as their volumes are 0.1. If I put them any lower, it resets when you walk into them!

Do you use any sound characters in your wave section?
Because the lowest volume setting I can achive is

which makes them inaudible for the human ear, but they won’t get unloaded, so your setup would still work.
However, if I use the # sound character, it makes the mentioned volume setting obsolete.

I’m not entirely sure?

These are the kind of soundscape entries I have:


"Test.Main"
{
	"dsp"	"1"

	"playlooping"
	{
		"volume"	"0.5"
		"wave"		"kizzycocoa/test/ambiencechangetest/MainTheme.mp3"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/GobiValley.mp3"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/FurnaceFun.mp3"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/Freezeezy.mp3"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/Clanker.mp3"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/TreasureTrove.mp3"
		"pitch"		"100"
	}
}

No, you don’t have any sound characters.

But I notice, you are using mp3’s. Try using wav’s and see, if you are able to lower the volume. Maybe your issue lies there.

I’ve just tried, and it seems that it is lagging the hell out of my game, with no sound whatsoever, even though the soundscripts are there. I have no idea why :S

I’ve added cues, just in case. but, no difference. No sound is being played (footsteps and menu sound included) and it’s lagging to hell when I run it.

I’ve run the soundscape debug, and everything is there and in place. it just isn’t working now x_x

Edit: if even one of them is wav, and the rest are mp3, it will just stop playing all sound.

What sample rate are you exporting your WAVs at?
Try either 11025, 22050, or 41000 Hz. (The lower the Hz, the smaller the filesize)

It also helps to compress your WAVs to Microsoft ADPCM to save space, it doesn’t affect the quality much at all.

I’m exporting at 41000Hz.

I’ve just tried an experement. if there are two looping wav sounds at the same time, it bugs out. hard.
if there is one looping, it’s fine.

I have an experement in which I have one area that works, within an area that doesn’t. you jump on the square, it plays the soundscape with 1 looping wav, everything is fine.

you jump out of the square, where there are 2 looping wavs, and it mutes all sound. all of them. even menus.

This is the most bizarre thing I’ve ever seen. anyone got any ideas here?

edit: my script:


"Maintest_1"
{
	"dsp"	"1"

	"playlooping"
	{
		"volume"	"0.5"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT_Chrustmuss.wav"
		"pitch"		"100"
	}

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT.wav"
		"pitch"		"100"
	}
}

"Maintest_2"
{
	"dsp"	"1"

	"playlooping"
	{
		"volume"	"0.1"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT_Chrustmuss.wav"
		"pitch"		"100"
	}
}

Are there any error lines in the console?

no, the console is completely blank.

Here are the WAVs I’m using for the purpose of this experiment, as well as the vmf: https://dl.dropboxusercontent.com/u/3922896/ambiencechangetest.zip

any idea what on earth is going wrong?

Your wav’s are just too big. I cut them in half and they were playing just fine.

Here is the soundscape file, I used to test your music with:



"Maintest_1"
{
	"dsp"	"1"

	"playlooping"
	{
		"volume"	"1"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT_Chrustmuss.wav"
		}

	"playlooping"
	{
		"volume"	".02"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT.wav"
	}
}

"Maintest_2"
{
	"dsp"	"1"

	"playlooping"
	{
		"volume"	".02"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT_Chrustmuss.wav"
	}
	
		"playlooping"
	{
		"volume"	"1"
		"wave"		"kizzycocoa/test/ambiencechangetest/TaT.wav"
	}
}


Ah, I see. is there any way I can solve this while keeping the song’s length? x_x

Well, I have some good news. after mixing down the music to Mono rather than Stereo, it seems that it now works.

Still, I’d love to know what is the issue for my future projects. I’m trying to find out what it is, but I’ve no clue. is it the file size? the length? is there a max amount of looping sounds in the script? What are the maximums? I have no idea to any of them

I’d like to try and address this, by keeping the stereo, but running them individually from either side of the player. Is that something I can do? make the sounds only audable throgh the left or right sides?

Still, thanks to everyone for your help, particularly Litronom and Vincentor!

Edit: no, wait. it is too loud. I’m slowly counting the decimals, trying to get it quieter. I’m at 0.01568649988622 so far. Any lower, and it cuts off. I can still hear it, and as parts of the map are in quieter areas, I need to get this as quiet as possible.

I’ve got it pretty quiet as it is, but I need to be silent, really x_x