Please or Register to create posts and topics.

Troubles with dynamic music

Page 1 of 2Next

I've been trying to implement custom layered music, similar to the music in the singleplayer campaign, except it will all be controlled via I/O (since music will turn on/off by completing parts of the puzzle, rather than flying through the air etc). This will eventually be packaged as an instance for easy use in maps. However, I've been running into an issue in correctly implementing this and keeping all the tracks in sync.

My first attempt simply used the FadeIn and FadeOut commands, but it seems FadeOut will stop the sound, meaning tracks will desynchronize when I fade them out. quickly.

My second attempt went a bit better; each ambient_generic starts playing at 0 volume, and a logic_relay will increment the volume up to 10 over time, simulating a fade. A secondary relay does the same in reverse to fade the music back out. The tracks stay in sync as I fade them in. However, they still desynchronize when I turn them back down. Oddly though, the tracks of the music don't start from the beginning when they fade back in - it seems that setting the volume to 0 pauses the sound!

If someone knows of a way to get dynamic music like this to work, it'd be greatly appreciated.

I noticed the same things while working on the third Shadows of Time map's dynamic music system. For that I just stepped the music from 1 to 10 instead of 0, but a better option I've found since then is this:

Place an info_target for each piece of music. Set the sound to emit from it. Then when you want it to start, SetParent !player SetParentAttachment eyes. When you want it to stop, place some other model with an attachment (such as a pivot cube) in a nodraw-box and SetParent SetParentAttachment to it.

Since the sound will essentially emit from the player, you can set its radius to something very low. Then it doesn't need to teleport very far to become inaudible.

Falsi sumus crusto!

Thanks for the advice! I tried getting the parenting to work, but some really goofy stuff (like tracks being desynchronized on the map startup) was happening, so I just went with setting the volume to 1. However, if you have an example .vmf with the parenting method, I'd like to see it.

You'll also want to change the player model to Chell. I remember Sicklebrick having the problem in Telekinesis because Bendy has no attachment points.

Big Mood
Idolon wrote:
Thanks for the advice! I tried getting the parenting to work, but some really goofy stuff (like tracks being desynchronized on the map startup) was happening, so I just went with setting the volume to 1. However, if you have an example .vmf with the parenting method, I'd like to see it.

I never got it to work well enough for a release map, but I found that making them all Start Silent and then using OnMapSpawn/OnMapLoad PlaySound on all of them helped fix that.

Falsi sumus crusto!

As per my last experiments, soundscripts can be used per-map. Simply copying off of one of Valve's scripts for music should be enough to get two tracks to synchronize (create a script for one track and another for the track that syncs with it; then place two ambient_generics that use the corresponding sounds and trigger them as usual).

Jack of all trades; master of none.

Wait, how can soundscripts be used to sync music tracks? That would be so useful!

EDIT: Wow, they can. Is the best way to add a new soundscript to pack a modified _manifest.txt into your BSP?

Falsi sumus crusto!

Soundscripts (as far as I know) can only be loaded when packed from specific locations & a specific named file just like soundscapes (e.g. scripts/soundscapes_mapname.txt) See VDC soundscripts for these locations.

I would like to see if anyone can get this working because Portal 2 has some awesome addon to soundscripts..

?????????????????????????????TWP Releases | My Workshop

But will that work on the Workshop? The map name changes when it's downloaded.

Falsi sumus crusto!
FelixGriffin wrote:
But will that work on the Workshop? The map name changes when it's downloaded.

The map name stays the same. What changes is the location. For example, if you had test.bsp, you usually have it in:
portal2/maps/test.bsp
However, once it's on the workshop, it's something like:
portal2/maps/workshop/[weird number]/test.bsp
I don't know if the soundscripts go based on name or path, though, so the best thing is to take a look at the Valve ones.

Image
Page 1 of 2Next