Not logged inOpenClonk Forum
Up Topic Development / Art Workshop / [Soundtrack] Triggerscripts
- - By ala [de] Date 2014-06-27 19:46 Edited 2014-08-19 14:45
Hi,

I already gave Maikel some infos a while back, but haven't received an answer - so here we go with a thread.

I'm back on working on the soundtrack at least for the next 3-4 weeks. I hope I can finish the second segment of compositions in this time, also I'll start recording Flute, Guitar and bassoon for the first segment soon. So we'll get a lot closer to good sounding music :) - but it's still a long way.

It's time to get the music on the right place in-game, I need a programmer now.

-- I divided the settlement part in 12 trigger points: The plan is to have 2 tracks for every theme at the end.

-- Landscapes
1x Sky (Traveling)
1x Mountain (Rope Swinging)
0x Temperate
1x Lakes / Small Water (Whispering Waters)
2x Underwater (Pearl Diving, Amongst Sea Life)
2x Underground (The Spelunker, Dim Lighted Cavern)
2x Very Deep (Volcanic Flow, Secret Passage)

-- Weather
1x Snow (Finding Shelter)
0x Rain
2x Night (Nightwalk, Cheesy Moon)

-- Position
1x Home / Base (Building A Cabin)
1x Away from Home / Base (Return Of The Backpacker)

Currently I cover 9 of the 12 themes, with currently 12 tracks. 24 tracks would be needed to cover everything two times. Also K-Pones music could fit into this concept, at least the sky and the islands track.

----------------------

Here are the feature-wishes:


Some small improvements:

-First, no lag between track switching like in CR. I think this has already been fixed somewhere.
-Fading between tracks.

The big thing will be:
-A script which can recognize the landscape and can trigger music in one of those points. For this every song should get a category, but perhaps some songs could fit for several categories. So if someone programs this keep that in mind.

Transition between tracks:
If the trigger points is recognized we can work on smooth transitions, for example: You go inside a cave and the current track, which plays gets softer each step you get deeper into the cave. Only after it faded out the cave track starts. This will happen very fast, in a couple of seconds. But it's important to not have those hard cuts. If a track ends in this transition period of course we could start the new one without anything of that.

Jumping between tracks back and forth:
Imagine you have to clonks and switch between them.. we could use the fade thing. But one thing that would happen quickly is that we would hear the starts of the songs far more often than the end. So we would need the possibility to jump in the middle of a track, so we avoid over-repetition for beginnings.
Most of the tracks have optional intros, and could - in case of jumping back and forth - start after the intro. Also every track is divided in at least 3 parts (most are divided in around 5 parts).
If scripting this is possible I could make versions of the song which start in the middle.

-------------

If this is all possible we should really get a very good game atmosphere. I hope someone picks this up - the music alone is useless without proper implantation.
Parent - - By Tyron [at] Date 2014-06-27 20:47 Edited 2014-06-27 20:56
Unfortunately your dreams of landscape-dependant music is not possible. I was wishing for it too for GZE, but currently doesn't work for multiplayer in neither CR nor OC becuse you can't set playlists/music for individual players (to my knowledge).
If I had that feature you could be using my music manager ;-)
Fading I'm also planning to add.
Parent - By Maikel Date 2014-06-27 20:53
You could add a request for that in the bugtracker :) Sounds useful to have for me, and then if you are lucky it might get backported to CR.
Parent - - By Maikel Date 2014-06-27 20:56
I don't know whether I already said this in query:

But in general I think it is really hard to trigger the music at the right locations in random landscapes, and it might be very scenario dependent. If someone at some points decides to make a large adventure for OC, I could see this take of more easily, since there triggering music is much easier done.

