Old 03-26-2014, 06:55 PM   #1
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default MIDI clock sync

Hi guys, i am having problems to sync some external synths with arpegiator to the Reaper midi clock.
Essentially they are out of sync by a certain amount that makes difficult (and not fun) to play/work with them in this way.

I don't think is a latency problem because the latency is slow (3 ms input and 3 ms in output) and i can ear the out of sync also when using the asio direct monitoring (0 latency).

With the same computer, the same audio interface, the same drivers and the same sample rate/buffer size settings using cubase sending midi clock all sync fine, so it should be a problem of the Reaper midi clock that is sent incorrectly?

What can i do to improove midi clock syncronization in Reaper? Any other experience?

Thanks in advance for info!
spinlud is offline   Reply With Quote
Old 03-27-2014, 04:37 AM   #2
Ollie
Super Moderator (no feelings)
 
Ollie's Avatar
 
Join Date: Dec 2007
Location: On or near a dike
Posts: 9,834
Default

Quote:
Originally Posted by spinlud View Post
What can i do to improove midi clock syncronization in Reaper? Any other experience?
When you set up a MIDI port to output clock to a device, there is a "Offset output to this device by..." function to fine-tune sync. You can enter a correction value there, whereas the max. amount of negative delay (which is often needed) is limited by your block size (more buffer=more wiggle room). IOW if you set your audio buffers too low you can't correct the device sufficiently.
Ollie is offline   Reply With Quote
Old 03-27-2014, 08:34 AM   #3
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

Quote:
Originally Posted by Ollie View Post
When you set up a MIDI port to output clock to a device, there is a "Offset output to this device by..." function to fine-tune sync. You can enter a correction value there, whereas the max. amount of negative delay (which is often needed) is limited by your block size (more buffer=more wiggle room). IOW if you set your audio buffers too low you can't correct the device sufficiently.
Thank you very much Ollie i will try this and report here.
spinlud is offline   Reply With Quote
Old 03-27-2014, 01:53 PM   #4
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default

Maybe Ollie's suggestion works fine for you, and then all is fine.

