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?
big files for atmospheric music
Re: big files for atmospheric music
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.)

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.)
Technically it is level music.THOM wrote:OGGs can only be played as levelmusic
Re: big files for atmospheric music
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...
But thanks anyway, Isaac. I will have a look at your file later...
Re: big files for atmospheric music
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
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