Re-Play music converter & player

Page 1/2
| 2

By Grauw

Ascended (10768)

Grauw's picture

11-04-2022, 21:01

Hi folks,

A few years ago I made a music converter and player for ASM’s Ghosts ’n Goblins port, which I posted about here.

The player format is based on a stream of register writes, which is efficient in terms of CPU processing speed, but less efficient in terms of data size. Nevertheless the resulting data sizes are not bad, and it’s certainly usable for MegaROM games, possibly also disk games.

Since then I’ve been toying with the thought of making a framework to build more converters and players like that, and when Norakomi asked for a similar player for the OPL4, I started working on exactly that.

The resulting project is called Re-Play, and it currently supports OPL4, OPM, OPNA and OPNB. The sources can be found on SourceHut.

If you have general questions, or interest in using it, or are looking at doing something similar in a project but using different sound chips, or need some modifications before it’s usable for you, feel free to reply here.

Login or register to post comments

By Grauw

Ascended (10768)

Grauw's picture

11-04-2022, 21:27

The converter takes VGM files as input, giving you freedom to use various tools to author the music.

It is then processed to an optimized output format. For MoonSound it also aggressively optimises away register writes which can be avoided, which improves both playback speed and data size.

I’m not sure if the converter’s code is really very accessible for others to contribute to, some of the transforms get pretty complicated, but feel free to look at the code and let me know your thoughts.

I also have future plans to add CFG compression (see prior discussion here) which can reduce the data size at a relatively low CPU overhead, and without need for a decompression buffer. Hence the presence of Call and Return commands and a stack, even though those are currently unused.

By Manuel

Ascended (19469)

Manuel's picture

11-04-2022, 21:09

Just curious: how hard is it to support stuff like OPLL and MSX-AUDIO?

By Grauw

Ascended (10768)

Grauw's picture

11-04-2022, 23:04

It’s a bit of work but not very difficult. An OPLL + PSG format is high on the wishlist.

A lot of the necessities for MSX-AUDIO are already in the OPL4 code since it is compatible. OPL1 music can already be converted and played on MSX-AUDIO by changing the I/O ports in MoonSound.asm and adding a few extra waits. Support for ADPCM would need to be added.

By Parn

Paladin (837)

Parn's picture

11-04-2022, 22:27

That's all very interesting, since it opens the window to the possibility of using PC trackers to make MSX music, since some of them can export to VGM. I know there are already some trackers that can be used to make MSX music, but they are mostly limited to PSG right now.

By Haze

Master (151)

Haze's picture

12-04-2022, 12:40

Not only is a wider range of development tools very attractive, the built-in support for otherwise lesser used soundchips could make those physical carts very attractive. It was already impressive for GnG, but very welcome to see as a separate project!

I see some notes about quirks specific to GnG music data. Is that something composers can keep in mind and work with/around, with the current state of the code? Just from the top of my head, I can't imagine any existing trackers or tools that write VGMs would adhere to these quirks, if it is that specific?

By ARTRAG

Enlighted (6935)

ARTRAG's picture

12-04-2022, 14:31

Thanks Grauw! Gooing to try it asap

By Grauw

Ascended (10768)

Grauw's picture

12-04-2022, 18:19

Parn wrote:

That's all very interesting, since it opens the window to the possibility of using PC trackers to make MSX music, since some of them can export to VGM. I know there are already some trackers that can be used to make MSX music, but they are mostly limited to PSG right now.

Yeah for sure. For example there’s DefleMask for OPM, OPN2 and OPNB, and BambooTracker for OPNA, Reality Adlib Tracker for OPL3, etc.

Any tracker running in an emulator can be used too, with the emulator’s VGM recording functionality. For example, Oracle never had a replayer as far as I know, but you could use it with Re-Play (pending the addition of PSG / OPLL / MSX-AUDIO support).

Trackers on running other systems could also be used, for example Adlib Tracker II for MS-DOS.

Haze wrote:

I see some notes about quirks specific to GnG music data. Is that something composers can keep in mind and work with/around, with the current state of the code? Just from the top of my head, I can't imagine any existing trackers or tools that write VGMs would adhere to these quirks, if it is that specific?

You are referring to the remark about note frequency being set after the key-on? Nothing to worry about, it was specific to GnG, and normally trackers wouldn’t do that, so the transform that addressed that GnG issue will be a no-op for others.

As for the OPN format being optimised for GnG, that game only rarely changes instrument settings (including volume) and most often just does key-off/on events, so it’s currently optimised for that. However when music often changes frequency or individual instrument parameters such as volume, the data size will become unnecessarily large. That’s something I’ll adjust later, if someone indicates interest in using it. Then I can also add SSG support, which GnG doesn’t use so I never added it.

By Parn

Paladin (837)

Parn's picture

12-04-2022, 20:35

I recently found out Furnace, which was originally an open source DefleMask clone but aims to support many more sound chips in a more flexible way. Its development version already supports the OPL family up to OPL3, and MSX-AUDIO and SCC are in the works. It already supports many of the sound chips available on MSX, including Darky's EPSG and SFG's OPM.

By Grauw

Ascended (10768)

Grauw's picture

12-04-2022, 20:47

Nice tip! What always bothered me in Deflemask is that it had fixed chip combinations, so you could not combine e.g. YM2413 and PSG or YM2151 and PSG. Looks like this new spinoff takes care of that!

By thegeps

Paragon (1189)

thegeps's picture

14-04-2022, 15:42

Nice project!

Page 1/2
| 2