[linux-audio-dev] MIDI Clock and ALSA seq

Roger Larsson roger.larsson at skelleftea.mail.telia.com
Fri Feb 14 11:12:01 UTC 2003


On Friday 14 February 2003 16:18, Steve Harris wrote:
> On Fri, Feb 14, 2003 at 03:54:35 +0100, Roger Larsson wrote:
> > On Friday 14 February 2003 15:02, Steve Harris wrote:
> > > Hi all,
> > > 
> > > I'm trying to hack up a quick app that sends MIDI clock pulses in sync
> > > with a ringbuffer playback.
> > > 
> > > I've got it reading MIDI (thanks to Matthias' great exmaple code), but I
> > > cant figure out how to send MIDI clock pulses explicitly. The ALSA seq
> > > interface lets me set it up to go automatically, but I want to send a
> > > clock pulse every 1/24th of the buffer, so the sync is correct.
> > > 
> > 
> > How about dividing the buffer in 24 frames. And send one MIDI event each
> > frame? Doable?
> 
> That's exactly what I'm trying to do, but I can't figure out how to
> construct the midi clock event.
> 

Run with 24 frames and a frame size of (needed buffer / 24). 

Run this with sched fifo, etc...
Output 24 frames of silence. 

Write some more silent frames (it wont be accepted before one is free), send 
MIDI event for each. [Gives the MIDI device time to sync]

Write a frame of real data. Send MIDI event.  Repeat.

This would give you some jitter but the MIDI device should filter that.

/RogerL

-- 
Roger Larsson
Skellefteå
Sweden




More information about the Linux-audio-dev mailing list