StarRuler2-Source icon indicating copy to clipboard operation
StarRuler2-Source copied to clipboard

Music replacement requirements?

Open poVoq opened this issue 6 years ago • 12 comments

What are the requirements for the music to be replaced? Is .ogg supported? Are file names hard-coded or is there some kind of dynamic music system in place?

I started a collection of potential free music over at OGA: https://opengameart.org/content/star-ruler-2-replacement-music

poVoq avatar Jul 24 '18 12:07 poVoq

Even glancing over the data folder tells you all of that.

  • all audio files are OGG.
  • filenames are defined in data/sounds/sfx.txt with common names
  • audio is used by scripts with proper names

mio-moto avatar Jul 24 '18 13:07 mio-moto

  1. To my knowledge, SR2 only supports OGG files.

  2. File names are not hardcoded, but you will find it difficult to add music without analyzing the orchestra.txt file, which seems to have been omitted from the files. (The main menu also uses data/music/title.ogg, or the contents of data/music/theme/ if you're using the Multiple Theme Enabler addon.)

  3. DarkMio's glance is only valid for non-music sounds.

DaloLorn avatar Jul 24 '18 13:07 DaloLorn

Couple of Q's:

I see in orchestra.txt that there are multiple arrangements, but also that Era is currently not implemented.

  • How do we predict which Arrangement will be played when? I noticed that the "Ambient" entry of each arrangement isn't set to loop: true, does that mean that once an Ambient track of an Arrangement has finished playing, it would go to the next Arrangement?

  • Under Industrial1, there is a Combat movement which is commented out and not seen anywhere else. Is this movement implemented?

  • I also noticed that under Industrial and Imperial arrangements, only an Ambient track is found. Does that mean that either: 1. the game ignores those arrangements, 2. the game doesn't play the victory/defeat music when it's in that arrangement, or 3. it inherits another movement somehow?

  • Is there a limit to how many Arrangements we can have, or what the names are? Or will the game just loop thru all of them randomly, as long as the format is satisfied?

Thanks!

OlivierGagnon avatar Jul 26 '18 17:07 OlivierGagnon

  1. Probably.

  2. Dunno.

  3. I think it's 2.

  4. I suspect it's less "random" and more "go through all declared arrangements in the order they're defined."

DaloLorn avatar Jul 26 '18 17:07 DaloLorn

So I recorded my voice and played around to try and figure out the pattern.

  1. That is the pattern. Confirmed.

  2. The "Combat" movement, when I configured it, seemed to always play and override all other sound. It also had some weird reverb effect. I'm assuming this feature is bugged and didn't get fixed, therefore not implemented

  3. I started a game and set the time limit to 1 minute. The game ended and I won. While at the "victory" screen, I still only heard the Ambient music playing. I also had a defeat and it was the same issue. This might also be bugged?

  4. Turns out it's random. I recorded myself saying numbers and they didn't come in the same order every time

Looks like most of it is bugged and only the Ambient entry is considered. Thoughts?

OlivierGagnon avatar Jul 27 '18 00:07 OlivierGagnon

Spent some time to gather all this info and made a little Playlist generator (orchestra.txt) which is hosted on my github

https://github.com/powercat/Star-Ruler-2-Orchestra.txt-generator

After seeing that most of the file's Movements didn't work, I trimmed it down and that's the result. Only kept the "Ambient" movement cause that's the only one that seems to work.

OlivierGagnon avatar Jul 27 '18 07:07 OlivierGagnon

  1. The victory/defeat music changes its volume based on how many ships have recently been destroyed or lost by the player. It's "I'm winning/losing this battle", not "I've won/lost the game".

DaloLorn avatar Jul 27 '18 08:07 DaloLorn

The victory/defeat music also never played while on combat or after having destroyed ships.

The way I tested it was to have this orchestra.txt:

Arrangement: Exploration1
Era: Exploration

Movement: Victory
    Track: data/music/victory1.ogg
    Loop: true
    Volume: Ambient.playing * 0.15 * (ships_destroyed.acc / (4 + ships_destroyed.acc))

Movement: Defeat
    Track: data/music/defeat1.ogg
    Loop: true
    Volume: Ambient.playing * 0.25 * (ships_lost.acc / (4 + ships_lost.acc))

Movement: Ambient
    Track: data/music/ambient.ogg
    Volume: min(0.25, 1.0 - (Victory.volume + Defeat.volume) * 0.5)

And each ogg file was of me saying that word, ie "victory sound one", "defeat sound one", etc.

Got in a few battles, destroyed a bunch of ships, but only ambient was ever playing.

OlivierGagnon avatar Jul 27 '18 14:07 OlivierGagnon

Turns out I was wrong about the defeat/victory music. I've modified the orchestra.txt generator to have more options for ambient, victory and defeat.

It now has 3 tabs to add songs to the playlist of each Movement, and when you generate it they'll just match up sequentially and loop the list of victory and defeat. Also added a shuffle button :)

https://github.com/powercat/Star-Ruler-2-Orchestra.txt-generator/releases/tag/1.1

OlivierGagnon avatar Jul 28 '18 03:07 OlivierGagnon

Just wanted to add a note. Using the songs on poVoq's page, I suffered frequent crashes.

So I used winlame to re-convert the ogg to static bitrate ogg and it resolved the crashing issue.

There must have been something in the files that wasn't compatible. Maybe the fancy ogg stuff like album art, etc.

OlivierGagnon avatar Jul 28 '18 23:07 OlivierGagnon

Could you share your re-encoded files somewhere?

ethchest avatar Jul 30 '18 12:07 ethchest

I've uploaded them at the same github page as the playlist generator I wrote, you can grab it from release: https://github.com/powercat/Star-Ruler-2-Orchestra.txt-generator/releases

OlivierGagnon avatar Jul 31 '18 01:07 OlivierGagnon