In general I like the idea :) and I agree that music should be an integral part of the game.
Parent - - By Tyron [at] Date 2014-06-27 20:59 Edited 2014-06-27 21:03
It's not that hard really. My 'Better Ambient Sounds' Enviroment Object for CR does a fairly good job at it, I find. I'm just sampling x random spots near the clonk in a regular interval. If I find a desired material (e.g. water + sand for beaches or cave + water for water dripping sounds or finding nearby trees for bird singing) I increase a counter. If the counter reaches a threshold, I play the sound.
Parent - - By Maikel Date 2014-06-27 21:01
Mh, okay, sounds like reasonable implementation, does it also give you the right atmosphere feeling?
Parent - By Tyron [at] Date 2014-06-27 21:02
For me, definitely. Try it out yourself (GZE Temperate is a good example) ^_^
Parent - - By ala [de] Date 2014-06-27 21:04
At least most of the triggers (like night or underwater) strike me as not so difficult to determine. It would seem very good to start with them. Probably things like mountains, are more challenging to detect - but this can come later.

Also from a game designer perspectives, such detection scripts could be used for effects and sounds later - I really think it's work that should pay of quickly. The soundtrack really needs something like this. It won't sound great if you hear the skyland theme in a lava-cave.
Parent - By Tyron [at] Date 2014-06-27 21:12
I think detecting a mountains is no problem as long as the 'music manager' is configurable enough to allow easy customization for non standard-mountains (e.g. a standard mountain could be clonk standing in the top 25% of the map, and nearby snow/ice)
Parent - - By Apfelclonk Date 2014-06-27 21:09 Edited 2014-06-27 21:16
I also had some ideas according to the music behaviour. I thought of the possibilty of interrupting music, play another song caused by an event and, when the event is over, continue the old song where it had been stopped. That would be useful for fighting music in settlement scenarios. For example, you are settling all the day, suddenly a wild monster appears and is going to attack you or at least sets you as target. Meanwhile the battle-music is played until the point the clonk is out of combat and the chilling music encouraging you to build your empire can go on. Maybe this management could be handled the best by having a system similar to the animation stacks, so you overlay default music by weather music and on the top of it by battle music.

The music then has to be player depending as mentioned by someone before.
Reply
Parent - By Tyron [at] Date 2014-06-27 21:16 Edited 2014-06-27 21:23
That'd be even better. I think the only part the engine would need to support here is a way of finding out what song is currently playing and how many minutes of it has played already as well as playing a music from a certain point into the song. The rest could be easily scripted. Knowing the length of a song would help too.
Parent - - By Tyron [at] Date 2014-06-28 11:12 Edited 2014-06-28 11:16
In case you need inspiration for night music, I find these fantastic and would love to have a free version on one or more of these for GZE:
https://www.youtube.com/watch?v=5DUCKGyojpE&feature=kp
https://www.youtube.com/watch?v=q2Yn342OnRg
http://www.nitrome.com/jam/games/akittydream/ (intro music)

Could you try something in that direction? In return I can try and support you with a music manager for OC ;-)
In any case, I will try Ends suggestions for player local music and fading I will also implement.

Sidenote: Currently I have 2 night loops in GZE which are free for use:
https://soundcloud.com/essa-1/ambient-loop-3
https://soundcloud.com/essa-1/ambient-loop-1-free-to-use
Parent - By ala [de] Date 2014-07-14 11:45

>In case you need inspiration for night music


Alright, I'm on it now.

>https://www.youtube.com/watch?v=5DUCKGyojpE&feature=kp
>https://www.youtube.com/watch?v=q2Yn342OnRg
>http://www.nitrome.com/jam/games/akittydream/ (intro music)


Wow, the terraria track - let's say I didn't expect this. A mix of synths, old game boy sounds, distorted instrument plugins and effects - must come from a electronic artist, which never did anything else. Is the whole terraria soundtrack like this?

The trentemoller track is nice. It uses a lot of minimal concepts, and I actually started my track like that and tried that, but after a while I added more chords and harmony since I was stuck. So I'll probably fail in my attempt to use less complexity than normal :)

The kitty Dream thing is the most appealing to me, a pure harmony composition, that's awesome :)
Parent - - By Clonkonaut [de] Date 2014-07-08 15:15

> It's time to get the music on the right place in-game


Definitely!

I am all in favour of a context-sensitive system. However, as you (and others) pointed out, there are some obstacles in the way. In the long term, it might be good to really implement all the wanted functionality into the engine, i.e. improve the Music() function. For a quicker solution, we could try something with Sound(). You can already adjust the volume, set different sounds for different players and so on. We would need to have the music settings (volume and on/off) available in script. There are still problems though:

