Fork of DMF2ESF (Deflemask to Echo converter)

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
User avatar
BigEvilCorporation
Very interested
Posts: 205
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Fork of DMF2ESF (Deflemask to Echo converter)

Post by BigEvilCorporation » Tue Nov 24, 2015 12:25 am

Hi!

I've forked the dmf2esf tool (by TheMvRules) to make some updates and improvements, since I couldn't get it to convert one of my DMF files or figure out what to do with the instrument dumps:

https://github.com/BigEvilCorporation/dmf2esf

Changes made so far:

- Outputs .EIF instrument files
- Serialisation refactor
- Supports DMF v11 format files
- Visual Studio Community 2013 SLN file
- A few bug fixes I found along the way

Use the -i option to output instruments.

Not tested yet:

- Other compilers
- PSG
- Samples
- Loops
- DMF file versions other than v11

I'll be working on it as and when I need the features, and I'll post updates here.
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

User avatar
BigEvilCorporation
Very interested
Posts: 205
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by BigEvilCorporation » Sun Jun 05, 2016 8:09 pm

Update:

- Added support for the new Deflemask DMF 12 file format (ID 0x18)
- Fixed PSG support
- Added support for PCM sample conversion and export
- Fixed the PCM "note on" offset (PCM samples should be included at the end of the Echo instrument pointer table).

I've been using the Green Hill Zone sample track included with Deflemask for testing, and it's all sounding great!

Sample rate conversion uses libsamplerate/Secret Rabbit Code, see http://www.mega-nerd.com/SRC. I *think* the GPLv1 and GPLv2 licenses are compatible.

I've also noticed that the text ASM output is broken, I haven't had time to track the problem down though. Binary export is all fine.
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

User avatar
Sik
Very interested
Posts: 842
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by Sik » Sun Jun 05, 2016 11:04 pm

...what is still using GPLv1? That one got phased out really quickly.
Sik is pronounced as "seek", not as "sick".

Manveru
Very interested
Posts: 72
Joined: Wed Sep 05, 2012 3:30 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by Manveru » Tue Oct 02, 2018 9:14 pm

BigEvilCorporation wrote:
Sun Jun 05, 2016 8:09 pm
Update:

- Added support for the new Deflemask DMF 12 file format (ID 0x18)
- Fixed PSG support
- Added support for PCM sample conversion and export
- Fixed the PCM "note on" offset (PCM samples should be included at the end of the Echo instrument pointer table).

I've been using the Green Hill Zone sample track included with Deflemask for testing, and it's all sounding great!

Sample rate conversion uses libsamplerate/Secret Rabbit Code, see http://www.mega-nerd.com/SRC. I *think* the GPLv1 and GPLv2 licenses are compatible.

I've also noticed that the text ASM output is broken, I haven't had time to track the problem down though. Binary export is all fine.
I have tested it with the Deflemask 12 Green Gill Zone track and Echo 1.62, but i get bad sound with the samples and with one of the three PSGs in that track. I tested Echo engine with GenRes sample tracks and it sounds well, so any help will be very appreciated.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

User avatar
BigEvilCorporation
Very interested
Posts: 205
Joined: Sat Sep 08, 2012 10:41 am
Contact:

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by BigEvilCorporation » Wed Oct 03, 2018 2:37 pm

Manveru wrote:
Tue Oct 02, 2018 9:14 pm
BigEvilCorporation wrote:
Sun Jun 05, 2016 8:09 pm
Update:

- Added support for the new Deflemask DMF 12 file format (ID 0x18)
- Fixed PSG support
- Added support for PCM sample conversion and export
- Fixed the PCM "note on" offset (PCM samples should be included at the end of the Echo instrument pointer table).

I've been using the Green Hill Zone sample track included with Deflemask for testing, and it's all sounding great!

Sample rate conversion uses libsamplerate/Secret Rabbit Code, see http://www.mega-nerd.com/SRC. I *think* the GPLv1 and GPLv2 licenses are compatible.

I've also noticed that the text ASM output is broken, I haven't had time to track the problem down though. Binary export is all fine.
I have tested it with the Deflemask 12 Green Gill Zone track and Echo 1.62, but i get bad sound with the samples and with one of the three PSGs in that track. I tested Echo engine with GenRes sample tracks and it sounds well, so any help will be very appreciated.
I think the SRC stuff was temporarily commented out a while back due to a problem (and we were authoring all of our samples to the target rate on Tanglewood anyway) - might be worth commenting that back in. It was left in a bit of a mess after TW since there was a last minute rush to fix bugs and get the game shipped.

As for the PSG thing, does it use the PSG 3+4 mode? I'd need to debug it and see but I don't have a development environment set up right now (transitioning to a new project).

I'm very happy to help here though, if someone's up for doing the investigative work.
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

Manveru
Very interested
Posts: 72
Joined: Wed Sep 05, 2012 3:30 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by Manveru » Wed Oct 03, 2018 3:24 pm

BigEvilCorporation wrote:
Wed Oct 03, 2018 2:37 pm
I think the SRC stuff was temporarily commented out a while back due to a problem (and we were authoring all of our samples to the target rate on Tanglewood anyway) - might be worth commenting that back in. It was left in a bit of a mess after TW since there was a last minute rush to fix bugs and get the game shipped.

As for the PSG thing, does it use the PSG 3+4 mode? I'd need to debug it and see but I don't have a development environment set up right now (transitioning to a new project).

I'm very happy to help here though, if someone's up for doing the investigative work.
Thanks Matt.