But, if it is an older MIDI device you try to sync reaper with... I have had better luck with using JH_midi_clock (http://forum.cockos.com/showthread.php?t=59834) to drive my vintage MIDI drum machine.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 03-27-2014, 04:20 PM   #5
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

I've tested with three different synths sending midi clock from Reaper through midi cables and using different amounts of negative offset in preferences to see if it makes any difference to sync with the beat of Reaper.
Unfortunely no luck in any case..they are still out of sync when playing in real time.
I see that offset is useful to record external audio much closer to the beat when reaper is sending midi data to the synth...you can manually adjust the offset to compensate for the midi latency in output and the audio latency in input, but for midi clock and real time playing i didn't ear any improovement when chaging offset values.
I've also noticed that the amount of out of sync becomes higher when re-starting in a loop.
Do you think is there any plan to improove the midi clock in Reaper? Probably this is the only aspect that i miss from cubase when using reaper.

Quote:
Maybe Ollie's suggestion works fine for you, and then all is fine.

But, if it is an older MIDI device you try to sync reaper with... I have had better luck with using JH_midi_clock (http://forum.cockos.com/showthread.php?t=59834) to drive my vintage MIDI drum machine.
Thank you very interesting thread, but where can i download this JH_midi_clock plugin?
spinlud is offline   Reply With Quote
Old 03-28-2014, 01:43 PM   #6
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

No other feedbacks on this guys? Am i the only with problems in syncing midi instruments to Reaper?
spinlud is offline   Reply With Quote
Old 03-29-2014, 05:29 AM   #7
Ollie
Super Moderator (no feelings)
 
Ollie's Avatar
 
Join Date: Dec 2007
Location: On or near a dike
Posts: 9,834
Default

Please clarify what is syncing to what (what's master, what's slave), what REAPER settings you use to do that, what's playing behind and what early and what you're trying to achieve exactly.
Ollie is offline   Reply With Quote
Old 03-29-2014, 06:30 AM   #8
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

Quote:
Originally Posted by Ollie View Post
Please clarify what is syncing to what (what's master, what's slave), what REAPER settings you use to do that, what's playing behind and what early and what you're trying to achieve exactly.
Hi Ollie, basically what i am trying to do is sync arturia minibrute arpegiator, bassstation 2 arpegiator and moog slim phatty arpeggiator to Reaper. I am using a motu micro lite midi interface to send reaper midi clock to each synth using a different midi cable.

In preferences -> midi devices in the output section i've set enabled each port of the motu interface and enabled clock on each one.

So i would like that, when play some notes on the synths, the sound is in sync with the reaper project (as said before, i am using asio direct monitoring here so audio latency should not be a problem).

The 95% of time the sound is out of sync on all three, so i am wondering if there is something strange in the way reaper send midi clock, since that when i use cubase for the same thing all is in a good sync.
spinlud is offline   Reply With Quote
Old 03-29-2014, 07:10 AM   #9
Ollie
Super Moderator (no feelings)
 
Ollie's Avatar
 
Join Date: Dec 2007
Location: On or near a dike
Posts: 9,834
Default

OK, so I got you right then...like I said, try negative offsets in the right-click context menu of the MIDI out port(s) and try the synths one by one (they may need different offsets). For example, my MOX arps etc. are 24ms late when syncing without correction, to actually get near the -24ms offset I entered there I need to bump ASIO buffers to at least 1024 samples.

The JS plug-ins may be a solution but I skimmed the thread only and was confused which version to use and the simple port offset works for me (and I need that very seldomly).
Ollie is offline   Reply With Quote
Old 03-29-2014, 01:49 PM   #10
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default

In case negative offsets don't help... I'm using this:

Code:
// http://forum.cockos.com/showthread.php?p=538046#post538046
// http://forum.cockos.com/showpost.php?p=546746&postcount=33

desc:simple MIDI clock generator
slider1:0<0,3,1>BEAT
slider2:0<0,1,1>RUN
slider3:24<2,24,1>DIV
slider4:0<0,100,1>time shift (ms)

in_pin:none
out_pin:none

@init
ext_noinit = 1;

prev_count = 24;
prev_play_state = 0;

noteOnMsg = $x90;  
noteOffMsg = $x80;

clockMsg = $xF8;
startMsg = $xFA;
stopMsg = $xFC;
contMsg = $xFB;

@slider
time_div = slider3;

pdc_delay = srate*slider4/1000;

pdc_midi = 1;

@block

(beat_position%4 == 0) ? slider1 = 0; 
(beat_position%4 == 1) ? slider1 = 1;
(beat_position%4 == 2) ? slider1 = 2;
(beat_position%4 == 3) ? slider1 = 3;
slider2 = play_state;

my_beat_position = beat_position; /* save the current beat_position so we can extrapolate it */
beats_per_sample = (tempo/60)/srate; /* get the beats per sample so we can track the beat position at a given sample */

offset = 0; /* reset offset from current block start */

@sample

(prev_count != (my_beat_position*time_div)%time_div) ? (
  midisend(offset,clockMsg,0);
  prev_count = (my_beat_position*time_div)%time_div;
);

(play_state != prev_play_state) ? (
  (play_state == 0) ?  midisend(offset,stopMsg,0);
  (play_state == 1 || play_state == 5) ? midisend(offset,startMsg,0);
  prev_play_state = play_state;
);

my_beat_position += beats_per_sample; /* advance the beat with the current known tempo so we are tracking it sample accurate */
offset += 1; /* advance offset so we send the midi notes at the correct time */
Copy that text into a text file, and save it as something like "JH_midi_clk" in Reaper's Effects folder
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 03-30-2014, 03:44 AM   #11
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

Quote:
Originally Posted by Ollie View Post
OK, so I got you right then...like I said, try negative offsets in the right-click context menu of the MIDI out port(s) and try the synths one by one (they may need different offsets). For example, my MOX arps etc. are 24ms late when syncing without correction, to actually get near the -24ms offset I entered there I need to bump ASIO buffers to at least 1024 samples.

The JS plug-ins may be a solution but I skimmed the thread only and was confused which version to use and the simple port offset works for me (and I need that very seldomly).
Thanks Ollie, i've tried the time offset, sometimes the sync is fine sometimes is off. The downside for me is to use a 1024 buffer, wich is definetly too big to play in time other things inside Reaper like vst instruments etc (the latency is too much, for mixing i don't care but for composing/arranging is a problem). For now i think i will just play out of sync at a lower buffersize and then re-adjust the audio in time inside Reaper.
I hope that Reaper 5 will bring some improvements in the midi-sync area. I think it needs an option to send the midi clock also in stop mode.


Quote:
In case negative offsets don't help... I'm using this:
Code:
Code:
// http://forum.cockos.com/showthread.p...046#post538046
// http://forum.cockos.com/showpost.php...6&postcount=33

desc:simple MIDI clock generator
slider1:0<0,3,1>BEAT
slider2:0<0,1,1>RUN
slider3:24<2,24,1>DIV
slider4:0<0,100,1>time shift (ms)

in_pin:none
out_pin:none

@init
ext_noinit = 1;

prev_count = 24;
prev_play_state = 0;

noteOnMsg = $x90;  
noteOffMsg = $x80;

clockMsg = $xF8;
startMsg = $xFA;
stopMsg = $xFC;
contMsg = $xFB;

@slider
time_div = slider3;

pdc_delay = srate*slider4/1000;

pdc_midi = 1;

@block

(beat_position%4 == 0) ? slider1 = 0; 
(beat_position%4 == 1) ? slider1 = 1;
(beat_position%4 == 2) ? slider1 = 2;
(beat_position%4 == 3) ? slider1 = 3;
slider2 = play_state;

my_beat_position = beat_position; /* save the current beat_position so we can extrapolate it */
beats_per_sample = (tempo/60)/srate; /* get the beats per sample so we can track the beat position at a given sample */

offset = 0; /* reset offset from current block start */

@sample

(prev_count != (my_beat_position*time_div)%time_div) ? (
  midisend(offset,clockMsg,0);
  prev_count = (my_beat_position*time_div)%time_div;
);

(play_state != prev_play_state) ? (
  (play_state == 0) ?  midisend(offset,stopMsg,0);
  (play_state == 1 || play_state == 5) ? midisend(offset,startMsg,0);
  prev_play_state = play_state;
);

my_beat_position += beats_per_sample; /* advance the beat with the current known tempo so we are tracking it sample accurate */
offset += 1; /* advance offset so we send the midi notes at the correct time */
Copy that text into a text file, and save it as something like "JH_midi_clk" in Reaper's Effects folder
Thank you Fabian, i've tested this but didn't ear so much improvements regard the Reaper midi clock. Thank you anyway for the nice call.
spinlud is offline   Reply With Quote
Old 03-30-2014, 04:21 AM   #12
Mink99
Human being with feelings
 
Mink99's Avatar
 
Join Date: Jan 2011
Location: Zürich
Posts: 1,008
Default

There are two things that have to be recognised when using midi clock from reaper with external gear.

The first is that certain instruments need some time to measure the given click and then sync to it. While for example a dr670 drum box is immediately in sync with the given clock, other instruments need around 1 or two bars until they are perfectly synced.

The second thing is that the compensation on the midi clock somehow does not give the expected results , so if you have identified eg a 13 ms delay and put an offset on those 13 ms you somehow still end with a delay of 3-4 ms (but in a range that is acceptable). I do not know what is happening there, the influencing factors from audio-latency , midi latency , high or low latency midi mode lead to an unpredictable situation regarding midi clock sync.
Mink99 is offline   Reply With Quote
Old 03-30-2014, 05:05 PM   #13
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

Quote:
Originally Posted by Mink99 View Post
There are two things that have to be recognised when using midi clock from reaper with external gear.

The first is that certain instruments need some time to measure the given click and then sync to it. While for example a dr670 drum box is immediately in sync with the given clock, other instruments need around 1 or two bars until they are perfectly synced.

The second thing is that the compensation on the midi clock somehow does not give the expected results , so if you have identified eg a 13 ms delay and put an offset on those 13 ms you somehow still end with a delay of 3-4 ms (but in a range that is acceptable). I do not know what is happening there, the influencing factors from audio-latency , midi latency , high or low latency midi mode lead to an unpredictable situation regarding midi clock sync.
Thanks for the infos. I found an interesting thread about these issues with midi clock http://forum.cockos.com/showthread.p...y+compensation. It seems to me that Reaper midi clock needs some improvements. I know that the most of users doesn't use midi clock at all, but i hope that devs will give it a bit of attention at some point, maybe in Reaper 5 ^.^, it will bring a big smile on everyone that love to use analog synths and drum machines xD.
spinlud is offline   Reply With Quote
Old 03-31-2014, 05:15 AM   #14
Mink99
Human being with feelings
 
Mink99's Avatar
 
Join Date: Jan 2011
Location: Zürich
Posts: 1,008
Default

In the German synthesizer forum we had a discussion on reaper midi clock too, and I just tested various settings :



Test series : Clock from Reaper (X64) into Motu Midi Express 128 in 360 Systems Midi Patcher in DR 670
1. Testreihe
1.1 reaper mit 7 msec Audio Latency (Emu 1212m PCIE Asio)
1.2 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio)
1.3 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und +10 msec Midi offset
1.4 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -13 msec Midi offset
1.5 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -15 msec Midi offset
1.6 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset

2. Testreihe (slightly different Beat and 1212m configured differently )
2.1 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset
2.2 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset and 2 msec additional Audio Input Latency





Sorry for the large images ...

And I would like to know what I did but it worked ...
Mink99 is offline   Reply With Quote
Old 03-31-2014, 05:42 AM   #15
spinlud
Human being with feelings
 
Join Date: Jun 2012
Posts: 442
Default

Quote:
Originally Posted by Mink99 View Post
In the German synthesizer forum we had a discussion on reaper midi clock too, and I just tested various settings :



Test series : Clock from Reaper (X64) into Motu Midi Express 128 in 360 Systems Midi Patcher in DR 670
1. Testreihe
1.1 reaper mit 7 msec Audio Latency (Emu 1212m PCIE Asio)
1.2 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio)
1.3 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und +10 msec Midi offset
1.4 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -13 msec Midi offset
1.5 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -15 msec Midi offset
1.6 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset

2. Testreihe (slightly different Beat and 1212m configured differently )
2.1 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset
2.2 reaper mit 5 msec Audio Latency (Emu 1212m PCIE Asio) und -18 msec Midi offset and 2 msec additional Audio Input Latency





Sorry for the large images ...

And I would like to know what I did but it worked ...
Hi Mink99, thanks for sharing your reports here, can't see images you have attached though
spinlud is offline   Reply With Quote
Old 04-01-2014, 10:06 AM   #16
Mink99
Human being with feelings
 
