Is My Delay Compensation Totally Borked?!?

Author
2:43AM
Max Output Level: -68 dBFS
  • Total Posts : 1147
  • Joined: 2013/06/24 07:59:49
  • Location: PHX
  • Status: offline
2014/10/17 21:07:52 (permalink)

Is My Delay Compensation Totally Borked?!?

I know that this has been discussed before, but I have not found one thread that has solved timing issues with recorded audio in Sonar. I've come across several threads which describe similar problems, but they usual have resulted in long-winded explanations, arguments, and saber rattling of of egos, but no overall resolution.
 
The point of my post: is my delay compensation borked (i.e. defective, not working, screwed up, failed, etc.) or is something else going on here?!? 
 
1) I cannot for the life of me figure out how to get recorded audio to line up perfectly with MIDI notes. I don't want to have to nudge stuff around constantly.
2) Each time I hit record, delay/latencies are inconsistent. First there may be 6ms of delay, next may be 9ms of delay, etc.
3) Why does the External Insert plugin completely screw with latency? I mean, this thing sucks!

First, let me ask a basic question because I really don't know: if no matter what a plugin's latency may be, then shouldn't Sonar automatically compensate for it without having an effect of leading or lagging audio? For example, if I put an instance of the ProChannel Concrete Limiter on my master, it introduces more lag on recorded audio. Yes, I am aware that PCCL has a latency of 1.5ms, but should this not be accounted for and thereby not affect any recorded audio? In other words, it should be seamless/transparent to the user. Other plugins that I have tested don't do this (e.g. Ozone 5 with all modules turned on<--resource hog, or 6 instances of Valhalla Vintage Verb piled high). I find it odd that such a simple plugin such as PCCL can negatively tweak a project. It's almost as if PCCL is not reporting its latency to Sonar. Which brings me to another question: how can I tell if a plugin is not reporting its latency to Sonar? Is it basically the scenario I described?
 
I am currently in discussion with Access in regards to an issue I am experiencing with my Virus. Overall, if I record audio from this synth and another synth, which both go through the same audio interface, the Virus audio will lead by about 5-6msec the MIDI notes that trigger it.  The other hardware synth is normal.  Despite adjusting manual offset (+240 samples), I can get any other input other than the Virus to line up.  The more manual offset I add, however, the further forward the Virus audio gets pushed. It may have something to do with USB-"MIDI" triggering vs. traditional MIDI triggering.
 

 
And each time I hit record, the lead/lag may change slightly. Hitting record in Sonar never is consistent. Why could this be?
 
And finally, the External Insert plugin completely blows. If it is added to a project, then it completely and utterly wreaks havoc on timing. What's up with this thing?
 
I have done extensive, time-wasting testing on this. So far, I have tried the following, all of which have not improved anything:
 
1. Replaced nVidia graphics card with my old ATi graphics card.
2. Disabled and unplugged my MIDIsport interface and used an alternate MIDI port.
3. Disabled delay compensation for Virus Control.
4. Used the program LatencyMon to check for any outstanding latency issues among drivers.
 
I know I have asked many questions and have thrown a lot down on the table, but let's go with the easiest problem first: issues with the External Insert plugin.  This stupid plugin introduces HUGE and VAST amounts of delay for any recorded audio.  I mean this thing is abyssal!  It is so bad, it makes me think it's not even working right.  I mean, how the heck could a plugin deliver inconsistent latencies* and delays to recorded audio ranging from about 15ms to over 100ms!??  Who here uses it and does it give you problems like I am experiencing?
 
* "Inconsistent latencies" refers to a differing amount of delay each time I hit the record button.
post edited by 2:43AM - 2014/10/18 10:35:26
#1

