Discussion:
[Ardour-Users] Ardour as a midi timecode slave
robertlazarski
2021-04-19 17:51:16 UTC
Permalink
Hello again. Back in 2018 I received some help regarding linear timecode
(LTC). I've used Ardour for pre-production since and on various forums I
have often recommended it.

Also in 2018 I created a YouTube channel for my "live in the studio" videos
via 3 Tentacle Sync LTC audio feeds into 3 Zoom Q8 cameras and a Zoom F8
recorder.
https://www.youtube.com/user/robertlazarski/videos?sort=dd&shelf_id=0&view=0

My day job is programming and I ended up creating the videos automatically
with less than 1000 lines of bash code that invokes ltcdump and FFMPEG.

https://drive.google.com/file/d/1fFZVZFEVCN3Ie1VQcdM5K_6c_rPQAuZA/view?usp=sharing

The disadvantage of my workflow is that it lacks easy overdubs - in my case
just one shot samples and triggering MIDI sequencers on and off for some
short audio.

I have an idea for using Ardour to skip the need for overdubs by triggering
it
during the performance for sample playback and short midi sequences.

This may or may not make sense - can Ardour help my use case?

1) An Ambient NanoLockit unit is the master sending midi timecode (MTC)
starting at 00:00:00:00, going into Linux via a m-audio Uno. I may convert
the LTC from the Zoom F8 BNC out to MTC via an MOTU unit instead.

2) At exactly the 2 minute mark and 5 minute timecode mark(just an example)
, a one shot sample is triggered from Ardour indicating the performance
start and finish.

3) During the performance, at exactly the 3 and 4 minute timecode marks
some type of Linux sequencer is started. 10 seconds later it is stopped.

Thanks for reading!
Chris Caudle
2021-04-19 19:46:56 UTC
Permalink
Post by robertlazarski
I have an idea for using Ardour to skip the need for overdubs by
triggering it
during the performance for sample playback and short midi sequences.
Something like Linux Show Player might be better for single shot sample
playback:
https://www.linux-show-player.org/

I'm not sure that it can sync to timecode though, you might have to send
MIDI trigger messages. But something like that which is made for
sequencing sound cues for theater might be closer to what you are
looking for.
--
Chris Caudle
robertlazarski
2021-04-24 23:16:19 UTC
Permalink
Post by Chris Caudle
Post by robertlazarski
I have an idea for using Ardour to skip the need for overdubs by
triggering it
during the performance for sample playback and short midi sequences.
Something like Linux Show Player might be better for single shot sample
https://www.linux-show-player.org/
I'm not sure that it can sync to timecode though, you might have to send
MIDI trigger messages. But something like that which is made for
sequencing sound cues for theater might be closer to what you are
looking for.
--
Chris Caudle
Thanks for the link. I looked at the code and docs. I couldn't easily
figure out if it can slave over midi. I need automation during recording
i.e. no UI. To be honest I am more comfortable with C/C++ instead of
Python.

I did however stumble across ltctrigger. It does exactly what I imagined I
needed in my first post in this thread via C system calls:

"
[linux-fesf(robert)]
/home/robert> cat jt.conf
01:22:58:00 /usr/bin/mplayer /home/robert/star.mp4
[linux-fesf(robert)]
/home/robert> /usr/local/bin/jltctrigger -vF jt.conf
Parsing 'jt.conf'.. 1 entries.
#1 @7978.00 '/usr/bin/mplayer /home/robert/star.mp4'
Cannot lock down 86611866 byte memory area (Cannot allocate memory)
Warning: Can not lock memory.
Cannot use real-time scheduling (RR/5)(1: Operation not permitted)
JackClient::AcquireSelfRealTime error
# running /usr/bin/mplayer /home/robert/star.mp4
MPlayer 1.2.r38008-Packman-7 (C) 2000-2017 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing /home/robert/star.mp4.
"

Two questions:

1) Staying on topic, can I execute ardour stop / play commands with system
calls? Just curious what I can do.

2) Via a jltctrigger system call I need to send midi start / stop with midi
clock to an external sequencer that doesn't support MTC or MMC (Genoqs
Octopus). Google isn't showing much that is recent. Can you recommend the
right tool for the job?

