Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 02-15-2017, 12:13 PM   #1
Amack
Human being with feelings
 
Join Date: Feb 2017
Posts: 12
Default MIDI ASIO Latency Compensation Problems (REAPER v5.33/x64 Windows10)

I believe that Reaper does not properly compensate MIDI for ASIO audio interface latency. The delay applied to live MIDI inputs that trigger Internal Virtual Instruments (Vis) is apparently determined by the ASIO buffer size rather than by the interface’s reported input latency. Also, live MIDI outputs are delayed by the sum of the interface’s reported input and output latencies rather than just its reported output latency.

DAW audio inputs and outputs are delayed by the audio interface’s input and output latencies. Since MIDI inputs aren’t, Reaper apparently adds delay to MIDI inputs and outputs in an attempt keep things synchronized during monitoring, recording, and playback. As shown in the attachment, Reaper delays MIDI input track recordings and any associated MIDI outputs by the reported input latency of the audio interface, but (incorrectly) only delays the triggering of internal virtual instruments (Vis) by the interface’s buffer size equivalency. This causes internal VIs to be prematurely triggered by the difference between the interface’s input latency and its buffer size equivalency during monitoring and recording. Also, rather than properly delaying MIDI outputs by the reported output latency of the interface, Reaper delays them by the sum of the reported input and output latencies. External VIs triggered by these MIDI outputs would experience an extra delay equal to the reported input latency during monitoring, recording, and playback.

Test Procedure
For this demonstration, a Roland TD-15K V-drum served as a MIDI (via USB) and audio (via audio output) source. ASIO4ALL was used with the computer’s internal sound “card” as the audio interface. A 1st generation Focusrite Scarlett 6i6 was used as a MIDI loopback device.

A microphone was used to trigger one of the TD-15 drum pads. Although it was recorded on Track 8, the TD-15’s audio was used as the time reference instead because it was quite well synchronized with the TD-15’s MIDI.
TD-15 MIDI was recorded on Track 1. TD-15 Audio was recorded on Track 2 and monitored and externally looped back for recording on Track 3.
TD-15 MIDI also triggered a MT-PowerDrumKit VSTi on Track 4. The VSTi’s output was monitored and externally looped back for recording on Track 5.
TD-15 MIDI was also output to the 6i6 on Track 6 for monitoring, external loopback, and recording on Track 7.

Both recordings were configured to “Use audio driver reported latency”. The first was with ASIO4ALL reporting latencies reflective of the actual input and output latencies. The second was with ASIO4ALL reporting incorrect latencies to demonstrate the problems.

Test Results
Track 1’s second recording shows that the MIDI input recording was delayed 20 milliseconds (ms) * 48k Samples/second (S/s) = 960S from that on the first recording – consistent with the reported input latency (ASIO4ALL’s “Latency Compensation In:”) increase.

The approximately 64 S (1.333 ms) delay between Track 3 and 5 in the first recording suggest that the triggering of the VSTi that produced Track 5 was delayed by the ASIO Buffer Size equivalency (2048 S / 48k S/s = 42.667 ms) rather than the total reported input latency (2048 S + 64 S) / 48k S/s + 1 ms = 45 ms. (This version of ASIO4ALL has and reports an additional 1 ms of input and output “Buffer Offset” latency over what is shown on its control panel slider.) The fact that Track 5 in the second recording experienced no additional delay verifies that.

Tracks 6 on the first recording shows that the MIDI input to output delay was the sum of the input buffer size equivalency and the reported output latency (42.667 + 45 = 87.667 ms). The second recording shows an additional delay of ~ 30 ms delay. The corresponding increase in reported latencies between the two recordings was (1024 + 512 – 2*64) S / 48k S/s = 29.33 ms (within the measurement accuracy).
Attached Files
File Type: zip MIDI ASIO Latency Compensation Problems Clean.zip (618.6 KB, 283 views)
__________________
An Engineer with OCD
Amack is offline   Reply With Quote
Old 02-15-2017, 02:37 PM   #2
Dannii
Human being with feelings
 
Dannii's Avatar
 
Join Date: Mar 2010
Location: Adelaide, South Australia (originally from Geelong)
Posts: 5,598
Default

Amack,

I have recently noticed something that I believe could well be related to what you have mentioned.
In my keyboard rig, I have two Roland JP08 modules that I created (in REAPER) a MIDI channel alternating utility to alternate MIDI notes played live between the two modules to correctly double the polyphony. However, even at the smallest latency, I still notice an off-putting delay between playing my KX8 and hearing the sound from the Roland synths (even with zero latency audio monitoring through my RME UFX).
I have also noticed this delay appears to be roughly twice the audio buffer setting.

Playing a VSTi from the KX8 also has a delay but it is very small in comparison and not an issue at the lowest buffer settings.

I've overcome the Roland synth issue by purchasing a hardware MIDI device that does the note channel alternating but it would be great to have this resolved in REAPER as well.
__________________
Dannii is offline   Reply With Quote
Old 02-15-2017, 04:05 PM   #3
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 24,790
Default

Reaper doesn't do MIDI through unfortunately, so if there's any sort of MIDI processing going on, it's going to be delayed by one buffer...

http://forum.cockos.com/showthread.php?t=34533
EvilDragon is online now   Reply With Quote
Old 02-15-2017, 05:58 PM   #4
Amack
Human being with feelings
 
Join Date: Feb 2017
Posts: 12
Default

