zynthian / zynthian-issue-tracking

Centralized Issue Tracking for Zynthian Project
https://github.com/orgs/zynthian/projects/1
11 stars 3 forks source link

MIDI clock not transmitted over USB #359

Open gr0k-net opened 3 years ago

gr0k-net commented 3 years ago

Describe the bug When using ZynStep + a MIDI clock generator layer and connecting to a MIDI controller programmed to read from an external MIDI clock (for things like note-repeat and arpeggios) clock messages are submitted over MIDI DIN, but NOT USB.

I have tested this behavior in three different ways, by confirming the MIDI clock is sent via MIDI DIN, by confirming the same controller does NOT sync to the host clock when using the same layer setup with a USB->MIDI DIN adapter, and by confirming that a different native USB controller does not sync to the external clock when plugged directly into USB.

I am not sure if this issue relates to the clock generator, or ZynStep, or the Zynthian itself, hence creating this new topic.

To Reproduce Steps to reproduce the behavior:

Expected behavior

Setup: Brand new SD card with fresh 2020-09-05 stable image updated 2021-02-22:

zyncoder: master (ef24e0e) zynthian-ui: master (9696069) zynthian-sys: master (6d93662) zynthian-data: master (2028b5d) zynthian-webconf: master (45bcb08)

Controllers tested: Akai MPD32 Akai MPK Mini MK2

Edit: I have just verified that external clock sync works when using my MPK Mini MK2 in Reaper on Linux, so we can rule out a faulty device.

jofemodo commented 3 years ago

Have you enabled the USB port for MIDI out from the webconf "MIDI options->ports" tab?

https://wiki.zynthian.org/index.php/Configuration_Users_Guide#Ports

gr0k-net commented 3 years ago

Route MIDI to Output Ports was already checked, but I noticed that the MIDI output for the MPK had been deselected so I re-enabled it and saved, but it didn't work, so I restarted the GUI, still no dice. I restarted with the MPK plugged in, still no dice.

Checking in the webconf again, the MPK had been de-selected as an output port on either the UI or device reboot. I selected it again, this time it seemed to work! Well, I can now play time-synced note-repeats and arpeggios, but the arpeggio light is behaving unusually, a minor thing tho.

I unplug the device and plug it back in to see if it fixes the arpeggio light, and ALL time-synced operations stop working again! Flicking back to webconf, I notice something interesting. The device name has changed, and it is no longer selected. I have now seen the device referred to as either:

a2j:MPKmini2[28](playback):_MPKmini2_MIDI_1 OR MPKmini2_MIDI_1

Perhaps depending on if it was plugged in on boot. I re-enable the device as an output and save again. It once again doesn't work, but after restarting with the device plugged in and re-enabling again in webconf, it does.

It seems like the MPK only works when it is plugged in on boot and named MPKmini2_MIDI_1. Based on the device names I'm wondering if this has something to do with a2jmidid not transmitting clock messages or something? But this is way beyond my knowledge of things, so I'm totally guessing.

If I hadn't verified that my MPK works correctly on my computer I would be suspecting that right now, but I remember now that I've also experienced the same issues with a known-good USB->MIDI adapter. I've got to get some work done today so can't keep playing but I will do some more experimenting with the USB->MIDI adapter and see if its device name changes likewise, and if I can get it working by booting with it connected.

For reference, I updated again before testing this morning using my fresh stable build image on new SD using master:

zyncoder: master (ef24e0e) zynthian-ui: master (9696069) zynthian-sys: master (b953240) zynthian-data: master (2028b5d) zynthian-webconf: master (d57e6e2)

gr0k-net commented 3 years ago

Just commenting again regarding my previous message. I have tried again with some USB->MIDI cables, and can confirm that the MIDI clock is transmitted via that device only when the following is true:

The Zynthian will not transmit a MIDI clock once unplugged and plugged back in, or plugged in after boot, regardless of mappings set. It may be that it is not transmitting ANY MIDI message, but I haven't figured out a way to test that atm as the Zynthian is my only instrument, all other devices have been borrowed.

To me this appears to be related to a2jmidid, as it is only when a device DOESN'T have an a2jmidid name/id that MIDI clock is transmitted. If a2jmidid has named the device, it will not work.

This behaviour seems consistent across devices and branches (MPK, MPD, USB->MIDI on zynseq & master)

riban-bw commented 3 years ago

Related to #zynthian/zynthian-ui/issues/115. Related to #zynthian/zynthian-issue-tracking/issues/392.