Thanks!
Robert
Paul Davis
2021-04-24 23:43:54 UTC
Permalink
Post by robertlazarski
1) Staying on topic, can I execute ardour stop / play commands with system
calls? Just curious what I can do.
"system calls" is normally a term that describes what a program does it
when needs to get some sort of the service from the operating system.

I do not think that you mean that. I think you mean using a terminal
window and typing commands there.

So your actual question is probably "can I send commands to ardour, from
the command line, somehow?" The answer to that question: you can, using
OSC. It's all described in at manual.ardour.org under "Control Surfaces".
You will need a tool to send OSC commands ... "oscsend" is a common one.
Post by robertlazarski
2) Via a jltctrigger system call I need to send midi start / stop with
midi clock to an external sequencer that doesn't support MTC or MMC (Genoqs
Octopus). Google isn't showing much that is recent. Can you recommend the
right tool for the job?
I don't think that there are any well known tools that will let you send an
MIDI Song Position Pointer message (start and stop are not MIDI clock).
THere are perhaps some low level tools that could write a few bytes to a
MIDI port.You also do this in most scripting languages in a few lines.

I hope you realize that sending start/stop will not provide synchronization
between the sequencer and the LTC source: that would require continuous
delivery of MIDI Clock messages, and they have absolutely nothing to do
with LTC at all.
robertlazarski
2021-04-25 18:36:42 UTC
Permalink
Post by Paul Davis
Post by robertlazarski
1) Staying on topic, can I execute ardour stop / play commands with
system calls? Just curious what I can do.
"system calls" is normally a term that describes what a program does it
when needs to get some sort of the service from the operating system.
I do not think that you mean that. I think you mean using a terminal
window and typing commands there.
So your actual question is probably "can I send commands to ardour, from
the command line, somehow?" The answer to that question: you can, using
OSC. It's all described in at manual.ardour.org under "Control Surfaces".
You will need a tool to send OSC commands ... "oscsend" is a common one.
Yes indeed. This command worked great: oscsend osc.udp://localhost:3819
/transport_play
Post by Paul Davis
Post by robertlazarski
2) Via a jltctrigger system call I need to send midi start / stop with
midi clock to an external sequencer that doesn't support MTC or MMC (Genoqs
Octopus). Google isn't showing much that is recent. Can you recommend the
right tool for the job?
I don't think that there are any well known tools that will let you send
an MIDI Song Position Pointer message (start and stop are not MIDI clock).
THere are perhaps some low level tools that could write a few bytes to a
MIDI port.You also do this in most scripting languages in a few lines.
I hope you realize that sending start/stop will not provide
synchronization between the sequencer and the LTC source: that would
require continuous delivery of MIDI Clock messages, and they have
absolutely nothing to do with LTC at all.
Thanks for the info. Some of my sequencers support SPP (Korg Oasys) and
some don't (Genoqs Octopus). They all require a continuous midi clock when
slaved in order to set the BPM.

My alternative to Linux and LTC is an expensive midi stomp pedal (Step
Audio Status + optional pedal is $400) that has a midi clock generator.
Yet's it not practical to get several of them for multiple devices.
Compared to my feet, anything would be a step up in timing tightness.

I already have an instrument switcher stomp pedal for my Oberkorn analog
sequencer as simply breaking the gate signal will suffice. I have midi
lighting plans. So I have outgrown pedals for performance control. I need
automation and already have LTC for my cameras.

Where Jack may be able to help me, is Bar:Beats:Ticks info (BBT). I found
jack_midi_clock that is a 700 line C project on github.

I am green on Linux audio. I don't have a midi interface yet so I am in the
proof of concept stage. I ran this command but nothing is happening -
jack_mclk_dump is in another shell. Connections look good in qjackctl.

/usr/local/bin/jack_midi_clock --bpm 120 jack_mclk_dump:mclk_in

I tried a few Linux sequencers: Rosegarden, after I enabled jack and midi
it only showed midi connections in the qjackctl alsa pane, not the midi
pane. So I couldn't connect jack_midi_clock to it. And seq24, I couldn't
get it to show anything in jack. I couldn't figure out how to sync
aplaymidi with midi clock.

