tmhglnd / mercury

A minimal and human-readable language and environment for the live coding of algorithmic electronic music.
http://www.timohoogland.com/mercury-livecoding
GNU General Public License v3.0
291 stars 13 forks source link

midiClock usage and suggestions #53

Closed JaysonDirkz closed 3 years ago

JaysonDirkz commented 3 years ago

Hi,

I tried to use the Mercury's midiClock functionality with my external gear (ESI MIDIMATE eX and Korg ESX-1) and I found out a few things:

set midiclock

has to be

set midiClock

Because midiclock without capital C doesn't seem to work.

The next issues are all related to changes I made in the midiClock patcher. See the image I included. And see my explanation below. image

  1. When using a midi device with a name that has spaces (for example ESI MIDIMATE eX), the set midiClock ESI MIDIMATE eX doesn't work. I tried a few other things like set midiClock "ESI MIDIMATE eX". But this also doesn't work. I solved this by making a change in the midiClock patcher (see image). I routed the typeroute~ list output to the route getports left input. And now it responds to lists (names with spaces). And my device is responding!

  2. But then I found out my device was not syncing correctly. So I changed the metro @active 1 @interval 30 ticks to metro @active 1 @interval 20 ticks. This also correspondents to the fact that the max/msp tick resolution is 480 pulses/quarter note and the midi clock resolution is 24 pulses/quarter note. So 480/24 = 20.

The next issues may be more related to personal preference (see the same image for clarity):

  1. Each time when executing the code (with alt gr + enter) the midiClock sends a midi start (value 250). This resets my external midi sequencer, while Mercurys sequencer doesnt resets. I wanted to keep my external sequencer going like Mercury. So I included a zl.change and gate object to let it send a midi start only when the midi device name is changed or after a midi off was called.

  2. At last I included a r codeOut + select silence attached to loadmess off to make the midiClock send a midi stop message (value 252) when silence is called in the editor. When playing around a bit with Mercury, this seemed convenient to me. But you can also do this ofcourse with calling set midiClock off and silence after eachother in the editor.

Cheers!

tmhglnd commented 3 years ago

Thanks for this! Will definitely fix the few bugs (where one was also mentioned in #52). A few comments for now:

  1. I think I will make sure it will work for at least set midiClock "ESI MIDIMATE eX", since using the spaces without "" might become troublesome in a future tokenizer/parser that I'm working on, will have to see.
  2. I'm not sure why I even put in 30 ticks, that obviously needs to be 20 yes, (480/24). Thanks for finding the error.
  3. I think It would indeed be good to not have it resend clock start message on every execute, and only when the code is not running. Good suggestion!
  4. This would indeed be good to have it turn off the clock when the code is silenced with silence or alt + .
tmhglnd commented 3 years ago

Now fixed in 42ea79581187e18743a4ad94f02291349bf64219. Documentation is also updated.