Quote:
Originally Posted by EvilDragon View Post
Reaper doesn't do MIDI through unfortunately, so if there's any sort of MIDI processing going on, it's going to be delayed by one buffer...

http://forum.cockos.com/showthread.php?t=34533
Actually It's going to be delayed by the sum of the buffer size equivalency and the audio interface's reported input and output latencies. Cubase has an option to disable MIDI "ASIO latency compensation" on individual tracks , but it apparently doesn't work right. It seems like a nice feature though (if it can be made to work).
__________________
An Engineer with OCD
Amack is offline   Reply With Quote
Old 02-16-2017, 01:11 AM   #5
Dannii
Human being with feelings
 
Dannii's Avatar
 
Join Date: Mar 2010
Location: Adelaide, South Australia (originally from Geelong)
Posts: 5,598
Default

Quote:
Originally Posted by Amack View Post
Actually It's going to be delayed by the sum of the buffer size equivalency and the audio interface's reported input and output latencies. Cubase has an option to disable MIDI "ASIO latency compensation" on individual tracks , but it apparently doesn't work right. It seems like a nice feature though (if it can be made to work).
That would be very useful indeed.
As for REAPERs MIDI hardware to hardware latency, I agree with your findings here. If it was delayed by just the buffer alone, it would be manageable even though less than ideal. As it is now though, I find it very distracting to use MIDI routed through REAPER between hardware devices for live performance even at the lowest buffer sizes.

I do have hardware solutions here now that work for me but it would be nice for others and for times when I need this in REAPER to have an internal solution.
__________________
Dannii is offline   Reply With Quote
Old 04-25-2017, 01:34 PM   #6
Amack
Human being with feelings
 
Join Date: Feb 2017
Posts: 12
Default MIDI Record, monitoring, and playback timing

I’ve done more MIDI latency/timing measurements with the latest (March 23, 2017) version of Reaper. The attachment shows the results and my thoughts on how it could be improved. Monitoring is assumed to be through Reaper.

Please let me/others know if this seems/is correct and makes sense. I view things like an engineer (E.E.) rather than a musician (my son is the musician and DAW user) and I’m trying hard to understand this stuff. So, any constructive feedback would be greatly appreciated! Steinberg apparently doesn’t value/want my feedback. But, so far at least, Cockos seems significantly more open minded.
Attached Files
File Type: zip Reaper MIDI.zip (437.2 KB, 331 views)
__________________
An Engineer with OCD

Last edited by Amack; 05-04-2017 at 11:21 AM. Reason: Fix attachment
Amack is offline   Reply With Quote
Old 07-11-2021, 01:28 AM   #7
rjeunet
Human being with feelings
 
rjeunet's Avatar
 
Join Date: Jan 2020
Location: Switzerland
Posts: 7
Default Still MIDI Latency issues

If I set the buffer ASIO size with the same parameters under Live, I do not have this annoing latency, everything is immediate. I twicked in Repaer all the parameters, and didn't manage to reduce it. Totally unusable!
So I still produce and premix in Live, and export to Reaper I prefer for final Mix and Mastering.
But this Reaper MIDI latency issue, prevents us to produce properly Drum tracks or play live MIDI performance with VST Virtual Instruments on top of our tracks.
There is definitely something to correct in Reaper here.
rjeunet is offline   Reply With Quote
Old 03-20-2022, 03:24 PM   #8
binbinhfr
Human being with feelings
 
binbinhfr's Avatar
 
Join Date: Oct 2021
Location: France
Posts: 363
Default

Hi there,

any news about this MIDI timing problem ?

Because I also have a MIDI device recording problem :
if I record a simple midi drum track on my Vdrums, listening to reaper metronome, and to the direct sound coming directly from the Vdrum, it always ended with MIDI events recorded 30ms in advance....

My soundcard audio buffer size is 512 in 44KHz, and I used Kenny's loopback method to perfectly sync the audio using the input manual offset parameter.
( https://www.youtube.com/watch?v=HZcXZ9kEJbY )

Same thing if I try to play in sync using my MIDI piano.

Changing driver manual offsets does not seem to have any influence on this 30ms predelay of the recorded MIDI events...

Is it recognized as a Reaper bug ?
__________________
Reaper's lunatic
Reapack repository / GitHub / SoundCloud / Donate
binbinhfr is offline   Reply With Quote
Old 06-16-2022, 04:38 PM   #9
jcfitn
Human being with feelings
 
Join Date: Apr 2022
Posts: 23
Default The same problem

Quote:
Originally Posted by binbinhfr View Post
Hi there,

any news about this MIDI timing problem ?

Because I also have a MIDI device recording problem :
if I record a simple midi drum track on my Vdrums, listening to reaper metronome, and to the direct sound coming directly from the Vdrum, it always ended with MIDI events recorded 30ms in advance....

My soundcard audio buffer size is 512 in 44KHz, and I used Kenny's loopback method to perfectly sync the audio using the input manual offset parameter.
( https://www.youtube.com/watch?v=HZcXZ9kEJbY )

Same thing if I try to play in sync using my MIDI piano.

Changing driver manual offsets does not seem to have any influence on this 30ms predelay of the recorded MIDI events...

Is it recognized as a Reaper bug ?
I have the same problem too, i can not overdub midi because the new takes are in advance... too much compensation, i don0t want compensation, i want the same that i listened in the record!
jcfitn 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 09:47 AM.


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