big files for atmospheric music

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

big files for atmospheric music

Post by THOM »

I have some levels where there is no "normal" soundscape - just wind howling for example.

I want to add some suspense music here and there - maybe at certain moments in the game.

If I load these as WAV-Files that would mean tons of megabyte just for some atmo. Is there really no other way for using soundfiles in the game than have them as WAVs? OGGs can only be played as levelmusic or in bossfights AFAIK. Is there another way to reduce size?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: big files for atmospheric music

Post by Isaac »

If you are careful how you play them, then you can use GameMode.playStream() to play your ogg files on demand. If you make a silent ogg file, and play that, it effectively stops ambient playback. Playing the silent track instantly stops the previous track; so if you have them fade out [in the recording], then you could try to stop them after the fade, and it might mask the hard cutoff.

Here is an example project:
https://www.dropbox.com/s/mw4jn0gv34p00 ... e.zip?dl=0

**Reloads will restart whatever stream was playing when the game was saved. So it might be possible to use the reload-detection trick to play the silent ogg file, or play the default ambient track for the map. (I didn't do this in the demo; but I'm curious to see if that can work.)
THOM wrote:OGGs can only be played as levelmusic
Technically it is level music. :|
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: big files for atmospheric music

Post by THOM »

Without having a look at your example dungeon (I am currently at work): Will your trick interrupt the running ambient-track? I ask, because that wouldn't be neccessary for my purpose.

But thanks anyway, Isaac. I will have a look at your file later...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: big files for atmospheric music

Post by Isaac »

It instantly replaces the running ambient track. It can be used to shift the ambient music over to a new track, and allows that track to benefit from ogg compression.

Caveats include: No pause & resume [playback always starts from the beginning], and no mixing with the current ambient sound [the new track replaces the old].

** Wav files are uncompressed in the game, but are compressed a little bit in the exported dat file; [because the dat is compressed].
A 12MB wav file included in a blank project resulted [for me] in a slightly more than 6½ MB dat file; that's not bad. That is nearly 50% compression.
(Though it doesn't compare well to the ½ MB ogg version of the same file.)

BTW, here is a better version of the silence.oog: https://www.dropbox.com/s/loo25vbwk74n2 ... e.ogg?dl=0
Post Reply