genuinequality

Download free music MP3s on genuine quality, the world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, The world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, stats, charts, biographies and concerts. stats, charts, biographies and concerts.

Monday, November 11, 2024

Arduino MIDI to Clock Trigger

This is another project for my Arduino Clock Generator Shield PCB. This one takes a MIDI clock sync pulse and outputs trigger pulses as required. https://makertube.net/w/obgH4asW3hqk2pHKKrPoAc Warning! I strongly recommend using old or second …
Read on blog or Reader
Site logo image Simple DIY Electronic Music Projects Read on blog or Reader

Arduino MIDI to Clock Trigger

By Kevin on November 11, 2024

This is another project for my Arduino Clock Generator Shield PCB. This one takes a MIDI clock sync pulse and outputs trigger pulses as required.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

If you are new to Arduino, see the Getting Started pages.

Parts list

  • Arduino Uno
  • Arduino Clock Generator Shield PCB
  • Ready-Made MIDI Modules or one of the DIY MIDI Interfaces
  • Source of MIDI clock sync pulses

The Circuit

I've used my Arduino MIDI Proto Shield and my Arduino Clock Generator Shield PCB, but the Clock Generator Shield could be used with any 5V MIDI IN circuit connected to D0/RX.

The Code

This is a variant of the code I used in Arduino Euclidean Gate Sequencer – Part 3 but rather than an internal clock source and Euclidean divisors, I'm using MIDI as the sync trigger and allowing the number of "parts per quarter note" (ppqn) to be set using the rotary encoder and display.

A MIDI clock pulse runs at 24 ppqn, so there are 24 clock MIDI messages per crotchet. I've allowed any divisor of 24 to be used, so the pulses for each of the six trigger channels can be 1, 2, 3, 4, 6, 8, 12 or 24 ppqn based on that MIDI input.

There are actually four MIDI messages that are significant to clocks and timing (well actually there is another one, but I'm ignoring that one for now). These are all in the "system real time" category:

  • F8 - MIDI timing clock - sent 24 times per crotchet.
  • FA - Start
  • FB - Continue
  • FC - Stop

The start/continue/stop messages are meant to control a sequencer, with start restarting a sequence from the beginning and continue expecting it to restart from wherever it got to on receiving a stop.

All will be supported in this code, with start resetting all the gate sequences, and continue/stop just pausing and unpausing things.

The core logic will be as follows:

Use encoder/display to set the divisor of 24 to use per channel.
(i.e. choose the ppqn per channel)

Read MIDI

IF MIDI Start: reset gates and enable the clock
IF MIDI Continue: enable the clock
IF MIDI Stop: stop the clock
IF MIDI Clock THEN:
FOR EACH channel:
Decrement the channel's counter (based on the divisor)
IF counter == 0 THEN:
Set channel output HIGH for 10mS
Reset the channel's counter to the divisor again

So if the channel divisor is set to 6 (for example) then there will be 6 gates set per every 24 MIDI clock messages received - i.e. a gate signal every 4 MIDI clock messages.

The encoder/display will show each ppqn value for each of the six channels. Pressing the encoder's switch will move a cursor between each channel and turning the encoder will change the value between the preset options listed above.

Find it on GitHub here.

Closing Thoughts

The video shows the MIDI clock generator syncing up a drum pattern from my ION iDM02 with three Korg Volcas.

It isn't perfect - sometimes the Volcas stutter slightly with the timing. I'm wondering if that is because I'm using a 10mS pulse and the Volcas usually use 15mS pulses for their sync.

There is also the weirdness that is the Volcas expecting to play two sequence steps per sync pulse. There are settings to change this - see my Korg Volca Notes, but it does mean that even on the slowest setting of 1 ppqn, the tempo of each step is effectively double whatever the iDM02 is saying.

The consequence of all this is that the Volcas will only really work with ppqn settings of 1 or 2, or maybe 4 (on a good day, with a slow tempo!).

The FM2 seems the most robust. I've checked the pulses with an oscilloscope and they seem pretty reliable to me, so I'm guessing there must be some oddity about how the Volcas are reacting to the pulses.

So this isn't quite finished, but it seems pretty close to me. I should try syncing it up with my "Baby8" CV Step Sequencer and see how that goes.

Kevin

Comment
Like
You can also reply to this email to leave a comment.

Simple DIY Electronic Music Projects © 2024.
Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app

Subscribe, bookmark, and get real‑time notifications - all from one app!

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com Logo and Wordmark title=

Automattic, Inc.
60 29th St. #343, San Francisco, CA 94110

Posted by BigPalaceNews at 1:36 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Search This Blog

About Me

BigPalaceNews
View my complete profile

Blog Archive

  • May (41)
  • April (84)
  • March (87)
  • February (90)
  • January (74)
  • December (72)
  • November (95)
  • October (105)
  • September (112)
  • August (116)
  • July (96)
  • June (100)
  • May (105)
  • April (95)
  • March (131)
  • February (111)
  • January (104)
  • December (98)
  • November (87)
  • October (126)
  • September (104)
  • August (97)
  • July (112)
  • June (113)
  • May (132)
  • April (162)
  • March (150)
  • February (342)
  • January (232)
  • December (260)
  • November (149)
  • October (179)
  • September (371)
  • August (379)
  • July (360)
  • June (385)
  • May (391)
  • April (395)
  • March (419)
  • February (356)
  • January (437)
  • December (438)
  • November (400)
  • October (472)
  • September (460)
  • August (461)
  • July (469)
  • June (451)
  • May (464)
  • April (506)
  • March (483)
  • February (420)
  • January (258)
  • December (197)
  • November (145)
  • October (117)
  • September (150)
  • August (132)
  • July (133)
  • June (117)
  • May (190)
  • January (48)
Powered by Blogger.