rhargreaves / mega-drive-midi-interface

Control the Sega Mega Drive's Yamaha YM2612 and PSG with MIDI
GNU General Public License v3.0
96 stars 8 forks source link

DAC Sample and Expanded Ch. 3 Support? #34

Open Esmerea opened 8 months ago

Esmerea commented 8 months ago

Hello! I just stumbled into this and it looks very promising for some of the music work I'd like to do.

Are there any plans for this software to support sample playback on FM channel 6 or the extended channel modes on 3?

Thank you!

rhargreaves commented 8 months ago

I am planning on implementing those, eventually! I haven't had a lot of time recently, but might have more time in the coming weeks. The 'extended ch 3 support' would most likely be the simpler feature to implement at this time (although no doubt would introduce some complexity to the codebase, so I would need to spend some time ensuring its clean)

DAC sample support would likely require some Z80 code, although a first attempt might be to lean on SGDK's PCM support as much as possible.

A question hanging over both of these features is how much compatibility with GenMDM's interface I would be considering. Generally, since that is the more popular solution, I try to keep this interface inline with it as much as possible, unless I have good reason to deviate.

Out of curiosity, does the music work you're looking to do require since GenMDM compatibility (for either Ch3 "special mode" or DAC)?

KPY7030P commented 6 months ago

@rhargreaves This is one of the best projects I've seen related to SEGA. I hope you won't abandon it or someone will support and develop it. I don't really understand such complex programming, otherwise I would have helped with this)

2xAA commented 5 months ago

Since DAC support was quite limited with GenMDM and custom samples are something people ask me about all the time with genMDM Editor, I’d love to see MDMI have better sample support than GenMDM ever did.

And personally, I’d love to use samples myself in my own music made with the Mega Drive.

rhargreaves commented 5 months ago

Implemented limited support for Ch. 3 Special Mode in v1.16 More support is coming, including visual feedback and handling of MIDI Note On Velocity on channels 11-13.

rhargreaves commented 4 months ago

So I'm pretty much done with everything I wanted to implement for Ch 3. Special Mode support. I'm starting to think a bit more about DAC support.

My currently approach is to find an open source percussion set, and add a feature to use PCM percussion for General MIDI channel 10. I'll make use of SGDK's built-in ability to include the samples as compile-time resources. As for playback, I'll start with support for one voice at a time using SGDK's sound driver. We'll see how that goes. I'm not sure the timing resolution will be great - I have a feeling the SGDK driver updates on vertical blanking which would mean there could be a delay of up to 17-20ms before playback. It would be great also if we could mix 2 samples on the fly but that will be contingent on how the drivers otherwise perform.

Eventually I will look into ways of importing samples into the interface at runtime. I probably will not emulate the GenMDM API for this. It seems quite limited. Instead, I will opt for some mechanism to import sample data over SysEx. We'll see though!

KPY7030P commented 4 months ago

do you think it is possible to send an audio signal in real time (even with a delay) in order to use the DAC as an audio gadget? for example, connect a microphone and shout "SEEEGAAA" ahahaha I probably want a lot and fantasize a lot, but suddenly it's possible)

rhargreaves commented 4 months ago

@KPY7030P probably not using MIDI - there's too much complexity and overhead.

For fun, a while back I did write a proof of concept that allowed me to send PCM audio directly to the EverDrive X7 USB port and have the DAC play it in realtime: https://github.com/rhargreaves/mega-drive-usb-link/blob/master/src/pcm.c

Anyway, I'm still experimenting with DAC support in the interface. Seems like there might be more Z80 bus/SGDK PCM driver hand-holding required which is making implementation non-trivial.