6 Replies Related Threads

    2:43AM
    Max Output Level: -68 dBFS
    • Total Posts : 1147
    • Joined: 2013/06/24 07:59:49
    • Location: PHX
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/17 21:08:03 (permalink)
    So I re-tested one of my templates that includes an instance of the External Insert plugin.  The project template also includes 16, MIDI channels for the Virus, 3 USB audio outputs from the Virus, and 1 stereo channel of analog audio from the Virus.  Since bouncing-down is a hassle, I just use the stereo channel to recorded live from MIDI composition.  Though the External Insert plugin is not totally messing up the timing, it does result in what I am calling, for lack of a better term, "delay compensation overshoot".  See picture below.  What you're seeing is the recorded audio leading the triggering MIDI note by 21 msec!
     
    (ಠ_ಠ)
     
    The External Insert plugin's automatic "ping" latency is set at 6 msec (328 samples), which BTW is a little goofy because 6 msec at 48kHz sampling should be 288.
     

    post edited by 2:43AM - 2014/10/18 11:09:05
    #2
    bitflipper
    01100010 01101001 01110100 01100110 01101100 01101
    • Total Posts : 26036
    • Joined: 2006/09/17 11:23:23
    • Location: Everett, WA USA
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/20 08:38:10 (permalink)
    Maybe it's not delay compensation that's the issue here, since AFAIK that applies specifically to audio being sent out and returned, not straight audio recording.
     
    You could try correcting the timing error using the Manual Offset adjustment. Zoom in and set the time display to Samples, write down the value at the start of a quantized MIDI note, then check the sample number at the start of the recorded wave. Subtract the two and enter that value into the Manual Offset box. This will tell SONAR precisely where to place the recorded audio and it'll match the MIDI precisely.
     
    The potential downside to this workaround is that if it's actually a MIDI timing problem, the offset correction could screw up non-MIDI audio recording. You can test that by recording a sharp sound such as a pencil tapped on the desk and see if that audio is now out of sync. If it's OK, or if you never use microphones, then problem solved.
     
    But if the microphone audio is now whacked, then the manual offset isn't the right solution. Look at the IgnoreMidiInTimeStamps variable in aud.ini (try setting it to 1), and the "Prepare Using N Millisecond Buffers" in the MIDI options (try lowering it to 100ms).
     
    (BTW, I have always had this problem recording outboard synths, a problem that has persisted across three different interfaces. I just routinely nudge audio to compensate. I manually insert a quantized MIDI note at the beginning for the sole purpose of lining up MIDI to recorded audio. I could use the manual offset trick, but then other recorded audio is off so I'd have to keep changing the value depending on what I'm recording.)


    All else is in doubt, so this is the truth I cling to. 

    My Stuff
    #3
    Splat
    Max Output Level: 0 dBFS
    • Total Posts : 8672
    • Joined: 2010/12/29 15:28:29
    • Location: Mars.
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/21 17:59:12 (permalink)
    As this is a Q&A/troubleshooting thread rather than a Sonar bug report with reproducible steps I've moved this to the Sonar Forum to get more eyeballs for troubleshooting purposes... If any actual Sonar bug can be found then that is reproducible we can consider moving it back.
     
    Cheers....

    Sell by date at 9000 posts. Do not feed.
    @48/24 & 128 buffers latency is 367 with offset of 38.

    Sonar Platinum(64 bit),Win 8.1(64 bit),Saffire Pro 40(Firewire),Mix Control = 3.4,Firewire=VIA,Dell Studio XPS 8100(Intel Core i7 CPU 2.93 Ghz/16 Gb),4 x Seagate ST31500341AS (mirrored),GeForce GTX 460,Yamaha DGX-505 keyboard,Roland A-300PRO,Roland SPD-30 V2,FD-8,Triggera Krigg,Shure SM7B,Yamaha HS5.Maschine Studio+Komplete 9 Ultimate+Kontrol Z1.Addictive Keys,Izotope Nectar elements,Overloud Bundle,Geist.Acronis True Image 2014.
    #4
    tlw
    Max Output Level: -49.5 dBFS
    • Total Posts : 2567
    • Joined: 2008/10/11 22:06:32
    • Location: West Midlands, UK
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/21 21:12:31 (permalink)
    Be aware that when using different hardware synths they will each take a slightly different time to process the MIDI and get the noise out.

    There's a two-four millisecond difference between my microQ and Mopho for example.

    Different USB MIDI interfaces may also require different processing times in the order of a tiny number of milliseconds.

    I routinely have to shift recorded hardware synth's audio a tiny amount to get things lined up correctly. What's more it's a different amount for each synth.

    I use the external insert once in a while and usually have to tweak the recorded audio, again a tiny amount. However other than my interface I'm passing the audio through no digital convertors, just purely analogue gear. If the external stuff is digital that might be adding in latency of its own.

    As for the difference between theoretical audio interface latency and "ping" real-time latency..... I'm using an iPad so can't see if your interface is in your sig or not. If it's a USB one in particular I'd hazard a guess that this may be down to "hidden" safety buffers in the interface, a not uncommon thing with USB soundcards. These buffers may not be reported to Sonar by the driver. Some interfaces seem to be very inconsistent between the driver-claimed buffer settings and what is actually going on.

    I also wonder if you're looking at two different issues here. One being audio latency/sync and the other being the MIDI side of things.

    Sonar Platinum 64bit, Windows 8.1 Pro 64bit, I7 3770K Ivybridge, 16GB Ram, Gigabyte Z77-D3H m/board,
    ATI 7750 graphics+ 1GB RAM, 2xIntel 520 series 220GB SSDs, 1 TB Samsung F3 + 1 TB WD HDDs, Seasonic fanless 460W psu, RME Fireface UFX, Focusrite Octopre.
    Assorted real synths, guitars, mandolins, diatonic accordions, percussion, fx and other stuff.
    #5
    slartabartfast
    Max Output Level: -22.5 dBFS
    • Total Posts : 5289
    • Joined: 2005/10/30 01:38:34
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/22 16:33:48 (permalink)
    OK so the midi event is sent to a synth (outboard or softsynth) at time zero. The synth response is returned to Sonar at time zero plus a short but not zero delay of time D. Sonar then places the audio response on the timeline, but where? If it places the audio at the real time it will be at time 0+D = D i. e. offset (delayed) from the midi event by the delay time. What the musician and Sonar would like to do is to have all the audio and midi events line up at time zero. What the musician or Sonar must do at this point is to shift the start of the audio earlier by the delay. So something must compensate for the delay by adjusting that start time: 0 + D -D = 0. 
     
    To do that the delay time must be known. But as noted above the delay time may be different for each different synth, and even for each different patch on the same synth (some patches require more processing). So there could be slightly different delay times for two consecutive midi events in the same track. That is a difficult thing to determine for internal synths and more difficult for external gear. Additional software (drivers, effects etc.) may also be adding delay and in some cases may even be attempting to compensate for delay as well.  Automated delay compensation is unlikely to be perfect in many cases, although small differences from perfect are not significant. 
     
    The one thing you can say in the case of an audio response being placed prior to the midi event that triggered it is that it is not there because it arrived earlier in real time. Only a calculated time adjustment can yield this result. The synth has a built in delay, and a buffer can only add additional real time delay. Sonar received the audio at time 0 + D and then calculated a compensated timestamp using a delay of greater than the actual delay time. So if that is happening to you, it is because somewhere in the box delay compensation is not accurate.
     
    #6
    2:43AM
    Max Output Level: -68 dBFS
    • Total Posts : 1147
    • Joined: 2013/06/24 07:59:49
    • Location: PHX
    • Status: offline
    Re: Is My Delay Compensation Totally Borked?!? 2014/10/24 16:33:28 (permalink)
    ^^^
    I agree that it is most likely delay compensation of either Sonar or The Virus TI software that is putting the recorded audio ahead of the MIDI notes.  I have an open ticket with Access, and they are troubleshooting this for me.  They said they don't get a lot of Sonar questions much, so I think they went out and bought a copy to troubleshoot! 
     
    Tonight, I plan on testing/recording the Virus sans the USB-MIDI connection; I'll just use a plain old MIDI cable and trigger it that way.  I suspect timing of the recorded audio will be on par with the Waldorf Q and not in front of the MIDI note.  I'll post my findings.
     
    As far as the External Insert plugin...I don't know what to make of that thing.  I mean it works but it is extremely flakey.  It offsets recorded audio, and it sometimes offsets live-played audio, and it sometimes totally misaligns the metronome and/or a host-sync'ed drum synth. It is completely unstable and almost unusable.  I guess I'll need to go back to the old-school method of setting up an aux channel-return instead of having a nice, all-in-one bus.
    #7
    Jump to:
    © 2024 APG vNext Commercial Version 5.1