| Yes, I see.
But, to be more clear: I don't expect to synchronize Csounds internal
"clock", or Csound's own event scheduling.
I write my own clock functions (could be done in a Csound instr, but
currently I do this in Python), and I want to use the midi clock input
signal to increment my clock.
To my knowledge, midi clock ticks are sent 24 times per beat, so it is
pretty straightforward to have e.g. a phase counter being incremented
by 1/24 each time a tick is received, and when the phase counter
reaches 1 we have a full beat and reset the counter.
With sysex messages there could be any number of data bytes, but I
think that "system realtime" message like these only uses (max) two
data bytes (in fact, there's no data byte for clock start, stop, and
"tick").
This is what my midi monitor prints:
status data1 data2 chan note event
250 --- --- -- --- Start
248 --- --- -- --- Timing Clock
248 --- --- -- --- Timing Clock
248 --- --- -- --- Timing Clock
(more of these)
252 --- --- -- --- Stop
best
Oeyvind
2009/8/20 Andres Cabrera :
> Hi,
>
> There are two types of midi synchronization. One is MIDI clock (which
> counts in BB:BB:TT) and the other is MIDI Time Code (HH:MM:SS:FF).
> Both are sysex messages, so they are harder to parse than ordinary
> MIDI messages, and contain variable number of data bytes (many times
> there are more than two data bytes), and that's probably why they are
> being ignored by midiin.
> Synchronizing Csound to an external MIDI clock or MIDI time code is
> hard and I think it's not currently supported (the sequencer engine
> would have to be able to accomodate and follow time drifts in the
> incoming signal), that's why Csound offers clock out but not clock in.
>
> However, the alsa library (and probably the portmidi as well) has ways
> of dealing with sysex, so at least receving the data is possible.
>
> Cheers,
> Andrés
>
> On Thu, Aug 20, 2009 at 6:29 AM, Oeyvind Brandtsegg wrote:
>> Hello
>>
>> I tried to synchronize (tempo, timing) Csound to an external clock
>> today, but it seems there is no midi clock input in Csound.
>>
>> I used:
>>
>> kstatus, kchan, kdata1, kdata2 midiin
>> printk2 kstatus
>> if kstatus == 248 kgoto midiclockTick
>> kgoto end
>>
>> midiclockTick:
>> ; do the clock tick handling here
>> kgoto end
>>
>> end:
>>
>> But it seems midiin does not recevie realtime clock messages. I used a
>> midi monitor application, checking that the messages are sent.
>> I use Ableton Live to send midi clock messages, and they appear on the
>> midi monitor (Midi-Ox).
>>
>> According to the manual, midiin kstatus can be
>> 128 (note off)
>> 144 (note on)
>> 160 (polyphonic aftertouch)
>> 176 (control change)
>> 192 (program change)
>> 208 (channel aftertouch)
>> 224 (pitch bend
>> 0 if no MIDI message are pending in the MIDI IN buffer
>>
>> ... so no clock messages there.
>>
>> Is there another opcode for this ?
>> I find mrtmsg — Send system real-time messages to the MIDI OUT port,
>> but no similar opcode for input of the same signals.
>>
>> Maybe midiin should be updated to accept all types of midi messages ?
>> In my midi monitor the realtime
>> clock ticks show up as status = 248,
>> start has status = 250
>> stop has status = 252
>> (decimal notation, not hex)
>>
>>
>> best
>> Oeyvind
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
> --
>
>
> Andrés
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |