A solution to latency problems with an aging USB Interface

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

glorymorris

Well-known member
Joined
Apr 30, 2009
Messages
55
I designed and built this little box for some off-site sessions I'm doing over the next few weeks. Had some latency problems with a Fast Track Pro I borrowed, making it impossible to use Pro Tools Input Monitoring mode while tracking. The box switches automatically between playback signals and thru-hardware. There's a bit about it here:

http://glorytron.com/2012/12/a-bit-about-the-sync-mode-monitor/
 
I use an external analog mixer ...  maybe that is a feature to integrate into the box/build...

I do know that some vocalists and drummers can sometimes be thrown off by latency in the digital realm... for example, imagine, for the vocalist, with bone conduction through the jaw-bone and flesh conduction et cetera directly into the ear mechanisms (vestibular or otherwise) during a vibrato (or should it be technically called tremolo?), and then a delayed A/D D/A chain for the in-ear monitor system (A/Ds and D/As usually have latency inherent in the decimation and sigma delta processes; never mind the DAW)....  beat frequencies galore?

I use playback into an analog mixer for monitoring mix, whilst using the inserts on the mixer for just mic-pres to the A/Ds (and combined for an analog mix as necessary with outboard gear as needed)
 
Twenty Log said:
I do know that some vocalists and drummers can sometimes be thrown off by latency in the digital realm...

Well, we're talking about 250ms latency-- about a 1/4 second of insane slapback.

I use an external analog mixer ...  maybe that is a feature to integrate into the box/build...

This unit has a 3 channel analog mixer built into it. A standard outboard mixer, however, wouldn't solve my problem of not being able to punch in-- this device automatically switches between the playback audio from Pro Tools and the thru-hardware signal, facilitating punch-ins.
 
A handy little box for renegade recorders out in the field. I can't count the number of times that would have come in handy for remote overdub gigs. Nicely done!
 
Ethan said:
A handy little box for renegade recorders out in the field. I can't count the number of times that would have come in handy for remote overdub gigs. Nicely done!

Thanks for the kind words!
 
For punch-ins and overdubs, the DAW usually can do this with proper monitoring "style" configured in the software if using the external mixer motif, although I am not a ProTools person, so I am out of my element here; perhaps someone else can chime in...  perhaps it is just a configuration setting in ProTools?

Usually (at least for me in Nuendo), punch-ins/overdubs are non-destructive overlaid audio events/audio clips that can be later grouped into objects that can be comp'ed together...

"tape-machine style" options monitoring in Nuendo... perhaps ProTools can configure similar to this...

http://www.gearslutz.com/board/low-end-theory/341321-cubase-punch-out.html

 
One could have an hour of latency (although not convenient waiting one hour whence the play button is pushed) in monitoring as long as the driver/DAW software knows about that amount of latency and can align incoming audio properly. Even still, it works fine with the external analog mixer, where playback is the master audio of what the punch-in artist is playing against (in time and on the beat) and then the DAW knows how to align the rest given any other system latencies... This has not been an issue since early 2000 +/- IIRC with Steinberg stuff. Don't know about other DAWs. My understanding is that ProTools only recently started fixing delay compensation issues between channels, for example, for the light versions or somesuch? Version 10 methinks?
 
I think perhaps the problem isn't clearly understood. Monitoring latency and Delay Compensation are two very different things. I am not ignorant of Steinberg's DAW line, and no-- one cannot fix monitoring latency problems with Delay Compensation. This is not about insert delays, it's about roundtrip system delay caused by slow USB bus speeds and my laptop's inability to remain stable at extremely low buffer settings in the playback engine.

Yes, the DAW can align the audio correctly with the other tracks. This is accomplished by delaying the other tracks by a calculated amount (Delay Compensation), but that doesn't address monitoring latency problems. These issues are addressed by adjusting the playback engine's ability to process audio at high enough rate, ie reducing buffer size. Any amount of monitoring latency above a certain threshold is audibly perceived as an echo and with sufficient amount, it can be confusing and unworkable.

