aliens

Author Topic: Ambient sound or replaced music files played by map type  (Read 2793 times)

Theo

  • Guest
Ambient sound or replaced music files played by map type
« 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.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2338
  • Developer
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #1 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.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10205
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Ambient sound or replaced music files played by map type
« Reply #2 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.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2338
  • Developer
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #3 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.
« Last Edit: October 29, 2017, 02:44:40 pm by Warboy1982 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10205
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Ambient sound or replaced music files played by map type
« Reply #4 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.)

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2338
  • Developer
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #5 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.
« Last Edit: October 29, 2017, 03:58:24 pm by Warboy1982 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 10205
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Ambient sound or replaced music files played by map type
« Reply #6 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.

Theo

  • Guest
Re: Ambient sound or replaced music files played by map type
« Reply #7 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

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1929
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #8 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.  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:
  • A copy of the sound files you want to port
  • An extraSounds entry pointing to that file and giving it an index number that isn't one of those used by the UFO sounds (55 or greater for BATTLE.CAT - the battlescape sounds)
  • An entry in the proper places in terrains.rul for ambience: <whatever index number you chose>

Theo

  • Guest
Re: Ambient sound or replaced music files played by map type
« Reply #9 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 :)

Offline Grenadier_LOL

  • Squaddie
  • *
  • Posts: 3
  • Boom
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #10 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)

Offline The Martian

  • Colonel
  • ****
  • Posts: 472
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #11 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 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

Offline Grenadier_LOL

  • Squaddie
  • *
  • Posts: 3
  • Boom
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #12 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"
« Last Edit: August 02, 2021, 04:42:59 am by Grenadier_LOL »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 6917
  • OXCE developer
    • View Profile
    • My Wiki
Re: Ambient sound or replaced music files played by map type
« Reply #13 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.
« Last Edit: August 02, 2021, 10:01:37 am by Meridian »

Offline Grenadier_LOL

  • Squaddie
  • *
  • Posts: 3
  • Boom
    • View Profile
Re: Ambient sound or replaced music files played by map type
« Reply #14 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.
« Last Edit: August 07, 2021, 08:05:05 am by Grenadier_LOL »