More than one player on a network client (or local coop) would be unsupported. I don't know how common this is anyway because we don't officially support splitscreen so far.

The script would have to guess at how long a song plays and switch the another one. With lag, this will turn out not so nice. We can make the songs loop, so there will be no gap between songs if the game goes slow. You'll hear the same song more than once before it changes.

You wouldn't be able to turn off / on the music when the game is paused.

As with your fear of hearing the first parts of a song too often; I wouldn't make the system overly sensitive. Let a song play out a little bit after the situation changed. Only if, say, a Clonk went to the surface for a minute after being underground change the mood.

In summary, I'd prefer to have the quick&dirty method as a player made extension and plan for a long term solution in the engine, rewriting SetPlayList and so on. Or maybe that's super easy, I haven't assessed the workload of this yet.
Reply
Parent - By Zapper [de] Date 2014-07-08 15:32

>The script would have to guess at how long a song plays and switch the another one. With lag, this will turn out not so nice. We can make the songs loop, so there will be no gap between songs if the game goes slow. You'll hear the same song more than once before it changes.


The script wouldn't actually need the length of the music.
When in a cave, the script should just call SetPlayList("Cave1, Cave2, ..."); and when exiting, it should call SetPlayList("Temperate1, 2, 3..."). The engine would then just need to cross-fade the next song from the new playlist. I think that's already implemented?
Parent - - By Sven2 Date 2014-07-08 15:48
Yeah, SetPlaylist does almost everything we need. It just needs some extra parameters, which should be trivial to implement.
Parent - - By Clonkonaut [de] Date 2014-07-08 16:11
What about seperate music for each player / client?
Reply
Parent - - By Sven2 Date 2014-07-08 16:15
That would be one of the required features. The request is already in the bugtracker.
Parent - By Clonkonaut [de] Date 2014-07-08 16:17

> The request is already in the bugtracker.


Will be done in no time then!
Reply
Parent - - By Tyron [lv] Date 2014-08-16 09:01
Any chance that the player parameter could be backported to CR? ;-)
Parent - By Anonymous [de] Date 2014-08-16 11:01
The changeset is in the git repos and should trivially apply to CR. The only problem is that there is noone who maintains CR (or CR successor) builds.

hi from austria btw. Sitting under my hang glider on top of the mountain waiting for the rain to stop :)
Reply
- - By ala [de] Date 2014-08-11 09:02 Edited 2014-08-11 09:49
Hi,

I'm proud that by now the project, has reached a respectable size - and that music, scripts and planning have painted a picture, which is very close to actual implementation.

The Soundtrack is ready to go into the game. I finished covering all categories I could think of in a settlement environment. In total I'm on 13 tracks which are finished, 5 more will come during the next weeks. I'll finish with the 18th track.

Producing and Recording to achieve better audio quality is in progress, but will take a long time. I will make this a separate project, which will be scheduled to be released much later.

----

Implementation has started. Sven build in music loops (no more lag between tracks like in CR) and already promised me to finish Fading between tracks after his vacation :)
- I emailed Tryon, since he mentioned he could provide the scripting of the Trigger System. If he implants this system - the whole project is actually very close to getting finished. Might even come into the next release?

There are 4 technical steps left, to make the soundtrack work. I'll put an entry for every point into the Bugtracker and add the Details. I'll summarize each point, since for some of them there is still room for discussion. After those and the remaining tracks are done, the project will be finished :)
Parent - - By ala [de] Date 2014-08-11 09:31 Edited 2014-08-17 15:03

>I'll summarize each point, since for some of them there is still room for discussion.


1 - Smooth fading between tracks:
Assigned to: Sven2.

When changing tracks, they should cross fade - like in the radio. This willl avoid abrupt changes in the music. This should be an option, since potential melee tracks (currently not planned) would want that sudden change (also useful for surprise elements).

2 - Safe and load track at a specific position:
Assigned to: None.

Say we have two clonks in different environments, and the player would switch between them. In this case we would always hear the intro of both songs, but never the full songs. This should be avoided: If a track changes it's time-position should be saved - and reused if the player returns to this environment in a short period of time. If the track is very near at the end, its position should not be saved, since a track picked up at his finishing chords would sound weird.