Nevertheless, I am still encouraged by what jltctrigger and oscsend do as
the equivalent of that is what I was hoping to find in the nearly 40 year
history of LTC / midi hardware but never found it.

Thanks!
Robert
Ralf Mardorf
2021-04-25 19:43:27 UTC
Permalink
Post by robertlazarski
it only showed midi connections in the qjackctl alsa pane, not the
midi pane
Hi,

the MIDI tab is for jack MIDI and the ALSA tab is for ALSA MIDI.
Actually connecting to external MIDI hardware is done via ALSA MIDI.
Depending on the used setup, you need to bridge jack and ALSA MIDI.
Keyword "a2j_control", while it's not the one and only universal
keyword. However, there are a few questions, are you using jack1 or
jack2 and what version of jack1 or jack2? Even if you should be able to
connect all MIDI devices, MIDI jitter could be, but not necessarily be
another issue. And apart from this, if you should use several equal MIDI
devices, automatically connecting could become a PITA. While you can
make it possible to distinguish between several identical audio
devices, there's no way to do the same for MIDI devices.

Your approach, as far as I understand or misunderstand it, is asking for
trouble. If it's impossible to use the
one_DAW/sequencer_only+plugins_approach, then at least try to
reconsider, if time code sync, let alone clock sync, is a reasonable
solution.

The reply from Chris Caudle mentions another approach, that seemingly
doesn't fit to your needs. Maybe you should describe what you actually
want to archive, by describing the real scenario.

Regards,
Ralf
--
“Awards are merely the badges of mediocrity.”

― Charles Ives
robertlazarski
2021-04-25 20:21:55 UTC
Permalink
Post by Ralf Mardorf
Post by robertlazarski
it only showed midi connections in the qjackctl alsa pane, not the
midi pane
Hi,
the MIDI tab is for jack MIDI and the ALSA tab is for ALSA MIDI.
Actually connecting to external MIDI hardware is done via ALSA MIDI.
Depending on the used setup, you need to bridge jack and ALSA MIDI.
Keyword "a2j_control", while it's not the one and only universal
keyword. However, there are a few questions, are you using jack1 or
jack2 and what version of jack1 or jack2? Even if you should be able to
connect all MIDI devices, MIDI jitter could be, but not necessarily be
another issue. And apart from this, if you should use several equal MIDI
devices, automatically connecting could become a PITA. While you can
make it possible to distinguish between several identical audio
devices, there's no way to do the same for MIDI devices.
Your approach, as far as I understand or misunderstand it, is asking for
trouble. If it's impossible to use the
one_DAW/sequencer_only+plugins_approach, then at least try to
reconsider, if time code sync, let alone clock sync, is a reasonable
solution.
The reply from Chris Caudle mentions another approach, that seemingly
doesn't fit to your needs. Maybe you should describe what you actually
want to archive, by describing the real scenario.
Regards,
Ralf
--
“Awards are merely the badges of mediocrity.”
― Charles Ives
_______________________________________________
Ardour-Users mailing list
http://lists.ardour.org/listinfo.cgi/ardour-users-ardour.org
Thanks for the reply. Here's what I am trying to accomplish.

I have a youtube channel that captures "live in the studio" multi camera
performances that are synced with LTC. Nearly all of my gear is analog,
even my sequencers. Up until now, my sequencers have run the entire track
from start to finish.

For my track in progress, I am using the Analogue Solutions Oberkorn for
the main sequencer. After the intro and for the first verse only I want to
start and then a few seconds later stop arguably the most ambitious
hardware midi sequencer in history - the Genoqs Octopus. To start the track
and finish the track I want to run a short sample.

Midi start and stop on the Octopus as a slave requires a continuous midi
clock to set BPM. Midi jitter and timing perfection isn't that important as
the sequence is short. So I need a midi clock generator. And possibly
several midi clock output connections, for future expansion.

