Author Topic: Utilizing libopenmpt in Games for Dynamic/Interactive Music?  (Read 1348 times)

Offline rchrdcrg

  • Shy artist
  • Posts: 9
Hello folks! So I've got a bit of a question!

I see there's a library that can be used for playback, but I'm no programmer, and lately I've been curious just what is libopenmpt capable of? Is it merely for playback, or could it be tied into variables in a game that would allow for more precise control such as:
-Volume/mute of channels
-Jumping to different patterns on cue
-Changing volume/effect/vst commands based on data from the game

If any of that is possible, let's just say I can dream up some truly amazing things you could do with that!

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 7,146
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
Re: Utilizing libopenmpt in Games for Dynamic/Interactive Music?
« Reply #1 on: August 17, 2019, 01:15:47 »
Most of that is possible with the library, except for manipulating pattern data (which I guess your third point refers to). libopenmpt does not handle plugins and that would certainly not be a very useful feature for games anyway, as redistributing VST plugins is often not trivial (and more importantly you typically don't have the permission to do so with many plugins).
If you're seriously interested in what is possible and how it can be done, the documentation for each API function can be found at
« Last Edit: August 17, 2019, 01:19:52 by Saga Musix »
ยป No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline rchrdcrg

  • Shy artist
  • Posts: 9
Re: Utilizing libopenmpt in Games for Dynamic/Interactive Music?
« Reply #2 on: August 17, 2019, 15:37:58 »
Awesome, thanks! Yeah, I didn't even really think about VST in depth before blurting it out... makes sense! I'm interested in exploring dynamic soundtracks for games in more detail than what most games do. Usually a dynamic soundtrack is just different prerecorded tracks that are faded in and out based on something simple like location/action, or maybe certain notes and effects are tied to actions and correspond to a beat, such as Rez, but I wanted to take it a step further and basically hand over some of the "composition" to the game itself with the objective that the music would be unique to every playthrough. Perhaps the game design could even be worked around this so that better skill equals better music, as if the player feels like a musician but by playing something unrelated like a Geometry Wars clone or something.

Offline LPChip

  • Administrator
  • *****
  • Posts: 5,104
  • Operating System: Windows 10 Pro x64
Re: Utilizing libopenmpt in Games for Dynamic/Interactive Music?
« Reply #3 on: August 17, 2019, 22:30:28 »
If you are interested in procedural generated music (music that interacts with what happens in game), you should check out an indie game developer called Nifflas.

He uses Unity nowadays, and he created his own synthesizer in Unity, so he can have the music interact with what happens in-game. For example, in his latest game Knytt Underground, there is a section that is rhythm based, where you hear and see the music interact with the game very clearly.

Here's one of the examples of his earlier implementations: The character is forced to transform every beat. In later puzzles, the puzzles themselves transform their state based on the beat or musical events.

Here is an example of the synth he build for his upcoming project Ondskan: Everything you hear is generated by his synth and as you can see that he presses some buttons, those button presses could be an event in a game just as easily. For example, entering a room could add a synth section or change a parameter. For example, entering a cave could add a delay section to simulate reverb.
"Heh, maybe I should've joined the compo only because it would've meant I wouldn't have had to worry about a damn EQ or compressor for a change. " - Atlantis
"yes.. I think in this case it was wishful thinking: MPT is makng my life hard so it must be wrong" - Rewbs