Dudejoe870 / godot-openmpt

A binding for libopenmpt (a sophisticated mod-tracker player library) for Godot 4.2. Can play .xm .s3m .it .umx and many other formats!
MIT License
23 stars 5 forks source link

VST in MPTM files, effects and instruments #1

Open GeminiSquishGames opened 5 months ago

GeminiSquishGames commented 5 months ago

MPTM files are pretty great and I'm glad you have them working. I've been looking for a solution like this since I love making small music for games in MPTracker and it's ancestors. I hope the Channel control (maybe row/order position control also?) are as trival as you say and I'll enjoy as much dynamic control of tracker files as I can get. Something I had a lot of control over a couple of decades ago with these types of files.

Now, we all know about MPTracker and that it uses this library for playback, but it's also a VST host. I'm not sure if that is a separate functionality to the libopenmpt library off the top of my head but I put together some free VST .dlls in the same folder as the .mptm file and while It works in the tracker it doesn't in the addon. It doesn't crash or error either, so that's good. I'm not too surprised. But if this is at all possible, it would be next level to have control over your own instruments in that way. Still I think having OPL synths working is pretty great, and they do work in .mptm with your addon, so some non-sampler, analog like synth is available and OPL is nice and retro, but it would be great to have a modern system of synth and effects working as well. Great work and keep it up.

Dudejoe870 commented 5 months ago

Glad you like it! I haven't worked on this in a bit, but really I kind of doubt that VST support is something that can happen unless libopenmpt supports it (VST hosting is an extremely difficult thing to do properly). However as far as row/channel controls and all of that, that's not all that complicated I could probably try to implement that. Currently the addon is quite literally just a wrapper around libopenmpt, and it exposes all of that stuff in a pretty easy interface already.

EDIT: I had actually already forgotten but the AudioMPTPlayback class should already have an overloaded version of seek with order/row functionality! I probably need to create a wiki. it also hasn't been tested so please do update if there are any issues. I'm looking into adding more control right now.

EDIT2: Just looked up the possibility of VST support and it says here that libopenmpt does in fact not support VSTs. Also taking a look at the the documentation, I'm not sure how the VST information is stored, it probably might be able to be retrieved but I have no idea. So I don't know how practical it is to implement it on top of libopenmpt anyway. Either way currently something like that is too big of a task for me to delve into. I will keep this issue open however with the possibility that it could be implemented some day.

GeminiSquishGames commented 5 months ago

Cool! I can still make a lot of use of it as is since I can keep track of the order, row, and patterns and seek them. I'm still trying to look and see which part of ModPlug Tracker is handling the VSTs but it's not as important as the game dev ATM. I can split an .mptm file into the parts to make it more dynamic playing them on different AudioStreamPlayers and buses, but having control of channel volumes and tempo would make it pretty complete. I also can extract the data and fiddle with it... as soon as I can find the full documentation of the .mptm file structure, then make realtime changes or procgen channel data at runtime like the good old days when I discovered the demoscene. Thanks again!

Dudejoe870 commented 5 months ago

I haven't really used the mptm format, but you might be able to also just use subsongs if you want and switch between them, if it supports them (instead of using multiple AudioStreams)

Dudejoe870 commented 5 months ago

FYI: New build is out. You can download it as an artifact in the actions tab. I'll also probably upload it to the prebuilt branch soon.

GeminiSquishGames commented 5 months ago

I haven't really used the mptm format, but you might be able to also just use subsongs if you want and switch between them, if it supports them (instead of using multiple AudioStreams)

True but what I mean is to have parts that I can play together that are in sync, a bit like stems. One contains the basic parts of the song, one contains the non-battle parts, and one contains the battle parts. For a simple example. Thanks for the heads up on the release!

ps: https://wiki.openmpt.org/Development:_OpenMPT_Format_Extensions - this is the wiki page that has info on the file structure for extensions, it has VST header data, maybe it's of use to you. I think it's mostly just .it format with the extra things like OPL and Plugins built in. They used to hack in these extensions in .xm and .it files but stopped and made it part of the official .mptm file format only. At any rate, anything you don't get to that I need I'll probably eventually try to get it going at some point, but I don't need VST that much I was just wondering if you may have looked into it. I'm a little surprised it doesn't just work as long as the settings point to the right location of the VSTs, but obviously, it's not that easy.

Dudejoe870 commented 5 months ago

Well I will also say that, most VSTs (even free ones) probably don't have licenses that allow redistribution at any rate, so packaging them into a game will probably be illegal.

GeminiSquishGames commented 5 months ago

True, also they often defeat the purpose of keeping the profile of the song data small if you use many of them, I mean, if you want to stay with the old-school tradition. I can still keep the filesize low with modern stems. Also, I've been messing with the StreamGenerator in the mono build of Godot, and it's quite powerful for generating a real-time signal. I tried poking around the data and real-time sample manipulation seems possible with your extension, you just have to stay within the original sample data size, or quickly expand/contract and replace all of the data after it, which is all a little tricky. I probably need to curb my enthusiasm and work on the game though so that'll be stuff I do when I'm burned out on other development.

On Thu, Apr 4, 2024 at 7:55 AM Dudejoe870 @.***> wrote:

Well I will also say that, most VSTs (even free ones) probably don't have licenses that allow redistribution at any rate, so packaging them into a game will probably be illegal.

— Reply to this email directly, view it on GitHub https://github.com/Dudejoe870/godot-openmpt/issues/1#issuecomment-2037138080, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHE6AAF6TO2HZUOG2BHJ43Y3VETFAVCNFSM6AAAAABFNK5MGOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZXGEZTQMBYGA . You are receiving this because you authored the thread.Message ID: @.***>