Ardour can handle the sample parts with oscsend via jltctrigger. I can run
midi commands from jltctrigger. Getting a midi clock generated via jack is
my current problem to overcome. Before I buy a midi interface, I am testing
with Linux sequencers to see if they can be slaved to start/stop on the bpm
from the jack_midi_clock project.

I am using Jack2 1.9.12. I have been on OpenSuse since 2003 so that's my
distro for now, on leap 15. The other approach suggested was a Python
project - not one of my languages and it has no Jack support.

Thanks!
Robert
robertlazarski
2021-04-29 21:15:01 UTC
Permalink
Post by Ralf Mardorf
Post by robertlazarski
it only showed midi connections in the qjackctl alsa pane, not the
midi pane
Hi,
the MIDI tab is for jack MIDI and the ALSA tab is for ALSA MIDI.
Actually connecting to external MIDI hardware is done via ALSA MIDI.
Depending on the used setup, you need to bridge jack and ALSA MIDI.
Keyword "a2j_control", while it's not the one and only universal
keyword.
So I made some progress connecting jack_midi_clock to Rosegarden using
'a2jmidid -e' - I think that may be the equivalent of 'a2j_control start' .
With the jack transport off in Rosegarden, it accepted midi start / stop
though as expected it didn't sync BPM.

I have two problems still:

1) I need to automate the jack "rolling feature" via command line
execution, i.e. the play button in the qjackctl UI. That will start/stop
the transport in Rosegarden via jack_midi_clock start / stop commands. I
couldn't figure out how to automate the play button. Even without qjackctl
I am not sure how to start/stop jackd rolling from the command line. Any
pointers?

2) I am trying to do everything on the command line without qjackctl. I
started jackd with my user account as "/usr/bin/jackd -dalsa -dhw:USBPre2
-r48000 -p1024 -n2 -Xseq " . Then I executed jack_mclk_dump, then
"/usr/local/bin/jack_midi_clock --bpm 42 jack_mclk_dump:mclk_in" . Then
'a2jmidid -e' , then Rosegarden.

Where I am stuck is on the right syntax for a2j_control to map
jack_midi_clock:mclk_out to "rosegarden [131] (playback): record in". I
think I need the mj2a flag? Please see my qjackctl session.xml file. I am
about to buy a m-audio Uno midi interface and I am trying to figure out how
to use a2j_control to connect jack_midi_clock to it as an ALSA device since
I expect the Uno to connect to Linux over ALSA.

<!DOCTYPE qjackctlSession>
<session name="qq">
<client name="system">
<port type="out" name="capture_1">
<connect port="record in 1 L" client="rosegarden"/>
</port>
<port type="out" name="capture_2">
<connect port="record in 1 R" client="rosegarden"/>
</port>
<port type="in" name="playback_1">
<connect port="master out L" client="rosegarden"/>
</port>
<port type="in" name="playback_2">
<connect port="master out R" client="rosegarden"/>
</port>
<port type="out" name="midi_capture_1"/>
<port type="in" name="midi_playback_1"/>
<port type="in" name="midi_playback_21"/>
<port type="out" name="midi_capture_34"/>
<port type="out" name="midi_capture_35"/>
</client>
<client name="rosegarden">
<port type="out" name="master out L">
<connect port="playback_1" client="system"/>
</port>
<port type="out" name="master out R">
<connect port="playback_2" client="system"/>
</port>
<port type="out" name="record monitor out L"/>
<port type="out" name="record monitor out R"/>
<port type="in" name="record in 1 L">
<connect port="capture_1" client="system"/>
</port>
<port type="in" name="record in 1 R">
<connect port="capture_2" client="system"/>
</port>
<port type="in" name="record in 2 L"/>
<port type="in" name="record in 2 R"/>
</client>
<client name="jack_mclk_dump">
<port type="in" name="mclk_in">
<connect port="mclk_out" client="jack_midi_clock"/>
</port>
</client>
<client name="a2j">
<port type="out" name="Midi Through [14] (capture): Midi Through Port-0"/>
<port type="in" name="Midi Through [14] (playback): Midi Through Port-0"/>
<port type="in" name="rosegarden [131] (playback): record in">
<connect port="mclk_out" client="jack_midi_clock"/>
</port>
<port type="out" name="rosegarden [131] (capture): sync out"/>
<port type="out" name="rosegarden [131] (capture): out 1 - General MIDI
Device"/>
</client>
<client name="jack_midi_clock">
<port type="out" name="mclk_out">
<connect port="mclk_in" client="jack_mclk_dump"/>
<connect port="rosegarden [131] (playback): record in" client="a2j"/>
</port>
</client>
</session>
Paul Davis
2021-04-29 21:17:46 UTC
Permalink
Post by robertlazarski
1) I need to automate the jack "rolling feature" via command line
execution, i.e. the play button in the qjackctl UI. That will start/stop
the transport in Rosegarden via jack_midi_clock start / stop commands. I
couldn't figure out how to automate the play button. Even without qjackctl
I am not sure how to start/stop jackd rolling from the command line. Any
pointers?
jack_transport(1)
Post by robertlazarski
2) I am trying to do everything on the command line without qjackctl. I
started jackd with my user account as "/usr/bin/jackd -dalsa -dhw:USBPre2
-r48000 -p1024 -n2 -Xseq " . Then I executed jack_mclk_dump, then
"/usr/local/bin/jack_midi_clock --bpm 42 jack_mclk_dump:mclk_in" . Then
'a2jmidid -e' , then Rosegarden.
Where I am stuck is on the right syntax for a2j_control to map
jack_midi_clock:mclk_out to "rosegarden [131] (playback): record in". I
think I need the mj2a flag? Please see my qjackctl session.xml file. I am
about to buy a m-audio Uno midi interface and I am trying to figure out how
to use a2j_control to connect jack_midi_clock to it as an ALSA device since
I expect the Uno to connect to Linux over ALSA.
a2j_control is a decoy. It does nothing but start a2jmidid (and without any
arguments which is a problem if you need/want -e)

