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

Steve Harris S.W.Harris at ecs.soton.ac.uk
Fri Feb 14 10:26:01 UTC 2003


On Fri, Feb 14, 2003 at 09:28:42 -0500, Paul Davis wrote:
> >I'm trying to hack up a quick app that sends MIDI clock pulses in sync
> >with a ringbuffer playback.
...
> don't bet on it.

D'oh
 
> i've been thinking about this quite a lot recently. your best bet will
> be to set the sequencer to use the RTC as the clock source. i don't
> know how to do this. i'm not sure that even this will work, because
> the RTC doesn't run in sync with the audio, so it may drift over time.
> you don't have too many other choices, because there is no other timer
> source capable of providing sub-audio-period interrupts.

I'm not too worried about jitter (the device I want to sync is not
fussy), just that it tracks the ringbuffer with exactly 24 pulses per cycle.

What I can't figure out how to do is contrust the MIDI byte, I've got:

    snd_midi_event_t *midi_parser;
    snd_seq_event_t seq_pulse;

    snd_midi_event_new(128, &midi_parser);
    snd_seq_ev_set_subs(&seq_pulse);
    snd_seq_ev_set_direct(&seq_pulse);
    snd_midi_event_encode_byte(midi_parser, 0xF8, &seq_pulse);
    snd_seq_ev_set_source(&seq_pulse, portid_out);
    snd_seq_event_output_direct(seq_handle, &seq_pulse);

But it doesn't appear to do anything.
 
> there will still be the question of whether the app should do the
> timing, and use the sequencer/rawmidi to do immediate delivery, or if
> the kernel-side of the sequencer will be hacked to support this.

Well in this case I care about syncronisation far more than timing.

- Steve



More information about the Linux-audio-dev mailing list