You made a good work with Tanglewood, i hope i can use Echo as well as you did.

Green Hill uses 3 PSG channels, 1, 2 & 4 according to Deflemask and KMod debugger.

I hope someone can help us. We need some stuff to convert from a tracker to Echo, and Deflemask + your converter seems to be the best chance.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

SeregaZ
Newbie
Posts: 7
Joined: Mon Aug 03, 2015 12:45 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by SeregaZ » Sun Dec 02, 2018 2:53 pm

o! in a past i am trying to convert from deflemask into GEMS too :) but i curse all deflemask's effect with pitchs or slides, or how it names.

original:
https://youtu.be/osf7nBq5Nxo

convert:
https://www.youtube.com/watch?v=QLzbrE0jXtU

User avatar
aguSoulReaver
Interested
Posts: 12
Joined: Sat Mar 10, 2018 4:02 am
Location: Buenos Aires, Argentina

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by aguSoulReaver » Sun Dec 16, 2018 2:49 am

Manveru wrote:
Wed Oct 03, 2018 3:24 pm
I hope someone can help us. We need some stuff to convert from a tracker to Echo, and Deflemask + your converter seems to be the best chance.
Hi. I made an app to convert DMF to Echo's format. It's call "DefleMask Convert" and it's in the Tools section. You should try it.
16 Bits Forever, Forever, Forever...

Manveru
Very interested
Posts: 72
Joined: Wed Sep 05, 2012 3:30 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by Manveru » Sun Dec 23, 2018 11:05 am

aguSoulReaver wrote:
Sun Dec 16, 2018 2:49 am
Manveru wrote:
Wed Oct 03, 2018 3:24 pm
I hope someone can help us. We need some stuff to convert from a tracker to Echo, and Deflemask + your converter seems to be the best chance.
Hi. I made an app to convert DMF to Echo's format. It's call "DefleMask Convert" and it's in the Tools section. You should try it.
Thanks for your work mate, i discovered your project some days ago and i am following it hoping your conversor can implement all the effects our musician needs.
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by KillaMaaki » Mon Dec 24, 2018 3:22 am

Having a ton of trouble getting this to work.
Here's a simple test case that is, for some reason, totally failing to work.

It's just a bassline that plays on one channel. Attached the DMF file and the resulting ESF file. In every single emulator I've tried, the first note is totally silent. From debugging the YM state in Regen, it appears that Echo is ignoring the set instrument command even though I can absolutely see the command when I open it in a hex editor.

If I force DMF2ESF to output a set instrument command for every single note on, then the first note is still totally silent, but then every subsequent note is audible again. Seems like somehow Echo is always ignoring the *first* set instrument command?? I have no idea why this would be the case.

Also, I can move this bassline to any channel and it still fails, but if I then duplicate it across two channels, one of those channels plays correctly.

Anyone have any clue what might be the culprit here? Maybe a weird bug/edge case in Echo?

EDIT: Strange, inserting an entire empty pattern at the start of the song fixes it but in this case it also skips that entire pattern which is odd.

Also, fun fact, noticed that 17XX commands are processed in the wrong order in the converter, if you insert a 17XX command on the same line as a note on it should process the 17XX command BEFORE it processes the instrument change of that row (the block of code that sets "DACEnabled" should come before the block of code that processes instrument changes, but instead it comes just after)

EDIT 2: Oh, it seems you also want to issue note off commands for the DAC if you issue a 1700 command. If there's still a sample playing when you try and do a subsequent FM note, it won't sound right because Echo will keep playing the DAC sample until it is finished. Issuing an explicit note off for the DAC channel when it encounters a 1700 command appears to fix this issue.

EDIT 3: Nvm that blank pattern hack no longer works. That was on a custom version of Echo's Z80 core that changed the tickrate, moved back to the original Z80 blob with the 60HZ tickrate and this hack no longer works (bassline is gone from my song again, sigh.)

EDIT 4, electric boogaloo: A hack that DOES work is inserting a pattern at the beginning that has nothing but a single note on with a *different* instrument and immediately breaks to the next pattern with D00. Seems to force it to update the instrument properly for some reason?
Attachments
TestDMF.zip
Contains DMF and resulting ESF + INS
(735 Bytes) Downloaded 21 times

KillaMaaki
Very interested
Posts: 84
Joined: Sat Feb 28, 2015 9:22 pm

Re: Fork of DMF2ESF (Deflemask to Echo converter)

Post by KillaMaaki » Mon Dec 24, 2018 9:59 pm

Alright so here's a list of fixes I've found so far that I really just ought to turn into a pull request, and may do later:
  1. Move the code that sets DACEnabled based on 17XX commands to before the code that processes instrument changes.
  2. Force a note off for the PCM channel when processing a 1700 command
  3. Fix for ESFOutput::SetRegisterBank0 and ESFOutput::SetRegisterBank1: it mistakenly appends a uint16_t to the out stream for the command byte, which turns into an ASCII string of the number "248" and breaks a bunch of stuff. Change this to a uint8_t, and further these functions are not appending the register value to write to ( should be "ESFFile << esfcmd << reg << value;" )
  4. Fix for PCM conversion: the code that calls OutputSample should be passing true for convertFormat (it currently passes false and always treats samples as if they are 8-bit 10.65khz even when they aren't). Additionally, the code that converts 16-bit samples should be casting the samples to signed int16_t values before it casts them to a float, otherwise it will produce bad results
EDIT: Note that #3 appears to also fix the weird bug with ignoring the set instrument command. Seems like this particular bug breaks a lot of stuff actually.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests