MIDI clock questions

MusE is a DAW for Linux with both MIDI and Audio editing. https://muse-sequencer.github.io

Moderators: MattKingUSA, khz, spamatica

Post Reply
User avatar
DecAgnts
Established Member
Posts: 5
Joined: Sat Jan 18, 2020 11:55 pm
Location: Chicago

MIDI clock questions

Post by DecAgnts »

Usually, I use sample-based drums from programs like Hydrogen and drumkv1.

But I also have a Yamaha RX7 drum machine, and it's nice to be able to sync the drum machine's sequencer to the computer. I have tried to make the drum machine slave to Muse, but it seems to lose time, gradually unsyncing itself as its quarter notes lag further and further behind Muse. Slaving Muse to the drum machine behaves even worse.

MIDI clock seems to work great in Ardour, but for several reasons, I'd prefer not to sequence in Ardour. (It's a very nice DAW though, of course.) I also find the prospect of Jack-syncing Ardour to Muse just so Ardour can provide MIDI clock, while I do my actual sequencing in Muse, to be a bit convoluted and worth avoiding. (In other words, I'd really prefer not to run a Jack-synced Ardour session along with my Muse session just to get MIDI clock out of Ardour.) But I mention all this just to demonstrate that, whatever is wrong here, Ardour's MIDI clock seems to be coping with it, because my RX7 slaves to Ardour MIDI clock just fine.

It looks like even when Muse is connected to a running jackd, Muse sends and receives MIDI clock through raw ALSA -- in other words, it does not seem to use Jack MIDI for MIDI clock. Ardour seems to do the opposite, with all MIDI traffic of any kind going through jackd. Is there a way for Muse to do MIDI clock through Jack? Is it possible that not using Jack for MIDI clock could be leading to timing issues in Muse?

For what it's worth, I've seen similar sync issues with MIDI clock in Seq24, another program which seems to only use Jack for syncing with other programs, but using raw ALSA for MIDI. I don't know if any of this is relevant, but I'm just trying to find out what's going on here. Has anyone else seen this?
spamatica
Established Member
Posts: 573
Joined: Mon Feb 08, 2010 10:38 am
Has thanked: 80 times
Been thanked: 97 times

Re: MIDI clock questions

Post by spamatica »

Hi DecAgnts,

I think I lack the hardware to make any more advanced analysis so I will just report on a little test I did. It appears to me that MusE Can send midi clock to jack.

Here's what I tried.
Started Jack and MusE.
Open the Midi sync tab in MusE, find a midi device in the list that is jack based, in my case jack-midi-0
Find the column that says tc (tooltip says Send midi clock output) and click the circle to make it green.

I then used a midi utility called midisnoop, selected jack and this device whereupon it continuously reports Midi Clock messages until I disable the green circle in the Midi sync settings in MusE.

So it appears to me that part should work, whether it helps in your case we will need to find out.
MusE DAW
User avatar
DecAgnts
Established Member
Posts: 5
Joined: Sat Jan 18, 2020 11:55 pm
Location: Chicago

Re: MIDI clock questions

Post by DecAgnts »

Thanks, will try that. I previously tried to do clock over Jack and failed, and I even saw a post somewhere that said Muse's MIDI clock features require a regular ALSA port, but I'll experiment more with it.
spamatica
Established Member
Posts: 573
Joined: Mon Feb 08, 2010 10:38 am
Has thanked: 80 times
Been thanked: 97 times

Re: MIDI clock questions

Post by spamatica »

For the record I did my test with bleeding edge MusE.
It's possible the version you tried didn't have all the bells. Not sure when midi sync was last worked on.
MusE DAW
User avatar
DecAgnts
Established Member
Posts: 5
Joined: Sat Jan 18, 2020 11:55 pm
Location: Chicago

Re: MIDI clock questions

Post by DecAgnts »

I experimented more, and it turns out that Muse running MIDI clock through a Jack port works perfectly, just as well as MIDI clock in Ardour, provided the computer is the time master. I'm still getting bad results trying to slave to the drum machine, but it doesn't matter to me that much which side is the master, as long as it's working, so this is solved for my purposes. I think I took the wrong conclusions from another post I read about this somewhere, that said Muse will not do MIDI clock if there are no raw ALSA ports defined, to mean you actually need to be using the raw ALSA ports for your MIDI clock. Maybe the defined regular ALSA ports just need to exist in your Muse configuration.

Note that Seq24 doesn't seem to have any other way of doing it (besides raw ALSA), so there still isn't a solution for that program other than Jack-syncing Seq24 to Muse or Ardour and letting the other sequencer take care of MIDI clock for it. Muse and Ardour seem to both be capable of good clock time through Jack though.
spamatica
Established Member
Posts: 573
Joined: Mon Feb 08, 2010 10:38 am
Has thanked: 80 times
Been thanked: 97 times

Re: MIDI clock questions

Post by spamatica »

Glad it worked!

As for why ALSA raw does not work, another possibility is that it is a driver issue. What midi device and alsa version are you using?

Would be good if someone else with an external sequencer could try to recreate these issues.
MusE DAW
Tim E. Real
Established Member
Posts: 667
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 38 times
Been thanked: 107 times

Re: MIDI clock questions

Post by Tim E. Real »

Please see:
https://github.com/muse-sequencer/muse/issues/661

See my last two comments there, about an outstanding clock bug - still TO BE FIXED.

It means that the clock is indeed generated on Jack outputs - but only if the 'ALSA' button is checked ! Dumb bug, I know.
It also means our Jack output clocks tend to be 'bunched together' because they are driven by our ALSA timer,
so overall accuracy is good (correct number of total clocks) but individual note accuracy may suffer.
In this scenario, a smaller Jack buffer size will help since the clocks are (wrongly) bunched together in each Jack audio cycle.
So a shorter audio cycle will help deliver the clocks at the correct times.
(It turns out that this bug is very complicated to fix.)

Meanwhile our ALSA devices' midi clock output should work just fine. Let me know if any trouble.

It is for those reasons that I recommend, for now, using our ALSA midi devices if precise external clocking output is desired.
You should be able to reasonably confidently trust all of our ALSA midi supported features :wink:

There is also some useful info about using the sync dialog, in that post.

Hope that helps and clears up my recent slightly inaccurate comments as well, in issue #920.
spamatica
Established Member
Posts: 573
Joined: Mon Feb 08, 2010 10:38 am
Has thanked: 80 times
Been thanked: 97 times

Re: MIDI clock questions

Post by spamatica »

Hi Tim,
Tim E. Real wrote: Thu Jan 14, 2021 12:29 am ...It is for those reasons that I recommend, for now, using our ALSA midi devices if precise external clocking output is desired.
But in this case it seems to be ALSA that is misbehaving, see the initial mail. So I'm wondering if it could be a driver issue.
MusE DAW
Post Reply