"to map PORT-A to PORT-B" is odd language. I assume you mean connect?
robertlazarski
2021-04-29 21:39:41 UTC
Permalink
Post by Paul Davis
Post by robertlazarski
1) I need to automate the jack "rolling feature" via command line
execution, i.e. the play button in the qjackctl UI. That will start/stop
the transport in Rosegarden via jack_midi_clock start / stop commands. I
couldn't figure out how to automate the play button. Even without qjackctl
I am not sure how to start/stop jackd rolling from the command line. Any
pointers?
jack_transport(1)
I am running Jack2 1.9.12 on OpenSuse leap 15 and I don't have
jack_transport installed. Should I compile the latest jack from source?
Also, I have some type of python version problem on my system maybe with
the commands I do have:

[linux-fesf(robert)]
/home/robert> jack_control
File "/usr/bin/jack_control", line 80
print 'shit'
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean
print('shit')?
Post by Paul Davis
Post by robertlazarski
2) I am trying to do everything on the command line without qjackctl. I
started jackd with my user account as "/usr/bin/jackd -dalsa -dhw:USBPre2
-r48000 -p1024 -n2 -Xseq " . Then I executed jack_mclk_dump, then
"/usr/local/bin/jack_midi_clock --bpm 42 jack_mclk_dump:mclk_in" . Then
'a2jmidid -e' , then Rosegarden.
Where I am stuck is on the right syntax for a2j_control to map
jack_midi_clock:mclk_out to "rosegarden [131] (playback): record in". I
think I need the mj2a flag? Please see my qjackctl session.xml file. I am
about to buy a m-audio Uno midi interface and I am trying to figure out how
to use a2j_control to connect jack_midi_clock to it as an ALSA device since
I expect the Uno to connect to Linux over ALSA.
a2j_control is a decoy. It does nothing but start a2jmidid (and without
any arguments which is a problem if you need/want -e)
"to map PORT-A to PORT-B" is odd language. I assume you mean connect?
Terminology is important, and now I see that I spend too much time at my
day job using nmap. I mean I need to connect the jack_midi_clock output to
the Rosegarden a2j external controller input, like I expect I will need to
do for a hardware midi interface.
Paul Davis
2021-04-29 22:01:11 UTC
Permalink
Post by robertlazarski
Post by Paul Davis
Post by robertlazarski
1) I need to automate the jack "rolling feature" via command line
execution, i.e. the play button in the qjackctl UI. That will start/stop
the transport in Rosegarden via jack_midi_clock start / stop commands. I
couldn't figure out how to automate the play button. Even without qjackctl
I am not sure how to start/stop jackd rolling from the command line. Any
pointers?
jack_transport(1)
I am running Jack2 1.9.12 on OpenSuse leap 15 and I don't have
jack_transport installed. Should I compile the latest jack from source?
Also, I have some type of python version problem on my system maybe with
probably a packaging issue.
Post by robertlazarski
Terminology is important, and now I see that I spend too much time at my
day job using nmap. I mean I need to connect the jack_midi_clock output to
the Rosegarden a2j external controller input, like I expect I will need to
do for a hardware midi interface.
jack_connect can do it; qjackctl's patchbay feature can do it. for example,
i have the patchbay set up to always connect VCV Rack outputs
appropriately, since it does not do that itself.
robertlazarski
2021-04-30 02:16:57 UTC
Permalink
Post by Paul Davis
Post by robertlazarski
Post by Paul Davis
Post by robertlazarski
1) I need to automate the jack "rolling feature" via command line
execution, i.e. the play button in the qjackctl UI. That will start/stop
the transport in Rosegarden via jack_midi_clock start / stop commands. I
couldn't figure out how to automate the play button. Even without qjackctl
I am not sure how to start/stop jackd rolling from the command line. Any
pointers?
jack_transport(1)
I am running Jack2 1.9.12 on OpenSuse leap 15 and I don't have
jack_transport installed. Should I compile the latest jack from source?
Also, I have some type of python version problem on my system maybe with
probably a packaging issue.
I was able to compile the latest jack (including removing the distro libs)
and a2jmidid from source ... the latter was my first introduction to meson
though I figured it out.
Post by Paul Davis
Post by robertlazarski
Terminology is important, and now I see that I spend too much time at my
day job using nmap. I mean I need to connect the jack_midi_clock output to
the Rosegarden a2j external controller input, like I expect I will need to
do for a hardware midi interface.
jack_connect can do it; qjackctl's patchbay feature can do it. for
example, i have the patchbay set up to always connect VCV Rack outputs
appropriately, since it does not do that itself.
I was able execute this successfully: jack_connect
jack_midi_clock:mclk_out "a2j:rosegarden [130] (playback): [0] record in"

jack_transport does exactly what I want via the start / stop commands.
However it is an interactive shell program. I want to execute each
jack_transport command with a background process at a timed interval using
jltctrigger (also for Adrour and OSC), for discussion purposes identical to
execution in crontab. Does jack_transport have to be interactive? I have
done some "expect" language interactive shell programming but thought i'd
ask.

Thanks!
Robert
Paul Davis
2021-04-30 02:43:48 UTC
Permalink
Post by robertlazarski
jack_transport does exactly what I want via the start / stop commands.
However it is an interactive shell program. I want to execute each
jack_transport command with a background process at a timed interval using
jltctrigger (also for Adrour and OSC), for discussion purposes identical to
execution in crontab. Does jack_transport have to be interactive? I have
done some "expect" language interactive shell programming but thought i'd
ask.
echo 'play' | jack_transport
echo 'stop' | jack_transport
robertlazarski
2021-04-30 02:57:50 UTC
Permalink
Post by Paul Davis
Post by robertlazarski
jack_transport does exactly what I want via the start / stop commands.
However it is an interactive shell program. I want to execute each
jack_transport command with a background process at a timed interval using
jltctrigger (also for Adrour and OSC), for discussion purposes identical to
execution in crontab. Does jack_transport have to be interactive? I have
done some "expect" language interactive shell programming but thought i'd
ask.
echo 'play' | jack_transport
echo 'stop' | jack_transport
Perfect!

All in background processes I was able to (a) start / stop ardour via OSC,
and (b) play / stop Rosegarden with incoming midi clock and midi System
Real-Time Messages using the jack_midi_clock program that sends messages
when controlled by jack_transport play / stop.

Thanks a lot to everyone who helped.
Robert

Loading...