I should add here that this issue was addressed by MOTU in their converter designs beginning in 2002. An example would be the MOTU 828mk1, in which one could monitor any two adjacent channels in a dynamic switching, thru-hardware mode to deal with round trip delay on sluggish computers. It is my understanding that MOTU still uses this method of thru-hardware monitoring on all their CueMix equipped Firewire and USB interfaces.




 
Here is an example of what I'm talking about. This is a chart pulled from Avid's site comparing latency between bus types. As you can see, when one can achieve a buffer of 64 samples, USB latency can be reduced as low as 10ms using no plugins whatsoever. Compare this with the HD systems I typically use at less than 2ms. Back to USB, a buffer size of 256 samples gives approximately 18ms latency, again using no plugins. My laptop becomes unstable with a buffer size below 1024 samples, giving me an untenable degree of monitoring latency-- basically a slapback echo. I hope this clears up the issue:

217008d1296246110-no-more-pro-tools-hd-pci-crossgrade-latency-chart.jpg
 
Yes, the A/D and D/A chips will have 2mS +/- or so of delay in the decimation/sigma delta process (might be different for DSD in a continuous converter design?), such that if one were to use a monitoring methodology of piping the I2S digital data directly on the PCB from A/D microchip directly to D/A microchip then there could be a 4mS +/- round trip delay....

This is why I just use an external mixer, and kybosh the entire digital monitoring through the DAW (whether FW, USB, or other)....  I allow the DAW to line stuff up for me...  And the DAW is like a mushroom, just accepting what it is streaming into it for recording, while dumbly replaying output for playback...

I have found that changing the buffer settings can lead to overflow or underflow as you probably are aware ;) ... You may be on a Mac / Unix, but what I know from Windows is that Microsoft has delineated that their OS products are not for real-time use (but they can do well), and use Deferred Procedure Calls to handle interrupts, perhaps with 55mS latency (in the old days, perhaps better now), and sometimes through a hardware abstraction layer (HAL)... DirectX is supposed to bypass this and now WDM etc running with ASIO (in the Stienberg case)...

I am not sure of the Mac/Unix version although knowing enough to be dangerous (or stupid?) about Kernel block versus character drivers in /dev for embedded uCLinux makes me suspicious that dollars on some new hardware may help, but may not be the answer...  I dunno if "nice'ing" processes are the answer either...

I also remember ProTools having issues with the USB ports on the MacBook Pro on one physical side of the laptop rather than the other side... (one side had a single USB port -- perhaps a different chipset, whilst the other side had two ports)... I think they fixed that, but it does not give me the warm fuzzies that they are using the OS sanctioned drivers...  Perhaps this was due to their hardware locking of the MBox to the software and may not apply in this case?

In so far as USB choking... one could try USB sniffers (like usbmon, or wireshark?) or look to see if there are any system error logs etc.?

Delay compensation is part of the overall monitoring latency...  By the time all the delay compensation gets down to the mix bus there is latency based upon the largest delay factor for monitoring... this ass umes that incoming audio is going through the mixer for monitoring?

the slapback echo sounds like there is something else "mixed" in, just like wet versus dry on a delay/reverb unit?