Mink99's Avatar
 
Join Date: Jan 2011
Location: Zürich
Posts: 1,008
Default

Attached Images
File Type: jpg image.jpg (42.2 KB, 1484 views)
Mink99 is offline   Reply With Quote
Old 04-01-2014, 10:22 AM   #17
Mink99
Human being with feelings
 
Mink99's Avatar
 
Join Date: Jan 2011
Location: Zürich
Posts: 1,008
Default

Attached Images
File Type: jpg image.jpg (45.0 KB, 1448 views)
Mink99 is offline   Reply With Quote
Old 10-27-2020, 06:13 PM   #18
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Hello all, I would like to follow up on this and see if anyone knows how to solve a related problem. I've never been so frustrated in my life, it seems like this is a REAPER problem that so many have talked about going all the way back to 2007...

It seems specifically related to MIDI Clock Output Latency. Which is important, because it's how the patterns on the 303 are triggered to be played. You can't send MIDI notes into the 303 and play it like a normal MIDI Synth. My other external synths have no issues with REPAER on that front when I use ReaInsert.

I am trying to get my Behringer TD-3 to start at exactly 1.0.0 / Project Start, along with my VST drums.

It seems impossible! It appears to be a latency from the MIDI Clock Out signal. No setting anywhere affects the red box I have drawn around the highlighted yellow latency in the Recorded Audio Clip.

- Disable PDC Latency = No Change
- Recording Stereo / Stereo Latency Compensated = No Change
- Adjusting ReaInsert "Additional Delay Compensation" to TENS OF THOUSANDS of positive / negative samples = No Change
- Configure MIDI Output "Offset Output to Device" = No Change
- Playback Time Offset = No Change
- Testing all of the above with an audio interface 1024 Buffer Size vs 64 Buffer Size = No Change
- Resetting all my REAPER settings = No Change

WHAT IS GOING ON HERE?!?! PLEASE HELP JUSTIN I...WE BEG OF YOU. I would literally DO ANYTHING.



The only thing that makes a difference, is disabling the MIDI Clock Out, and using some hacky JS to Generate a Custom MIDI Clock. Even then, that only allows me to delay the start of the recording, and not negatively adjust it to be on time with the very beginning of the project.

