rhargreaves / mega-drive-midi-interface

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

A GNU/Linux alternative for hairless-midiserial: ttymidi (patched by me) #28

Closed jaffa225 closed 2 years ago

jaffa225 commented 2 years ago

On GNU/Linux (debian) I first had trouble compiling hairless-midiserial, but after a few tweaks, got it to build. After that it still didn't see any of my MIDI interfaces to use to bridge with. Never one to give up, I looked at your code changes to it, and ported it to a more linux-native simple program: ttymidi. When that worked, I also decided to add support for standard MIDI 31250 baud rate (nonstandard serial baud, apparently), which Scott Baker had modified it for, and my own changes allowing SysEx output (although not SysEx input), to give my Roland MIDI modules another source from GNU/Linux. Of course, real USB MIDI is available on GNU/Linux for them.

Here's the source to share with anyone interested: ttymidi-mega-drive-midi-interface.tar.bz2

It's a simple program, which "make" will build (with a few compiler warnings), at least on my systems. It works great for the mega everdrive pro and your latest prebuilt ROM. Before knowing I'd need serial conversion, your mega-drive-midi-interface was the best excuse I had to buy the Mega EverDrive PRO, and now I'm truly enjoying it as much as I thought I would. Thanks for your great idea and its quality implementation!

Using the "-m" or "--megaeverdrivepro" option enables your Mega EverDrive PRO-required header.

By the way, are the MIDI instrument patches heard, custom coded by you, or are the sounds built-in and dictated by an API for the Genesis/Mega Drive?

Thanks again, it's been fun so far,

Lucas

rhargreaves commented 2 years ago

Hi Lucas,

Thanks for sharing your patched version of ttymidi! I'll give it go at some point. 😁

The MIDI instrument patches are based on Wohlstand's XG bank from libOPNMIDI. They are hardcoded in the build of the ROM. You can of course swap them out at compile-time. At some point I hope to support loading/saving of patches either to the SD card of a Mega Everdrive, or over the USB or serial port connection.

However, compile-time will do for now :)

You can compile in your own presets by using https://github.com/rhargreaves/deflemask-preset-viewer to generate the C code for a patch.

Hope that helps!

jaffa225 commented 2 years ago

You're quite welcome and I hope it is is of use for all other GNU/Linux Sega enthusiasts. I don't mind if you want to offer it as another choice in your wiki, assuming it passes your test. ;)

That's great to hear that the sounds are so customizable, although I am happy with your current XG default. I have mostly Roland (LA & GS) synths, but my one Yamaha XG synth is awesome too. XG (or Yamaha anyway) seems more related to the Genesis/Mega Drive, both of which have roots in FM synthesis. This is making me curious enough to try compiling a GS version, though.

Thanks for the detailed response!

jaffa225 commented 2 years ago

When you try ttymidi, don't forget that its ports are reversed from most ALSA MIDI programs: Its input port is 1, and its output is port 0, although you'll only need to connect its input to your hardware MIDI input (with aconnect or something compatible) or MIDI playing program (such as aplaymidi).

Here's an example for aplaymidi (just type what's within the quotes, but not the quotes themselves): Having already connected a USB cable from your computer to the mega everdrive pro, you can run "ttymidi -m -s /dev/ttyACM0" in one terminal window/tab. Then from another terminal window/tab it can be simply tested by running "aplaymidi -p 128:1 /$PATH_TO/$FILENAME.mid" ("aconnect -l" will list your MIDI ports if ttymidi isn't running at 128 like mine).

rhargreaves commented 2 years ago

I gave it go and it seems to work pretty well. I've added it as a suggested tool to use in the wiki. Thanks for the suggestion and efforts at making ttymidi compatible with the Mega EverDrive PRO 😁

jaffa225 commented 2 years ago

Thanks! I really appreciate that! Others will be able to find it now too. Also, I applaud your hosting of the source in github too!

I couldn't be more pleased. :) (Well, maybe if Microsoft ends ownership of github someday.)

Lucas