Cuemix stuff, if I can imagine it, is probably done with an FPGA or ASIC (e.g., VIA chipsets like in M-Audio Delta 1010, e.g. block diagram of: http://www.via.com.tw/en/products/audio/usb/vt1730/index.jsp) locally on the PCB as a digital mixer...  still has some latency but not as bad as getting an OS in the way with a round trip...
 
You need ASIO drivers for low latency on evil Windoz.  Practically ALL native Windoz sound drivers have large latencies .. and even more evilly, these vary from one invocation to another.  That's why its so difficult to get more than 2 channels (ie stereo) in synch.  And we're not talking about 1 or 2 samples but zillions.
 
I think TwentyLog may be thinking too deeply about a simple issue.
Imagine the scenario where you're trying to punch in on an Eddie Van Halen solo, but you're recording your guitar part with a DI (just for the sake of this example) with headphones. Your cue mix is coming off a prerecorded track from the DAW and also monitoring the DI input through the DAW. So in this scenario the DI signal that you're monitoring through the DAW has to take a round-trip from A/D and back D/A before it hits your ears.  Considering how fast Eddie plays, the DI input monitoring that you're hearing back is going to throw off your timing. So rather than monitoring through the DAW and hearing that delayed signal, glorymorris' box switches off the DI signal in your headphones and metaphorically plugs your guitar into the Peavey 5150 amp in the room so you can monitor your guitar in real-time, then switches back to DAW output monitoring when you're done playing your best Eruption solo.
Delay Compensation is a separate issue.

Yes, this can be done manually through a mixer, but glorymorris' solution is a more convenient and "automated" solution.  When you're deep in the trenches of recording the less you have to worry about doing "manually" the better.
 
I think my other issue is that I am on my iPun/iPhone thusly I am probably missing some details on the tiny screen. But I found monitoring through the DAW not useable no matter latency/buffer settings.  4mS +/- of direct (local digital mixing in a cue mix FPGA/ASIC scenario) arriving with another mixed signal of another latency without proper delay/latency compensation from the DAW could be considered Haas effect but could make low frequency beat frequencies in an Eddie style whammy bar solo...  Yes 1/4 second is huge on the USB and DAW side.

Notwithstanding with standard default buffer settings in Nuendo 3 and two delta 1010s synced with a house clock all circa 2001,  and a SINGLE core AMD circa 2004 I have been able to record 20 channels simultaneously at 88.2k and 32-bit float ("24-bit") without issue (although to be fair and obvious it's on the PCI bus; ASIO drivers)... External mixer used to make headphone mixes for over dubs and punches.

Anyway if hardware DAW monitoring is a must, i wonder of the folllowing...Seemingly with a FireWire TC Electronic X8 system I am  able to run multiple streams of 88.2k stereo plugins (up-stream and down-stream stereo channels) where FireWire seems to have similar specs to USB 2.0. This is on the same single core...

I wonder if new drivers are available? Or is it a hardware issue e.g. which physical USB port being used...



 
Very nice box indeed.  Will you share more info on this? 

I always found that the, extra, software mixers that came with some converters worked but were a pain to use.  This is one of those things that appears to just make sense.  Why didn't I think of this before?

Again, nice job!
 
Will you share more info on this?

Sure, a lot of it's pretty straightforward. The only thing I can't share would be the info on the microcontroller and the code used to parse HUI commands from MIDI and that's because it was developed under an NDA for a design firm. Information on how to do this can be dug up on the internet though. Some guys have written HUI parsing code for PIC chips. I think ucapps.org or .com. This is important because the DAW command to Record is what handles the channel switching.

Otherwise, it's simply a mixer with three input channels, each using an inverting gain stage with volume control. The mixer output is connected to a headphone amplifier rated at .5 watts which drives two sets of cans. Two of the mixer channels-- sync and playback-- use a pair J111 Fet Mutes in parallel with associated drive circuits to either mute or unmute the selected channel. I didn't bother with series/shunt muting as I was able to achieve nearly 50db muting in a series only configuration.

The most challenging thing, in fact, was coming up with a drive circuit for the mutes. It's necessary to convert +5vdc logic to -Vee at the FET gate to get adequate muting. In other words
MUTE= 5VDC = -Vee @ FETS,
ON = 0vdc = 0VDC +/-1v @ FETS
 
Twenty Log said:
Anyway if hardware DAW monitoring is a must, i wonder of the folllowing...Seemingly with a FireWire TC Electronic X8 system I am  able to run multiple streams of 88.2k stereo plugins (up-stream and down-stream stereo channels) where FireWire seems to have similar specs to USB 2.0. This is on the same single core...

OK, now I'm totally confused ...

Native plug-ins have nothing to do with the data transport (FireWire, USB, whatever). Instantiating some number of plug-ins will increase processing overhead and possibly latency (handled by delay compensation in the DAW) but it doesn't matter how many inputs and outputs you have going over the wire to the interface.

-a
 
glorymorris said:
This is not about insert delays, it's about roundtrip system delay caused by slow USB bus speeds and my laptop's inability to remain stable at extremely low buffer settings in the playback engine.

It's not "slow USB bus speed." The bus is plenty fast enough. The issue is latency due to buffering in the host. For whatever reason, the buffering is excessive.

-a
 
Andy Peters said:
glorymorris said:
This is not about insert delays, it's about roundtrip system delay caused by slow USB bus speeds and my laptop's inability to remain stable at extremely low buffer settings in the playback engine.

It's not "slow USB bus speed." The bus is plenty fast enough. The issue is latency due to buffering in the host. For whatever reason, the buffering is excessive.

-a

Pretty sure you know what I mean.
 
OK.... what I was thinking of before fat fingering to remove half the last post was, that yes, bandwidth should be bonzer, but when more channels get TDM'ed into the stream, that more delay is expected (to be compensated properly by the DAW, buffered, latency compensated et cetera)...

So my question, is whether the driver is padding a bunch of extra channels into the USB stream? probably does not have much to do with buffer sizes?
 

Latest posts

Back
Top