The MIDI Forum

  1. Gabe
  2. Getting Started with MIDI
  3. Monday, 22 March 2021
  4.  Subscribe via email
Hello guys,

I'm a guitarist and nub to using midi. I wonder if there is any way of generating or converting a midi clock from midi notes or events? I use a standalone audio multitrack player that can play a midi track in sync with the audio tracks but unfortunately can't provide midi clock. That would be great if I could sync time-based effects with my backing tracks. I found Midi solutions' Event processor plus but due to the lack of my midi knowledge i can't determine if i could use it for that... thanks in advance for any advice!
Comment
There are no comments made yet.
Who is viewing this page
Accepted Answer
Accepted Answer Pending Moderation
0
Votes
Undo
I do not have a MIDI Solutions Event Processor, but I have looked at their free MIDI Solutions Programming Tools to get an idea what is possible with their products. It appears that it would be possible to convert a note message into a clock message:

note-to-midi.png

Then you'd just have to create a MIDI file that has 24 notes per quarter note and it would get converted to the expected 24 clocks per quarter note.



I wonder, are you using a Cymatic device? I wish Cymatic could update their existing devices or release a new model that can send out MIDI clock, it seems like their users often want to do that.

Perhaps you have seen the previous midi.org forum posts from Cymatic device users discussing the possibility of embedding MIDI clocks in a MIDI file:

https://www.midi.org/forum/3769
https://www.midi.org/forum/1818

If you embed MIDI clocks in a MIDI file, the Cymatic LP16 will send them out, maybe other Cymatic devices will too? To embed MIDI clocks into a MIDI file, you might need to use a specific sequencer (like Sekaiju). You have to embed a MIDI clock inside of an esoteric F7 MIDI file event (called a "sysex continuation" or "escaped" or "sysex (arbitrary)" event).

I can see how converting a note into a clock might be easier to do albeit with the additional cost of purchasing an external converter like the MIDI Solutions Event Processor.

But if you want, you might consider the cheaper but more technically involved route of embedding clock messages into a MIDI file.


(Since this is the third time this has come up, I am going to look into writing some program or script that can generate a MIDI file with embedded clocks.)
Attachments (1)
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Thanks for your effort and comment! Yes, it's a Cymatic LP-16. The guys at Cymatic made a big mistake with this. I will check the posts you mentioned. Embedding midi clock sounds good. Of course I prefer the cheaper solution and the less device, but as I'm new to midi I don't know if I can make it work. I would appreciate it if you could do such a script so do all the LP-16 users.
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
I created the attached HTML JavaScript page to generate a MIDI file that has MIDI clocks in it:
clock-midi-file-generator.png

Let me know if this kind of clock MIDI file works for you. This esoteric embedding of a MIDI clock in a MIDI file interests me, and I'm interested to know if it turns out to be useful in practice.

The generated MIDI file is set up to send the "F8" clock message the required 24 times per quarter note. But another user reported that their Cymatic LP-16 incorrectly sends "F7 F8" each time, and wondered if that was why some of their devices didn't work.
Attachments (2)
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Bavi_H, thank you so much for the effort you have put into this topic! I can try it on the weekend at the earliest. I’m very excited!
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Status report: I've just figured out how to add program changes and CC messages to the midi file generated by Bavi_H's script, because Ableton is not suitable for that, or I just can't handle it enough. So I used Sekaiju. I played the midi file with the LP-16 into a midi monitoring app and it seems ok. I can see all the PC, CC and the F8 messages. There are no F7s. I will test it tomorrow on a real device as well.