3 - Implementation into the Installer or similar:
Assigned to: None

On the recent CM, we discussed the following idea for including my music:
During the installation the user could get asked if he wants to install the music, but it should be clearly noted that it's not under the CC-By License. This way we give the user the power to decide what he wants.
Some feedback on this? - would this pose any problems with the current conduct? An alternative would be a sort of update package (.c4u), which would be a separate Download - but also install automatically.

4 - Implement a Trigger System:
Assigned to: None. I emailed Tyron, since he showed interest before.

The current environment of a player must be analyzed, and should trigger different music. I concepted the following (12) categories:

1) Sky
2) Mountain
3) Normal / Temperate
4) Lake (above water, near puddles and all gathering of water)
5) Underwater
6) Underground
7) Deep Underground
8) Base
9) Away from Base
10) Snow
11) Night
12) Rain

Once a category has been specified by the algorithm it will choose one of the songs which have the category we want. But since we have only a limited number of tracks, I gave most songs more than 1 category to get less repetition. To still boost the feeling of a particular set of environment the songs which are not from the category we are in, will be played less frequent.

For example:
The underwater tracks are Pearl Diving, and Sea Life - but there is also Whispering Waters (a lake theme) which has a smaller percentage of being played.

The tag-list for all the current songs:
The Spelunker (Category 6 - 100%, Category 7 - 30%)
Dim Lighted Cavern (6 - 100%, 7 - 50%)
Return Of The Backpacker (9 - 100%, 2 - 30%, 3 - 10%)
Nightwalk (11 - 100%, 9 - 20%)
Finding Shelter (10 - 100%, 12 - 60%)
Volcanic Flow (7 - 100%)

Pearl Diving (5 - 100%, 4 - 20%)
Rope Swinging (2 - 100%)
Among The Sea Life (5 - 100%)
Building A Camp (8 - 100%, 3 - 100%)
Whispering Waters (4 - 100%, 5 - 15%, 12 - 70%)
Moon (11 - 100%)

Traveling (1 - 100%)
Secret Passage (7 - 100%, 6 - 40%)

I Also Categorized K-Pones Work, which should fit in nicely:
Motorway (8 - 100%, 3 - 100%)
Island Dreams (4 - 100%, 3 - 80%, 8 - 40%)
Sky-Thing (1 - 100%, 2 - 50%)

The transition between areas should be subtle meaning the music should not change back and forth if you run through the cave entrance in and out in a 1 pixel ratio.

I think that the different environments should overlap into each other - like 10% - so if you come from the daylight and enter a cave the outside music would still be played the first meters into the cave. And wise versa, if you come from the cave than music should continue a few meters to the outside.
This could also be connected to fades - so that if you are very near to another area the music could almost fade and get softer the more you approach the cave, and if you go inside it the cave music starts soft and gets stronger the deeper you go into it. This seems to be the way games like Gothic 2 handle this issue.
Parent - - By Matthias [de] Date 2014-08-11 15:15

> Safe and load track at a specific position
> two clonks ... and the player would switch between them


Just a quick note on that, since it's not entirely clear from your summary: You'd probably want to save the track position "per player per trigger", not "per clonk per trigger", because if you have two clonks in the same environment, you'd obviously want the track to continue playing when switching between them.

> The transition between areas should be subtle meaning the music should not change back and forth if you run through the cave entrance in and out in a 1 pixel ratio.


Yeah, you might want to consider a delay before fading into the other track. In addition to your case, there is also the case where a player switches between clonks frequently for short durations (for example to look if everything is ok in his base, or when cycling through all his clonks). The crossfading back and forth might disrupt the audio experience more than a few seconds of "wrong" music might do. I suspect something as low a 2 second delay would already suffice, but that would have to be playtested.
Reply
Parent - By ala [de] Date 2014-08-11 17:08
Ah yes, exactly. And yes again - the word delay describes it rather well.
Parent - - By Pyrit Date 2014-08-11 15:31
I'd probably make music NOT play permanently. Maybe play music 10 minutes and then have 10 minutes silence again. That's how it's done in Minecraft. Else you might get tired of music real quick.
Parent - By Zapper [de] Date 2014-08-11 16:13
Or randomly play songs very, very quiet or something like that?
Parent - By ala [de] Date 2014-08-11 17:06 Edited 2014-08-11 17:08
Although there are quite some numbers of other games, where music is always present, I agree this is probably a good idea. The music I wrote changes quite much, and doesn't always stay in the background. Breaks might really appeal to us, but we would need to get a bigger number of good sounds to keep the game alive.

