<div dir="ltr"><div>The only thing it's not clear to me is the your use case.</div><div>The problem I've always found with ext clocks (HW especially but not only) is the accuracy. All the HW machines I've tested are inaccurate to a certain degree. But usually what you do as a user is to use the MIDI clock as a trigger for the slave machine and at this point the inaccuracy doesn't matter anymore since all is in sync.</div><div>But in your case you said: <br></div><div>> "then I can adjust the BPM in the TimeSignature class as it is running"</div><div>Can you expand a bit on this?</div><div>Would like to receive a clock and decide when and whether to sync to it?<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 2 Jul 2019 at 23:09, Michael Heuer <<a href="mailto:heuermh@gmail.com">heuermh@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">The tempo in BPM is what drives the <a href="https://github.com/heuermh/lick/blob/master/lick/duration/TimeSignature.ck" target="_blank">TimeSignature class in LicK</a>, for example a 4/4 kick drum<div><br></div><div>RolandTr808 rolandTr808;</div><div>TimeSignature.common(120) @=> TimeSignature ts;</div><div>ts.quarterProvider() @=> QuarterProvider q;</div><div><br><div>spork ~ Loops.loop(rolandTr808.kickE, q).run();</div><div><br></div><div>// wait a minute, then change the tempo to 110 BPM</div><div>1::minute => now;</div><div>110 => ts.tempo;</div><div><br></div><div>// wait another minute, then decelerate the tempo by 0.8 over the next 30 seconds</div><div>1::minute => now;</div><div>spork ~ ts.decel(0.8, 30::second);</div><div><br></div><div>etc.</div><div><br></div><div>If I can calculate the BPM from external clock, then I can adjust the BPM in the TimeSignature class as it is running.</div><div><br></div><div> michael</div><div><br><div><br><blockquote type="cite"><div>On Jul 2, 2019, at 4:37 PM, Mario Buoninfante <<a href="mailto:mario.buoninfante@gmail.com" target="_blank">mario.buoninfante@gmail.com</a>> wrote:</div><br class="gmail-m_1803171984309928208Apple-interchange-newline"><div><div dir="ltr"><div>about receiving external clock, I think the goal there is to use the clock to drive the algorithm.</div><div>I wouldn't try to calculate the BPM if not for just displaying it somewhere.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 2 Jul 2019 at 22:17, Michael Heuer <<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">All,<br>
<br>
I'm curious how to use MIDI clock effectively in ChucK, in two main use cases:<br>
<br>
>From a sample-rate-based timer in ChucK, how should I send out MIDI clock?<br>
<br>
while (true) {<br>
10::ms => now;<br>
// send MIDI clock<br>
}<br>
<br>
or<br>
<br>
TimeSignature.common(120) @=> TimeSignature ts;<br>
<br>
while (true) {<br>
ts.e => now;<br>
// send MIDI clock<br>
}<br>
<br>
or (this one allows the caller to modify the tempo later)<br>
<br>
TimeSignature.common(120) @=> TimeSignature ts;<br>
ts.eighthProvider() @=> EighthProvider e;<br>
<br>
while (true) {<br>
e.evaluate() => now;<br>
// send MIDI clock<br>
}<br>
<br>
<br>
>From receiving MIDI clock messages from an external source, how should one adjust the BPM in ChucK?<br>
<br>
MidiIn min;<br>
MidiMsg msg;<br>
<br>
TimeSignature.common(120) @=> TimeSignature ts;<br>
<br>
while (min.recv(msg)) {<br>
// if is clock … {<br>
/* new BPM */ => ts.tempo;<br>
}<br>
}<br>
<br>
I would imagine I would want to window over the last n clock messages to average?<br>
<br>
Thanks in advance,<br>
<br>
michael<br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div>
_______________________________________________<br>chuck-users mailing list<br><a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br></div></blockquote></div><br></div></div></div>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div>