MIDI Time Code synchronization working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

MIDI Time Code synchronization working

ccrraaiigg

Hi--

        I wanted to record MIDI events in synchrony with my multi-track audio
recorder, so I wrote a MIDIRecorder which chases the MIDI Time Code that
the audio recorder puts out. I interpolated the SMPTE quarter-frame
messages that MTC uses (every 1/120 second) into 1ms slices for
timestamps. I recorded an accelerating drum roll as audio and MIDI and
played them back together; they stayed in phase within 1ms. Cool!

        The MIDIRecorder also does the right thing with the MIDI Machine
Control messages that the recorder puts out. I already wrote support for
a control surface (the MotorMix), so it should be fun to put it all
together.


-C

--
Craig Latta
improvisational musical informaticist
www.netjam.org
Smalltalkers do: [:it | All with: Class, (And love: it)]


Reply | Threaded
Open this post in threaded view
|

Re: MIDI Time Code synchronization working

Brad Fuller
Craig Latta wrote:

>
> Hi--
>
>     I wanted to record MIDI events in synchrony with my multi-track
> audio recorder, so I wrote a MIDIRecorder which chases the MIDI Time
> Code that the audio recorder puts out. I interpolated the SMPTE
> quarter-frame messages that MTC uses (every 1/120 second) into 1ms
> slices for timestamps. I recorded an accelerating drum roll as audio
> and MIDI and played them back together; they stayed in phase within
> 1ms. Cool!
>
>     The MIDIRecorder also does the right thing with the MIDI Machine
> Control messages that the recorder puts out. I already wrote support
> for a control surface (the MotorMix), so it should be fun to put it
> all together.
that's cool.
How's the precision at 1ms? That's pretty small. You could probably
increase that to 4ms or even 8ms and not notice a difference.


Reply | Threaded
Open this post in threaded view
|

re: MIDI Time Code synchronization working

ccrraaiigg

Hi Brad--

 > How's the precision at 1ms?

        It's good. When I play back a mono drumroll recording with digital
audio in one ear and synced MIDI in the other, it still sounds like mono
the whole way through. :)

 > That's pretty small. You could probably increase that to 4ms or even
 > 8ms and not notice a difference.

        Mostly I wanted to see if Squeak could do this at maximum MIDI
full-note resolution (3 bytes per event, 31250 bits per second, 8 data
bits, 1 start bit and 1 stop bit per byte, which is 938 microseconds per
event, or about a millisecond).

        I was curious to see how things degraded at lower resolutions, and
actually played around with larger gradations. I could tell the
difference on headphones, listening to direct MIDI-to-audio phase
comparisons of drumrolls, but just about everything I do in practice is
much less demanding than that. :)  But this works, and the code is
simpler with a 1ms basis (since the host OS and host midi driver have
millisecond clocks); might as well not spend time doing arithmetic to
support a lower resolution.

        One weird thing I noticed is that sometimes MMC messages slightly lag
the onset or cutoff of associated MTC messages. I guess I need a
hardware MIDI packet sniffer to see what's really going on (is the
weirdness in the audio recorder, the host OS, or the host MIDI driver),
but with my recorder implementation it's not a problem anyway.


-C

--
Craig Latta
improvisational musical informaticist
www.netjam.org
Smalltalkers do: [:it | All with: Class, (And love: it)]