We probably will figure this out with testing as well.
Parent - - By Anonymous [de] Date 2014-08-11 19:10
Good work on the tracks!

Concerning limited track number: wouldn't it be relatively easy to create modded versions of the same tracks? E.g. the underwater version of a track could use slightly different instruments and play a few octaves lower.

If we want to get really advanced, we could even "link" such tracks and fade to the same position. So e.g. we play "Spelunker" while the player stands at the beach and it switches to the underwater version of spelunker as he dives into the water. Doing this seamlessly might be tricky but should not be impossible.

(sent from my phone. Weather forecast for tonorrow looks bad for hang gliding so i might get some time for OC.)

also can we please get rid of the security question?
Reply
Parent - - By ala [de] Date 2014-08-11 21:07

>Concerning limited track number: wouldn't it be relatively easy to create modded versions of the same tracks? E.g. the underwater version of a track could use slightly different instruments and play a few octaves lower.


It would be less work than a new track, but still quite some work, maybe around 60%. Arranging and rearranging is one of the more time consuming tasks anyway. I'd have to try but I already sketch-composed most of the remaining songs.. hm maybe mix materials and reuse themes in the new ones. This is something that is missing anyway - since I don't really have reoccurring themes so far. Will see how it turns out.
Parent - - By Anonymous [de] Date 2014-08-12 07:02
Really? Can't you just play a piece in Moll and replace a Trombone by a Tuba and it still "works"? (Well, to the non-musician at least)

i think the effect of jumping underwater and having the music continue but change *slightly* would be amazing. Perhaps even better than fading to a new piece.
Reply
Parent - By ala [de] Date 2014-08-13 17:20 Edited 2014-08-13 17:22

>Really?


Yes. Rearranging is a lot of work, just changing an instrument is not a good idea in an orchestral context. Maybe you could change a solo instrument, like flute to oboe. But this is already tricky - since the oboe can't access the flutes high register.
So what? Maybe if you change from soprano to soprano - say a flute to a violin, wait no - that changes the instrument family - meaning the ability of getting through the sound mix.

For example if I have a mix of brass, strings and woodwinds: Brass play the theme, strings the chords, woodwinds color the chords. - And I would swap brass and woodwind. The result would the: Very sharp colors of disturbing quality - and a theme which can't be heard, since wood instruments are too soft.

Similar it is with changing modi (major -> minor etc.), this brings A LOT of change, since minor is differently build - especially with normal minor having no leading-tone etc.

---

So you can't just change this parameters, you'll have to rearrange and re-orchestrate. You're idea is very valid and this technique is indeed used in some game soundtracks. This can be done. But the soundtrack was just build another way - if the tracks would have to correspond now time wise too, I'd basically would have to start all over.

Btw. I'm also struggling with the idea of reusing themes (like the theme from Finding Shelter or Return Of The Backpacker) into other tracks. I have not done that so far - and if I look at it more closely, I guess for good reason: Some tracks have different measures, and I use different modi (variants of major/minor) in a lot of them.
Parent - - By Newton [de] Date 2014-08-11 21:17

>During the installation the user could get asked if he wants to install the music, but it should be clearly noted that it's not under the CC-By License. This way we give the user the power to decide what he wants.


I am fine with that. Should be additional to a separate download.

> 2 - Safe and load track at a specific position:


Sounds over-engineered. IMO, a music piece should play to the end before a new piece is started.

>4 - Implement a Trigger System:


Implementation note: Since your music is an optional package, the system must be dynamic enough to not bind the music in a hardcoded way. Perhaps one could make use of tags in the MP3/OGG metadata?

Also, I wonder if this could be intermingled with Zapper's (idea for?) an environment sound system?
Parent - - By Zapper [de] Date 2014-08-11 22:02

