Mod Archive Forums

Community => Project / Coder's Corner => Topic started by: nixtrix on December 29, 2015, 17:10:21

Title: Best way to render each note of a mod to separate wavs?
Post by: nixtrix on December 29, 2015, 17:10:21
Hi! (tl;dr: read only paragraph 3)

I'm working on a rhythm-based music game similar to Guitar Hero, in which when the player hits keys, the sounds of the music happen. To give you an idea of how this works, here's a video of a game I'm inspired by (https://youtu.be/IXQxYeq2hbY?t=70) (actual gameplay starts at 1:10). Notice how when the player doesn't hit the notes bang on, the notes sound a little out of time.

To do this, the file format for the game's music files (BMS file format) requires each different sound made by a key press in a separate wav (or ogg) file -- that means different pitches too. Extremely inefficient I know, but it gets the job done.

Anyway, I'm getting sick of converting all of my mod files note by note, so I want to write a program that will build up a table of each note played at each pitch, export them one-by-one as wavs, and build up a BMS file with all the notes in place ready for me to just move them about to make the note chart. What would be the best way to do this? What libraries/existing programs would you recommend I look at first? Ideally I'd like to use as few libraries and external dependencies as possible. If someone can provide me with just a general idea of how to do it then the actual implementation shouldn't be too hard - I just don't want to write something hideously overcomplicated and inefficient.

Cheers for reading!
Title: Re: Best way to render each note of a mod to separate wavs?
Post by: Saga Musix on December 29, 2015, 17:28:42
I don't think any of the popular module player libraries can do channel by channel export. However, you could for example use libopenmpt to read out the pattern data, and then use set_channel_mute_status (https://lib.openmpt.org/doc/classopenmpt_1_1ext_1_1interactive.html#a4aca685550ce5adb7a525d45f4872861) of the libopenmpt_ext interactive extension to render each channel separately by muting all the other channels.
Title: Re: Best way to render each note of a mod to separate wavs?
Post by: zzo38 on December 31, 2015, 04:09:57
Actually, my own "playmod" can do individual channel export as well as individual instrument export. All formats supported by libmodplug can be used. There is currently no way to convert individual notes though (but maybe you can find a way to modify it to do so).

But you could also to export the instruments and then to play them back, maybe. (Many programs can export instruments.)

Still a program could be made to figure out which notes of which instruments are played, and to export only those tones; but then there may be the difficulty also involved when special commands are used to alter each note, then it can become more complicated.

Do you have the document of BMS format?