I'm aware a solution is delaying ALL OTHER TRACKS EXCEPT THE 303, but when working in a project with 10+ external synths, and tons of other external effects, and lots of other audio and midi tracks, that's like a NIGHTMARE! Agh Why cant we just adjust a single midi port to be negative?!?!

EDIT: So I was able to align the audio by setting the "Output Manual Offset" to 115 ms in the REAPER Recording Preferences. As seen here, and now the audio is at the start of the recording.

What I am afraid of, and what I don't know -- is will this setting affect my other external audio effects, synthesizers, and midi ports? I use the MOTU Micro Lite, which has 5 MIDI Ports. I really only want this +115 ms on PORT #5, or on a specific audio in, and not my whole audio interface. Does anyone know of an effective way to isolate it to my MIDI PORT #5, or just a single audio track?!

EDIT 2 : When I disable Ozone 9 on my Master Chain, then everything gets out of whack and that 115 needs to be recalculated....wtf And, when I added the Ozone 9 Low End Focus VST (which adds a TON of samples to the PDC), everything is permanently out of whack again, even when disabled. It has to be completely removed from the chain. And the PDC settings seemingly dont get me back on time / change anything? Whats going on here? Is this expected, adding VSTS and needing to recalculate this 115 MS offset?!

Last edited by Opcode 7; 10-27-2020 at 08:40 PM.
Opcode 7 is offline   Reply With Quote
Old 10-28-2020, 02:00 AM   #19
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Couldn't it be a PDC issue?
You have so many plugins in your projects, maybe one of them isn't reporting latency accurately?
I would try first without any effect (get rid of Ozone, Reacomp, Reafir, Mtuner, etc), and see how it behaves. Remove them all from your project, don't just bypass them.
I would also get rid of Reasinert, for the sack of the test at least.
sinkmusic is offline   Reply With Quote
Old 10-28-2020, 02:17 PM   #20
Opcode 7
Human being with feelings
 
Join Date: Mar 2017
Posts: 79
Default

Thank you for the reply! Very interesting -- all iZotope plugins have a "Delay Compensation" setting that can be disabled. When I turn that off for my 2 plugins on the Master Channel, then the recorded audio is much much much closer to the beginning of the 1.0.0.

I have to disable another plugin on my master channel to get it exactly at 1.0.0 / on time, which is "soothe", which, does not have any settings to adjust or turn off the delay compensation.

For this plugin, and other plugins, what is the best way to handle this situation? Ideally, a way to override what the plugin is reporting? Is that possible, or, what?

Cheers! OMG

EDIT: OMG, With some additional searching on the forums, I found it possible to disable a plugins PDC by right-clicking on the "2 in 2 out" Button in the FX Window, going to PDC -> Disable. Jesus, I love REAPER, even though sometimes it's frustating, and they should totally add seperate MIDI/Audio Delay Compensation. I would love to have an explanation of the complex interactions of all the different latency compensation settings, when they work, when to use them, when they dont work (in relation to buffer sizes?), etc.

EDIT 2 : Disabling PDC makes it sound off time, will need to play around more
Attached Images
File Type: png delay comp.PNG (33.4 KB, 123 views)

Last edited by Opcode 7; 10-28-2020 at 02:26 PM.
Opcode 7 is offline   Reply With Quote
Old 10-28-2020, 04:17 PM   #21
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Glad you're on the right track

One hint : when everything is perfect in a perfect world, bypassing an effect theorically bypasses it (yes, I know, i have two duplicates in that sentence).
But for testing purposes, if you want to find the source of your issue and fix it, you really should start with a blank projet, test, add one single fx, test, remove it, open another fx, test, etc.
If you stack several FX, you're making it more difficult to find the cause of your issue.
And in a world of plugins (when some are better coded that some others, and where every software can have bugs), you're not safe to have a "bad bypass" or a bad PDC.
sinkmusic is offline   Reply With Quote
Old 10-28-2020, 04:19 PM   #22
sinkmusic
Human being with feelings
 
sinkmusic's Avatar
 
Join Date: Feb 2006
Location: decepticon mothership in a hidden place inside a mountain
Posts: 3,754
Default

Quote:
For this plugin, and other plugins, what is the best way to handle this situation?
I do use a lot of Midi instruments and hardware gear, too.
When i record and compose, I use only latency-free plugins.
I use plugins with latency later, on the mixing/mastering stage, when latency or PDC isn't an issue anymore.
sinkmusic is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.