OpenXcom Forum

OpenXcom => Open Feedback => Topic started by: Theo on October 28, 2017, 11:31:13 pm

Title: Ambient sound or replaced music files played by map type
Post by: Theo on October 28, 2017, 11:31:13 pm
Hello everyone. Love this game and very friendly community. Now, I don't really like to play missions with music on, and I bet I am not alone. Therefore I was thinking to replace music files with ambient sound extracted from various sources especially from Spellcross (who knows this game knows how immersive the ambient sound can be). So lets say I replace music files with forest, desert, city noises which is the easy part. Problem gonna appear when the mission start in desert and engine choose forest noise music file. I know we have amazing jukebox but tied music to specific map types will be amazing. I understand that I asking to much so maybe we can consider it for future.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Warboy1982 on October 29, 2017, 07:14:14 am
that's actually been implemented for a while now, in fact there's a separate audio channel reserved specifically for ambient background noise which we make use of in TFTD's underwater missions.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Solarius Scorch on October 29, 2017, 02:25:54 pm
that's actually been implemented for a while now, in fact there's a separate audio channel reserved specifically for ambient background noise which we make use of in TFTD's underwater missions.

Is there a manual on how to add them? I can't find anything relevant on the Ufopaedia.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Warboy1982 on October 29, 2017, 02:42:16 pm
in terrains.rul, the relevant fields are "music' and "ambience". context for music should be immediately obvious, and the ambience refers to a sound effect number.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Solarius Scorch on October 29, 2017, 03:48:02 pm
in terrains.rul, the relevant fields are "music' and "ambience". context for music should be immediately obvious, and the ambience refers to a sound effect number.

OK, simple enough, thank you.

