KimJorgensen / KungFuFlash

Cartridge for the Commodore 64 that packs a punch
zlib License
405 stars 62 forks source link

Feature request: USB port for MIDI #149

Open hippi-viking opened 2 years ago

hippi-viking commented 2 years ago

I was wondering if it would be possible to use the USB port for MIDI in-output while outside of the firmware menu. It would make a lot of sense for ex. Prophet64 and would replicate the function of the Kerberos cartridge quite well. (I don't know how helpful it might be but there is an ARM-based cart for this, though it is wired differently than what is considered to be the standard.)

KimJorgensen commented 2 years ago

It sounds like something that could be done, but I don't have much experience in this area.

Which MIDI interfaces does Prophet64 support? I can only find a reference of an interface that is connected to the user port, which does not correspond to what your refer to as the standard.

On the PC side, should the USB port show up as a different device (something other than a serial port)? And which software would it make sense to use here?

hippi-viking commented 2 years ago

It sounds like something that could be done, but I don't have much experience in this area.

Sounds promising! :) Sadly I am not very experienced either, I know a bit of the musical side, a bit of MIDI history, and getting into STM32 programming just recently. I will try to help nevertheless if needed! It might help: I have an OwlPedal (which uses a similiar STM32F405 microcontroller as the KungFuFlash - though it runs FreeRTOS instead of baremetal), that has USB-MIDI implemented (source here).

Which MIDI interfaces does Prophet64 support? I can only find a reference of an interface that is connected to the user port, which does not correspond to what your refer to as the standard.

Sorry, I mixed up the Prophet64 with the MSSIAH cartridge, the Prophet had no built-in MIDI interface indeed. There are sadly no standard MIDI solutions for the C64, as the computer predates the MIDI specifications (hence the emphasis in the original post). The most supported MIDI cartridge at the moment seems to be the one made by Datel.

On the PC side, should the USB port show up as a different device (something other than a serial port)? And which software would it make sense to use here?

On the PC side for compatibility I think the best solution for the cartridge to show up would be a class compliant MIDI interface (new spec here, old spec here) - which is essentially a glorified serial port traditionally running at 31250 baud. It should then work with hardware or software synths/audio workstations of any kind. (My use case would be using the C64 as a synthesizer with Cynthcart or Station64 driving it from a separate hardware sequencer.)

mwedmark commented 1 year ago

With a software bridge as for example this: https://projectgus.github.io/hairless-midiserial/ I think the last idea seem promising, thus just open the serial port for this and use it both ways. This would be a really intereseting project to implement. It does not include any new hardware and also not new drivers for USB I guess. The hairless also seem to handle latency issues and buffer up/out to support different baud rates which in that case make it even simpler, just use anything faster f.e. 115200. Only downside that this solution always include a computer in between (C64 and synths/racks), but I guess that could be a small PI-Zero?

hippi-viking commented 1 year ago

@mwedmark It sounds like a good compromise / first step. I don't know (yet) how difficult it is to implement USB host mode on the STM32F405 - and how problematic it is to switch to device mode when in the firmware menu (for the KungFuFlash and the connected equipment!) -, so a USB host (which could very well be a RasPI) would be needed anyway at least while host mode can be implemented on the KungFuFlash to connect MIDI equipment. The downside is of course the added complexity.

hippi-viking commented 1 year ago

I just found this library, which seems to be a great candidate. I don't know yet how to interface it with the C64 though.

alexrepp commented 9 months ago

Hello all, did you made any progress in KKF as a USB-MIDI-Adapter? That would be great as hell for every damn USB-MIDI-Device :) Personally found a working Prophet64 wich is really working from 1541 (sadly not from SD2IEC) and would be so great (at all) to connect a USB-Keyboard without wasting several bucks for an interface - and don't even find a USB-MIDI-Interface ... as i understand you'll need an usb to midi converter further on ? So - any chance to make a KKF "the worlds famoust" low budget C64 USB-MIDI-Interface ??? Hopefully, Alex

hippi-viking commented 8 months ago

Hi Alex,

Sadly I didn't have much time, I am still learning to program the STM32. But there is a lot of hope, and quite a few of ready-made libraries to make it happen! I can't promise an ETA, but it is on my backlist to make the KFF a Midi interface one day.

You would need an USB-DIN adapter if you intend to use a Midi keyboard/device with the oldschool round plugs - which adapter could also be an STM32.

alexrepp commented 8 months ago

Hi Hippi-Viking, thanks for the response and good to hear :) I don't have oldschool round plugs (anymore) - just two USB Keyboards. Seen a TeensyROM Cartridge some days ago, where it seems to be realized with that USB-MIDI ... but am totally out of money this times :/ and would really be a burner at that KFF :) Best wishes, Alex

hippi-viking commented 8 months ago

Hey Alex,

That's a good find. The MIDI-part of Teensy firmware should be relatively easy to port to KFF. I'll have a look, but don't promise anything as I'm still very new to this all. The good news is that it is definitely possible to make the KFF a MIDI adapter.

SensoriumEmbedded commented 8 months ago

Hope you'll give me credit if you do that. ;)
Might want to check out all the TeensyROM unique capabilities. :) Not putting down KFF at all, it's a great cart, just think there are complementary features.