Another thing: I contacted Midi Solutions and as it turned out, they added the capability to their Footswitch Controller to enable it to respond to a Note-On message as a tap when operating in Tap Tempo mode, so in this mode the Footswitch Controller sends MIDI Timing Clock messages at a rate of 24 per quarter note. It’s good to know if syncing might not come up with embedding midi clock.
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Finally I tried it with my Fractal AX8, works fine. :) Thanks for your support Bavi_H!
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
I'm struggling with a similar problem. Certain Yamaha devices generate MIDI Clock for their own internal use--like rhythm machines--but also allow the user to select an external MIDI Clock to drive the device's rhythm machine. In my specific case, I'm using some 80's era Yamaha gear, specifically an HX-1 (Electone organ) and an MDR (Music Disk Recorder, 3½" floppy based). When an artist uses MDR to record a performance using the organ's rhythm machine at a set tempo, the MDR does not capture the F8s from the organ and write them to the file, only the tempo (in BPM) setting. For playback, the MDR first tells the keyboard to use an external synchronous source and the MDR hardware generates the F8s to drive the organ's rhythm machine while streaming the file's MIDI events. At the end of playback, a SysEx from the MDR tells the organ to return to using the organ's internal MIDI clock.

This makes sense given the imperfection that can arise from a tempo (in BPM) expressed as an integer and fractional rounding the occurs during recording compared to the higher resolution possible from ticks relating to microseconds. This drifting of timing is evident when you use (no offense intended) the Clock MIDI File Generator program above to create two files, each of 99 measures at 4/4 time, but one at Tempo 120 and the other at Tempo 123. The two files are identical (aside from the Set Tempo Meta-Event) and don't account for the rounding that occurs when calculating delta times. Both files send the F8s using a delta time of 5. At 120 the delta time is 5.208 and at 123 the delta time is 5.125.

My analysis leads me to conclude that Yamaha dealt with this issue by periodically adjusting to any inaccuracy that may have occurred due to rounding. At a convenient tempo like 125 BPM there should be no loss due to rounding. At 125, I *almost* always get F8s every 20 (decimal) ticks and in the rare cases when a 19 comes across, it's followed up shortly there after with a 21 which makes me wonder if it's checking itself against another onboard clock for accuracy. At BPMs not evenly divisible by 24, I see the same error-correcting occurring rather than a steady stream of a single delta time. At the end of x number of events, the accumulated delta times will be as close as possible to real time by having added back time lost from any truncation or rounding calculation.

Back to the 123BPM example: For exact timing, the delta times should be 5,5,5,5,5,5,5, 6 ,5,5,5,5,5,5,5, 6 ,5,5,5,5,5,5,5, 6, a sum of 123.

I admit to being a little "green" to all this, so please correct me if any of my assumptions are wrong. My goal is to achieve accurate playback of these recorded performances not from the MDR device, but my own program using the Windows MIDI stream APIs. I think I have no choice but to add my own F8 MIDI messages to the performance data (making sure there's an F8 every BPM/24 ticks) and hope the API can process them accurately. Regrettably, playback of the event data using the organ's clock for the rhythm machine points out the timing drift after a few measures.
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
the MDR does not capture the F8s [...] and write them to the file [...]. For playback, [...] the MDR hardware generates the F8s [...] while streaming the file's MIDI events.

Recording MIDI clock messages into a MIDI file is not typical. The Clock MIDI File Generator is only intended as a possible workaround for devices that can play MIDI files but do not have the ability to generate MIDI clock messages in their MIDI output.

The behavior exhibited by your Yamaha Music Disk Recorder is the expected typical behavior. MIDI file recorders do not store MIDI clock messages in the MIDI file, but they might have an option to interpret incoming MIDI clock messages to determine the quarter note-based position that has elapsed or calculate the intended tempo. MIDI file players might have an option to generate MIDI clock messages at the MIDI file's current tempo value and mix them into the output.


when you use [...] the Clock MIDI File Generator program above to create two files [...] one at Tempo 120 and the other at Tempo 123[, t]he two files are identical (aside from the Set Tempo Meta-Event) [...]. Both files send the F8s using a delta time of 5.

The Clock MIDI File Generator generates MIDI files with a resolution of 120 ticks per quarter note.

When MIDI clock messages are used, they are sent at a rate of at 24 clocks per quarter note. Since the generated MIDI file resolution is 120 ticks per quarter note, this means the generated clocks are always 5 ticks apart, no matter what the tempo is.

The software that plays back the MIDI file is responsible for converting the quarter note-based ticks into absolute time-based seconds. To make that conversion, the playback software will use the tempo value stored in the MIDI file (microseconds per quarter note) to know how long each quarter note should be in seconds.

The Clock MIDI File Generator allows you to enter a tempo value in quarter notes per minute with any number of decimal places. It will store a value in the MIDI file in microseconds per quarter note that is the closest match to the tempo value you enter. This is the most precise tempo representation possible in a MIDI file.
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!