>Also, I wonder if this could be intermingled with Zapper's (idea for?) an environment sound system?


Wasn't me. But once we have some sort of environment assessment ("where am I"), that should be used for sounds, too.

Once we have enough environmental sounds, that is.
Parent - - By Newton [de] Date 2014-08-11 22:06
A bit of a hen and egg problem.
Parent - By Zapper [de] Date 2014-08-11 22:25
Well, the scripter who codes the environment assessment just has to make sure that the results can be used in other ways, too :)
Parent - - By ala [de] Date 2014-08-19 13:15

>Once we have enough environmental sounds, that is.


Add it to the list of needed sounds. Beginner in sound design, but I'll see what I can do.
Parent - By Pyrit Date 2014-08-28 01:37
The swimming sound is at the moment a dropping-something-into-water sound.
Parent - By Anonymous [de] Date 2014-08-12 07:03
Yes putting it into tags was what i had planned.
Reply
Parent - By Anonymous [de] Date 2014-08-12 07:09
We only support .ogg in the official build now btw. I actually think we could keep it that way: Drop support for everything but OpenAl and only keep ogg for music and ogg/wav for sound. (wav for sound might be needed if we need uncompressed sounds e.g. because they're modulated at runtime).

That would make it much easier to support extra features like cross-fading or loading in a background thread. Right now everything needs to be implemented multiple times.
Reply
Parent - - By Clonkonaut [de] Date 2014-08-12 10:47

>>During the installation the user could get asked if he wants to install the music, but it should be clearly noted that it's not under the CC-By License. This way we give the user the power to decide what he wants.
>I am fine with that. Should be additional to a separate download.


I suppose that's only going to work for the Windows installer, right?
Should we really start shipping different content with the different installation packages?
Reply
Parent - - By Newton [de] Date 2014-08-12 11:23
I was thinking that the Windows installer could optionally download the additional music. So the music wouldn't be shipped with the installer but the installer has the feature to download this additional package. What do you think about that? (Possible with an NSIS plugin)
Parent - By Clonkonaut [de] Date 2014-08-12 13:45
That does sound alright.
Reply
Parent - - By Zapper [de] Date 2014-08-12 12:20
Don't the linux guys only want free (i.e. libre) content anyway? :v
Parent - By Maikel Date 2014-08-12 12:23
I don't see a problem there, we just should not hardcode any of this into engine but provide a proper interface for all technical features requested in this thread.
Parent - - By Tyron [lv] Date 2014-08-16 13:29 Edited 2014-08-16 13:33
Ok, there we go. Here's a rough version for a enviroment triggered music system for CR: https://github.com/tyronx/gze/blob/master/Objects_GZE.c4d/Environment.c4d/MusicManager.c4d/Script.c

You can play GZE Temperate.c4d for testing. It will play the peaceful playlist in the day, plays randomly one of the night loops in the night, and with highest priority plays dangerous music at lava layer.

o Unfortunately, seamless transitions are missing between playlists and between the end and beginning of a music loop. We'd need engine support for that.
o Also not tested for mutliplayer yet.
o I would have liked to check what would be needed to convert the code to OC but I lost the CR-to-OC Scriptupgrade-Page again, somebody got it?
Parent - - By ala [de] Date 2014-08-19 13:11
Tested a bit. Well, yes the playlist changes correctly, but the music still plays on. I'd have liked to hear a fade if you go towards the end of an area :).

At the CM I watched pluto play some Gothic 2, where I think this was done quite well. There was port music and if you go away from it the music fades softer and softer - and at a certain point (distance to a different trigger point is closer) a different music fades in and gets louder. Like already described earlier - I'd favor a variant where in the intersection between both trigger point the music is kept a little from the area you came from, to avoid this "1pixel in or outside-Cave" switch between music :)
Parent - By Tyron [lv] Date 2014-08-20 12:16 Edited 2014-08-20 12:19
Yes, thats where Svens fade parameter comes in, I hope. Currently there is no way to fade between playlists, from what I know.

This code already includes a delay mechanic to prevent transitions from happening too quickly.
Up Topic Development / Art Workshop / [Soundtrack] Triggerscripts

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill