Topic: Adding Custom Music?  (Read 10872 times)


Karmatose

« on: January 01, 2021, 07:08:19 PM »
I've been wondering if it'd be possible to add custom music to play in-game? I see that the audio files are pretty self-explanatory, but I don't know if it's possible to add more music (as opposed to replacing existing music) without getting into coding, or how difficult it'd be to code that in? I noticed there is an 'audio.txt' file in the game folder, but all it says is 'start'...So not sure that's what I'm looking for. Any pointers?

ConnorA

« Reply #1 on: February 03, 2021, 12:07:13 AM »
If you can really add your own music to the game, that's cool. I'm also interested to know.

Night

« Reply #2 on: February 03, 2021, 04:02:10 AM »
I have this planned as a feature in my current project. My question is, when do you want sounds/music to be played? looped? I have many ways of doing it, so I'm open to ideas people will actually use contrary to just my own thoughts.
@Karmatose , @ConnorA
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

paulkorotoon

« Reply #3 on: February 06, 2021, 11:37:56 AM »
I suppose @Karmatose you mean music played when different game screens are active (the ones where music plays by design, like rituals screen) or events happen?

As of first case, I see an idea of some audio replacer that watches what game screen is active at the moment and replaces default audio files with ones from user-selected pool when it's possible. Say, each time you're back to the wilderness map or zoom in/out, the program overwrites default audio/ritual.ogg with one of /third-party audio replacer/audio/random_ritual_%number%.ogg, so the next time you hit F4, you hear different theme.

As of event-related music, I guess it's possible for the same audio replacer to watch msglog.txt (afaik the game updates it in real-time) for specific lines (like start of a battle), and when one of that lines appears, to play corresponding theme (however it will probably require extra programming effort to avoid conflicts with the first case).

Unfortunately, I'm waaay far from being skilled enough to code something like this by myself. But if someone could write this piece of software, that would be sure awesome. @Night, what do you think?

« Last Edit: February 12, 2021, 01:34:42 PM by paulkorotoon »
Biggest Russian UrW fan

Night

« Reply #4 on: February 06, 2021, 01:41:49 PM »
I suppose @Karmatose you mean music played when different game screens are active (the ones where music plays by design, like rituals screen) or events happen?

As of first case, I see an idea of a some audio replacer that watches what game screen is active at the moment and replaces default audio files with ones from user-selected pool when it's possible. Say, each time you're back to the wilderness map or zoom in/out, the program overwrites default audio/ritual.ogg with one of third-party audio replacer/audio/random_ritual_%number%.ogg, so the next time you hit F4, you hear different theme.

As of event-related music, I guess it's possible for the same audio replacer to watch msglog.txt (afaik the game updates it in real-time) for specific lines (like start of a battle), and when one of that lines appears, to play corresponding theme (however it will probably require extra programming effort to avoid conflicts with the first case).

Unfortunately, I'm waaay far from being skilled enough to code something like this by myself. But if someone could write this piece of software, that would be sure awesome. @Night what do you think?

I am implementing an event system in my current project, which will allow for such things. I hadn't thought of using msglog.txt though, so that's a nice idea I'll be looking into.

Also probably possible to replace sounds, may or may not be necessary.

URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!

paulkorotoon

« Reply #5 on: February 06, 2021, 03:56:50 PM »
may or may not be necessary.

Supposed that sounds' filenames are hardcoded, replacing seems the easiest way. Once again, I'm no great programmer, so probably I don't know best. Just sharing ideas.
Biggest Russian UrW fan

Karmatose

« Reply #6 on: March 24, 2021, 06:42:37 PM »
Sorry for the late reply, I've been in-and-out of the game as of late. ^^;

I have this planned as a feature in my current project. My question is, when do you want sounds/music to be played? looped? I have many ways of doing it, so I'm open to ideas people will actually use contrary to just my own thoughts.
@Karmatose , @ConnorA

I was imagining something where for example you could have different atmospheric tracks play depending on whether you were deep in the forest, or in an open field where you can see and be seen for miles on end. So...locational based, but also event based like for example if you're in a fight with a bear, the track would change, etc...Possibly different tracks for different times of day, as well. I think this could work with either music, or ambient sound (like crickets chirping in a field at night), or a combination of both. Might be interesting to also have the music get more intense as your physical condition gets worse... Like the closer you are to death the more intense the music gets (if you're still in a battle) but if you've left the battle/you're dying for non-injury related reasons, then the closer you get to death the more ominous the music gets, and then at a certain cutoff point the music starts to get very quiet...until it stops completely and you die. But, that might be a tad too advanced to be honest.

My worries are that finding good copyright-free music/ambient might be difficult. Using a site like https://asoftmurmur.com/ to create ambient mixes might be interesting though, but I'm not sure about their terms of use (despite reading it the legal jargon went a bit over my head..but from what I understand that specific site allows usage for non-commerical use only?) or if you could manage to convert the tracks you make into MP3/WAV files or not.

@Night Is the project you're referring to your URW Mod Extender (https://www.unrealworld.fi/forums/index.php?topic=6325.msg18406#msg18406) you released recently? I'm looking at the thread and as someone brand new to modding in URW I'm...somewhat lost ^^; How would this be used to add music?

Night

« Reply #7 on: March 24, 2021, 11:25:33 PM »
Spoiler: show
Sorry for the late reply, I've been in-and-out of the game as of late. ^^;

I have this planned as a feature in my current project. My question is, when do you want sounds/music to be played? looped? I have many ways of doing it, so I'm open to ideas people will actually use contrary to just my own thoughts.
@Karmatose , @ConnorA

I was imagining something where for example you could have different atmospheric tracks play depending on whether you were deep in the forest, or in an open field where you can see and be seen for miles on end. So...locational based, but also event based like for example if you're in a fight with a bear, the track would change, etc...Possibly different tracks for different times of day, as well. I think this could work with either music, or ambient sound (like crickets chirping in a field at night), or a combination of both. Might be interesting to also have the music get more intense as your physical condition gets worse... Like the closer you are to death the more intense the music gets (if you're still in a battle) but if you've left the battle/you're dying for non-injury related reasons, then the closer you get to death the more ominous the music gets, and then at a certain cutoff point the music starts to get very quiet...until it stops completely and you die. But, that might be a tad too advanced to be honest.

My worries are that finding good copyright-free music/ambient might be difficult. Using a site like https://asoftmurmur.com/ to create ambient mixes might be interesting though, but I'm not sure about their terms of use (despite reading it the legal jargon went a bit over my head..but from what I understand that specific site allows usage for non-commerical use only?) or if you could manage to convert the tracks you make into MP3/WAV files or not.

@Night Is the project you're referring to your URW Mod Extender (https://www.unrealworld.fi/forums/index.php?topic=6325.msg18406#msg18406) you released recently? I'm looking at the thread and as someone brand new to modding in URW I'm...somewhat lost ^^; How would this be used to add music?


Most of what the mod extender does is providing more access to the games data/functionality. In the case of sounds/music, they could be activated in several different ways, such as when the terrain type changes, or when an game object is near the player (NPC/item/tracks), probably several more options if I think about it. All of these things I detect through a loop/loops dedicated to tracking that data. In the future, I plan to have a scripting system based off of these events, that follows a similar syntax to URW's crafting syntax, some examples might look like:

Code: [Select]
[START_TerrainChanged]
   .MyCustomScript1.
   Conditions:
      [TERRAIN:pine mire]
   Actions:
      PlayMusic("PineAmbience.wav")

   .MyCustomScript2.
   Conditions:
      [TERRAIN:village]
   Actions:
      PlaySound("EnterVillage.wav")
[END_TerrainChanged]



[START_PlayerChanged]
   .MyCustomScript3.
   Conditions:
      [HEALTH:<80]
      [SWITCH:HasGrunted] == false
   Actions:
      PlaySound("Grunt.wav")
      [SWITCH:HasGrunted] = true

   .MyCustomScript4.

   Conditions:
      [HEALTH:>=80]
      [SWITCH:HasGrunted] == true
   Actions:
      [SWITCH:HasGrunted] = false
[END_PlayerChanged]



All of the above code would be handled by the mod extender in an script.txt file, when conditions/actions are met. Also, there would be some control mechanisms to repeat actions, or to only execute them once, or to only execute them once everytime the condition is met. I haven't currently implemented it so, the above is just a psuedo version of what it will most likely look like.

Basically, a condition/action system, with functions that will allow for user input, such as PlaySound("SoundFile.wav"). When I've completed more of the project I will document the functionalities more thoroughly, but most of what you said is within scope.

The only thing that might be difficult with what you said is transitioning between ambiences in the case of combat, mostly because I'd have to track the duration of the sounds playing and then transition to the next at the end of the first sound so it would sound smooth, but it is possible to do.


There also may be other areas where I can implement sounds, but this would be the main place.
@Karmatose


As for copywrites, I have no clue, It's a big mess when it comes to fan-made projects, but I just assume as long as I'm not profiting off of something it shouldn't be a problem. Probably costs them more to send a C&D to someone using their stuff for non-profit personal/fan based entertainment than ignore it if its not cutting into their dough. I'm not a legal expert though, so don't take anything I say as fact lol. I know that most media type property has a license attached to it, so thats probably what you would want to refer to most of the time. Some just require crediting the source.
« Last Edit: March 24, 2021, 11:35:50 PM by Night »
URW Character Menu - Cheating menu by a player, for the players.
URW Character Designer - Design your characters sprite!