Is there a way to load more effects? (For example in a forest: a woodpecker, bird voices, leaves rustling, etc.) And can it have modifiers like frequency?
(The forest is just an example, not an actual project of mine.)
Title: Re: Ambient sound or replaced music files played by map type
Post by: Warboy1982 on October 29, 2017, 03:56:39 pm
currently it's only a single sound effect, but there's no restriction on length so you coooooouuuld mix together a half hour loop with all kinds of random elements. granted it's not quite what you're getting at but it's a middle ground. extending the code to use a weightedOptions table wouldn't exactly be difficult. (i'm assuming you mean frequency as in how often it plays, not the audio frequency) but it's also only a single channel so the sounds would play one after another in random order and wouldn't overlap.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Solarius Scorch on October 29, 2017, 04:08:28 pm
currently it's only a single sound effect, but there's no restriction on length so you coooooouuuld mix together a half hour loop with all kinds of random elements. granted it's not quite what you're getting at but it's a middle ground. extending the code to use a weightedOptions table wouldn't exactly be difficult. (i'm assuming you mean frequency as in how often it plays, not the audio frequency) but it's also only a single channel so the sounds would play one after another in random order and wouldn't overlap.

OK, this is exactly what I wanted to know. Many thanks!
As for the proposed code change, it sounds like it has potential, but I wouldn't say I really need it myself. But I'd make use of it if it was there.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Theo on October 30, 2017, 12:04:16 am
OK that's great. Now I might actually need a bit help. So first question, from ruleset I see line ambience: 67, I don't have absolutely clue what this reffering to. Is it in the *.cat files? And if it is how the numbering works? And the next question, obviously this line missing in the ruleset for xcom1 type maps, does it mean if I add it into file it gonna play it in those maps as well? I don't have any clue how to mod openxcom, I just think it really can enrich game and it can't be that hard. Thanks
Title: Re: Ambient sound or replaced music files played by map type
Post by: ohartenstein23 on October 30, 2017, 04:36:29 pm
OK that's great. Now I might actually need a bit help. So first question, from ruleset I see line ambience: 67, I don't have absolutely clue what this reffering to. Is it in the *.cat files? And if it is how the numbering works? And the next question, obviously this line missing in the ruleset for xcom1 type maps, does it mean if I add it into file it gonna play it in those maps as well? I don't have any clue how to mod openxcom, I just think it really can enrich game and it can't be that hard. Thanks

Modding is not that hard, all you need is a text editor and a bit of ruleset knowledge to get started.  For sounds like this, they are defined in the ruleset as extraSounds (https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Extra_Sounds).  Original game resources get some special treatment for loading in the engine, but adding new sounds or replacing old ones in mods is done by giving them an extraSounds definition, then referencing that definition in the appropriate places in the ruleset.  For example, if you wanted to port the ambient sounds from TFTD to UFO, your mod would need to include:
Title: Re: Ambient sound or replaced music files played by map type
Post by: Theo on October 31, 2017, 05:44:18 am
OK thanks, that's a good introduction to a basics. I'll see what I can do and if I'll be successful I put the background sounds pack here for others :)
Title: Re: Ambient sound or replaced music files played by map type
Post by: Grenadier_LOL on July 28, 2021, 11:51:44 pm
that's actually been implemented for a while now, in fact there's a separate audio channel reserved specifically for ambient background noise which we make use of in TFTD's underwater missions.

Reviving old post, sorry?
This is very interesting bit of information. I'm currently playing TerrorFromDeep while I wait for other background tasks to be done, and listening to other audios while playing the game.
I want to only leave enabled the sounds in game that are actually SFX, I want to mute all Ambient sounds if possible. Or, even better, I would look for a way for the game to MUTE entirely when the game window is in the background. Do you know a way I could achieve one of these things?
I'm playing a relatively old build of OpenXcom, from 2019, maybe this feature is already existent in updated releases.
Also, I would make one request: include Hotkey to MUTE ALL SOUNDS, this would be very useful for certain situations (that ambient noise in the background gets tiresome after a while)
I need to have SFX turned on to know if enemies died or are only put to sleep (lol)
Title: Re: Ambient sound or replaced music files played by map type
Post by: The Martian on July 29, 2021, 02:48:29 am
I need to have SFX turned on to know if enemies died or are only put to sleep (lol)
I believe it is possible in OXCE (https://openxcom.org/forum/index.php/topic,5258.0.html) to display a symbol if an enemy is only stunned.

Specifically I think you need to assign images for BigStunIndicator: & FloorStunIndicator: to make the icons appear.

You can find an example of this, here:
https://openxcom.org/forum/index.php/topic,4424.msg72219.html#msg72219 (https://openxcom.org/forum/index.php/topic,4424.msg72219.html#msg72219)
Title: Re: Ambient sound or replaced music files played by map type
Post by: Grenadier_LOL on August 02, 2021, 04:41:11 am
Hum, that is quite nice, visual indication too.
But is there a way for me to completely mute "ambient sounds" in general? I just want to leave on the Sound Effects themselves (gunfire, screams, etc)
Suggestion for future releases: Hotkey for MUTE game entirely. Or functionality of "Mute game when in the background"
Title: Re: Ambient sound or replaced music files played by map type
Post by: Meridian on August 02, 2021, 09:59:53 am
Yes, ambient sound can be turned off via ruleset, attribute `ambience`: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Terrains

For Background Mute there is a button called Background Mute in Options > Audio.
Before suggesting something, at least try the newest version.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Grenadier_LOL on August 07, 2021, 05:02:50 am
Yes, ambient sound can be turned off via ruleset, attribute `ambience`: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Terrains

There's a giant table with lots of information. A bit daunting at first look.
What file do I have to edit? And how do I edit said file?

edit: I'm talking about TerrorFromTheDeep anyway.
I have no BATTLE.CAT file in my game directory.
Title: Re: Ambient sound or replaced music files played by map type
Post by: Meridian on August 08, 2021, 02:46:45 pm
Battle.cat is a name openxcom uses for vanilla sound effects.
Both for UFO and for TFTD.
You have it.

You need to edit the terrain ruleset file.

Search for ambience attribute and change whatever value it has now to -1 meaning "turned off".