MIDI Clock sync comes to Ardour 3.0

Although Ardour 3.0 is not yet ready for serious testing, it is the subject of some cool development work. Hans Baier just added support for MIDI Clock sync, which means that Ardour’s transport can now slave to you MIDI sequencing hardware/software without relying on more sophisticated (and better, but less widely used) protocols like MIDI Machine Control or MIDI Time Code. Not only that, but Hans’ implementation, like our existing MTC slave code, syncs to the incoming signal amazingly fast. Here is an image to show just how fast:

The y-axis shows the distance ardour's transport moves each process cycle (sampling rate was 44100). The x-axis shows time in process cycles (1 process cycle = approx 5msec). If Ardour was perfectly in sync with the MIDI clock signal, this picture would show a flat line -every process cycle would move an identical distance. Instead, what it shows is Ardour getting in sync in 17 milliseconds and then remaining in sync with 1 frame of jitter thereafter. Congratulations to Hans for a great implementation and making it through having to understand my slave/master design within Ardour.

Thanks Hans…

This is very exciting news.

In fact this is the most exciting news I have heard all year…

To overcome the 17ms delay in syncing. I guess I’ll just add a bar of 1 beat long silence to my sequences before recording and start any new section recording a beat or 2 before the new part comes in… (actually my sequencer my be able to compensate for this anyway… will have to check)

With MusE not compiling on my gcc4.3.1 system (for core2 optimizations)and MusE2 not having MIDI implementation as yet this will get me back to where I was about a year back. I was using MusE to interpret the MIDI clock signals from my hardware sequencer and sync with Ardour via jack transport.

More recently, I’ve just been using the MMC feature, but with that I have only been able to start from the start of a sequence , scrolling through using the hardware sequencers transport did not keep ardour in sync and unfortunately it doesn’t support MTC. This simply wasted a lot of HD with a lot of silence being recorded.

Paul, let me know when you think this is in a good state for testing, as I’ll be keen to help get this feature implemented.

This offer also applies to the MIDI sequencing functionality, as long as it maintains 1 MIDI channel per MIDI track (i’ve seen discussion that suggested it wasn’t necessary… in a hardware based MIDI studio it’s critical, well in my studio it is) …

Thanks again

Allan K
sonofzev
current e.p (mixed with ardour) at http://www.elektraxrecordings.com/elek015.html
Melbourne Australia

There are still some problems:
The nastiest one is that somehow there is a slight difference
in the tempos of ardour and my keyboard, so ardour and
my keyboards accomp will diverge over time. I still have to
figure out where that difference comes from.
(It may be a problem in Ardour 3.0s still very fragile Jack MIDI implementation)

The other Problem which I blame on the MIDI implementation in Ardour3 is,
that the MIDI Clock slave gets totally messed up, if there are MIDI Tracks
in the session, but works fine when there are only audio tracks.

I hope I will fix those eventually, but as I have to
feed a family and only can work on it in my spare time,
this will take some time, so please be patient.

Kind regards,
Hans Baier

No problems with waiting. I understand completely.

Thankyou very much for your time and effort. I’m not a programmer (but am a software engineer… so am good at identifying bugs and testing systematically)… so if there is anyway I can help give me a yell.

it seems that there is a typo in pauls starting post (or hans’ blog).
on hans’ blog (ardourmidi.wordpress.com) 174ms are pointed out to get synced. paul writes that it takes only 17ms, and i think that’s a big difference. :slight_smile:

regards,
harald

Actually it is 30 cycles * 256 / 44100 = 0.174s,
but this probably may get better if I use a lower jack buffer period
(64 works for me…). The first time I published the chart on flickr, I admit I calculated it wrong, and paul got that version.

I had it on 256 during development, because I had a lot of debugging output enabled,
so Ardour wouldnt use the connection to Jack quite frequently.

allank: I surely could appreciate some help: If you can compile ardour
you can enable debugging output in libs/ardour/session_process.cc line 490 (#if 1)
recompile and then try to sync your machine and send me ardours output per mail.

(I use a shell script like that:

#!/bin/bash
 (gtk2_ardour/ardev /home/jack/Musik/Foo120 2> /tmp/log &)
 sleep 5
jack_connect system:midi_capture_2 ardour:control_in
 tail -f /tmp/log

to startup Ardour for MIDIClock tests (cwd: source dir of ardour), you may have to adapt it to your system)

Will try this coming weekend… maybe earlier…

One problem is that the script is not available (404 error)

can you post it… or email me sonofzev at iinet dot net dot au

Are there any plans for Ardour to send a Midi Clock signal at all? That would be really cool on OSX whilst using Reason, for example.

Yes, I actually plan to do that. The implementation will probably be much
simpler than the MIDI Clock slave.
But it will take some time until I have spare time to invest in Ardour again.

I just got the first working implementation of Ardour 3.0 sending MIDI clock,
see my blog: http://ardourmidi.wordpress.com

It doesnt handle loops yet correctly now, but I am about
to find out, whether MIDI clock slaves can handle that anyway:
(It doesnt look like that since http://jedi.ks.uiuc.edu/~johns/links/music/midispec.htm#Seq says, that song position messages are only to be sent
when the slave doesnt play)

Now it handles loops,

see: http://ardourmidi.wordpress.com

Hi

I’ve just compiled SVN tonight, however I can only see an option in the Sync menu to send MIDI clock, the option to receive doesn’t seem to be there. Is there something I need to do?

Also, I forgot to compile with debug, but with the MIDI clock send I get the following message before it crashes

ardour-3.0: libs/ardour/ticker.cc:171: void ARDOUR::MidiClockTicker::send_midi_clock_event(ARDOUR::nframes_t): Assertion `MIDI::JACK_MidiPort::is_process_thread()’ failed.
Aborted

Regards Allan

I’ve just compiled SVN tonight, however I can only see an option in the Sync menu to send MIDI clock, the option to receive doesn’t seem to be there. Is there something I need to do?
Also, I forgot to compile with debug, but with the MIDI clock send I get the following message before it crashes Thesis Writing

Beating 17ms delay, wow that’s very cool… This is a great contribution from Hans’s side. Ardour will get better support from MIDI lovers.

The nastiest one is that somehow there is a slight difference in the tempos of ardour and my keyboard, so ardour and my keyboards accomp will diverge over time. I still have to figure out where that difference comes from. I hope I will fix those eventually, but as I have to feed a family and only can work on it in my spare time, this will take some time, so please be patient. clubpenguin

hey thats great

how do you test it ?
I used to use the program midiclock (http://www.midiclock.com/ ) on windows.
Is there an alternative for linux ?