The Universal Serial Bus. The one bus to rule them all. It brought peace and stability to the world of computer peripherals. No more would Apple and PC users have to buy their own special keyboards, mice, and printers. No more would computers sprout different ports for different types of hardware. USB was fast enough and good enough for just about everything you’d ever want to plug in to a computer.
We mostly think of USB devices as being plug-and-play; that you can just hook them up and they’ll work as intended. Fiddle around around with some edge cases, though, and you might quickly learn that’s not the case. That’s just what I found when I started running complicated livestreams from a laptop…
Fool To Try
When I’m not writing 5,000 words a day as the most forgettable journalist online, I’m running a musical livestream on Twitch. I invented Drumbeats and Dicerolls— a show in which I roll dice in order to write music in Ableton Live. The dice choose the instruments and sometimes even the notes, and then it’s up to me to turn all that into a coherent song.
The concept is simple enough, but on the technical side, it gets a little complicated. Video-wise, I use two webcams—one for me, one to film the dice as I roll them. That’s two USB devices right there. Then I have my mouse and keyboard, both running via a single Logitech wireless dongle. Finally, I have my Steinberg UR22 audio interface—basically a soundcard in an external box that has musician-friendly hookups for professional-grade mics and speakers.
It all adds up to four USB devices in total, all with USB-A ports. That doesn’t sound like much. Only, since my desktop was stolen, I only have a laptop to run the whole show. That presented an immediate hurdle, as my laptop only has two USB-A ports on board, plus a USB-C port on the rear.
I figured I’d hook up a USB-C hub with a few extra ports, and along with my monitor’s additional USB hub, I’d be all good. Trouble struck as I first attempted to stream in this way. Both webcams worked, with one of them even running through a separate NVIDIA Broadcast tool to do some background removal. However, the audio was problematic. Every ten to twenty seconds or so, the sound would drop out or stutter. It was incredibly jarring for a music stream.
Not So Simple
I was frustrated. This was a problem I’d never had before. In normal life, I’d always just plugged whatever device into whatever USB port with no problems. Even when I’d chained hubs off hubs, I’d seen little issue, even with high-bandwidth devices like HD webcams or portable hard drives. And yet, here I stood. I was plugging, but the gear wasn’t playing.
At first, I figured I just had to tweak my software setup. I was using the Steinberg UR-22 via the Windows Wave drivers in Ableton. I figured if I just used the professional-grade ASIO sound driver instead, my stuttering problem would go away. However, then I found that my streaming software couldn’t naturally capture audio from this device. This necessitated pulling in the Reastream plugin to truck audio from Ableton into Streamlabs, but that wasn’t so hard. I tried a test recording offline, and it all worked great. No stutters, no problems. Only, as soon as I tried streaming live… the stuttering was back, in a big way.
For my second stream, I switched things up. I ended up using a USB headset plugged right into my laptop’s native ports for audio, back with the Windows drivers, and kept the Steinberg UR-22 just for recording vocals into the machine. This worked great, with no stuttering on playback. But I had a new problem—only one of my webcams would work at a time. Oh, and the mic feed from the Steinberg was dropping out randomly, ruining my vocal recordings.
Looking at the mess of cables and daisy-chained hubs in front of me, I realized I had to simplify. I put the Steinberg device on the most direct hookup, straight to the laptop’s USB-A port, and set it back up in ASIO mode. Then I connected both webcams to a Lenovo docking station, hooked up by USB-C. I eliminated any extra hubs, ditched the USB headset, and had the most critical device—the Steinberg—connected by a single cable. This had to solve it, right?
Well, the webcams were now humming along nicely, probably because they now had enough power from the docking station instead of an unpowered hub. But were all the problems fixed? Alas, no. Try as I might, the Steinberg device would stutter every few seconds or so. I double-checked that I didn’t have a CPU, RAM, or hard drive issue—everything came back clear. But for some reason, two webcams and an ASIO device was making the audio choke.
Brick Walls
Hours more troubleshooting rushed by. After all this, I’ve come to findings that confound me as an engineer. I can run two HD webcams and a USB headset with no dropouts, just using basic Windows audio drivers. And yet, trying to use the Steinberg audio interface, it just falters. Even with the webcams degraded to ultra low resolution! This interface has seen me through thick and thin, but it just won’t work under these conditions. Despite the fact it’s using the same sample rate as the USB headset, and should surely be using a similar amount of bandwidth. Regardless, its driver tells me there’s a USB problem and I can’t seem to solve it.
The one thing that itches my brain is that the stuttering seems to only happen when I’m streaming live online. When I’m not streaming video, the Steinberg happily operates as rock-solid as the cheap headset. The thing is, my network connection is via a PCI-Express WiFi chip baked into the laptop, so… that’s not even a USB thing.
When I started writing this a week ago, I thought I’d have solved it by now. I’d have a nice clear answer about what went wrong and how I figured it all out. That didn’t come to pass. Part of me wants to rush out and build a desktop PC with a real amount of ports to see if eliminating hubs and nonsense solves my problems. The other part of me wants to redouble my efforts to track down the issue with every last USB inspection utility out there. I’ll probably do the latter and update this article in due course.
Instead of a neat solution, all I’m left with is confusion and a cautionary tale. Just because you can plug a bunch of USB devices together, it doesn’t mean they’ll all work properly and play nicely together. Our computers are more complicated than we expect, it’s just they’re better at hiding it from us these days.
Regarding the webcams, IIRC some don’t down sample on the device but always stream full data and let the software resample the selected dimensions so there is no effect/release of the bandwidth
This was just a problem statement! I expect if it is on Hackaday it is a bit deeper than I switched around a bunch of drivers and hub configurations. Where is the USB bus analysis?
I hope this is not a trend. Let’s at least have tags showing this is a user level article versus what is normally expected here.
Anyway, just expressing my opinion to provide feedback to help keep Hackaday up to “standards” lol
Once commenters help him find the solution, it should be a very useful article.
What edge case? The article doesn’t even narrow down a specific “case”.
It happens only when streaming yet the scope never went away from “fiddling” with USB stuff.
Agreed. There’s not even certainty that this is a USB issue.
No logs? No USB protocol sniffing?
We learned nothing except extended details of his gripe.
Have you tried a wired ethernet connection? I get a lot of audio glitches when using Teams over WIFI
good Idea but @”Lewin Day”: Using a public HaD article for your personal error diagnostics support???
Look in device manager to see how things are really hooked up. Your Wifi may actually be going over USB.
can confirm audio tends to be where usb problems pop up. i have a usb microphone on my raspberry pi 4b, and whenever i run audacity it tries to initialize the sound driver in some sort of DMA mode, and the whole raspi immediately locks up hard. (side story, no point trying to debug it…you will not get a community-provided patch to this kernel bug because raspi i/o drivers all go through badly-designed closed source layers) obviously, it works on my laptop but i don’t want to use the laptop for recording.
audacity always tries to open the devices in dma mode to minimize latency so you can monitor your effects in real-time. i didn’t want that feature and a consistent quantifiable latency so the tracks can be aligned with eachother was my only goal, so i wrote my own multi-track recorder that uses the default i/o, and it works fine even on the pi.
i bring this up because i wouldn’t be surprised if your streaming software also tries to use a dma mode, when really a non-dma mode would probably suffice. kind of frustrating how things bend over backwards to minimize latency when quantifying it for sync is really all that’s necessary. wouldn’t matter except that the dma mode is still sketchy for whatever reason.
as a counterpoint, for non-audio uses, i am using a 20+ year old 12′ usb-A extension cable with a 20+ year old unpowered usb 1.1 hub and it started to flake out on me (constantly resetting my devices…which means the dang backlight on my keyboard kept turning on) so i sprayed contact cleaner in all of the jacks (with it still plugged in to my pc, naturally) and then did the insert/removal dance a couple times for each, and now it’s rock solid again. when usb ‘just works’, it really just works!
I worked at a software company that installed and supported automated carwash systems. It was quite surprising how often a bit of the old in-out was the solution to USB problems. I think you can even end up with capacitance building up and discharging with corrosion and such. I don’t remember what R&D said anymore, but the confirmed dirty USB ports cause the weirdest problems.
” i have a usb microphone on my raspberry pi 4b, and whenever i run audacity it tries to initialize the sound driver in some sort of DMA mode, and the whole raspi immediately locks up hard”
That’s why I liked USB 3.0, it provided DMA as an alternative to polling and bulk transfer.
The original USB 3.0 predated the USB naming chaos, also.
USB 3.0 was fine for external HDDs, for devices in need of more current.
I really liked USB 3.0 with the old USB A and USB B connectors.
Looking back it was first time that I liked USB, at all, I think.
Because I still miss the traditional PC connectors..
Serial, Parallel, Gameport/MIDI-Port, 8-Bit SCSI, PS/2 keyboards..
These connectors were so fun to tinker with!
The Gameport had an ADC that could be used to digitize analog data and it had four digital switches to read out.
You could directly read the port states in Visual Basic, for example.
Or let’s take serial ports.. DOS/Win/3.1/95 Games used to support null-modem gameplay.
Back in the 90s, you made your own 20m 3-wire cable on a weekend.
That was fun!
Heck, I even miss FireWire! 😃
It was so much better than USB, especially in audio applications, video editing and networking!
Professional audio equipment had featured FireWire ports, too. Much better than stuttering USB 1.x/2.x!
A whole article and days (weeks?) of troubleshooting USB devices on a Windooze machine and no mention of https://www.uwe-sieber.de/usbtreeview_e.html ?
Each USB camera needs to be plugged in to the its USB host controller. Its best to build a computer using a motherboard with dedicated PCIE lanes for each host controller. Don’t run any real data interfaces through a hub. Cameras and audio interface USB drivers/classes just aren’t made for that.
In my experience hubs are fine as long as they’re rated for the same or higher speed as any downstream device AND are adequately powered. My current setup is 4 hubs deep and rock solid.
Laptop -> Thunderbolt Dock -> USB Switcher (Keyboard, Mouse, Monitor Hub) -> Monitor Hub (4k Webcam, USB Hub) -> USB Hub (Wireless Headset, SD Card Reader, +2x ports)
Good morning Lewin,
As Bill stated, try a wired ethernet port and disable the wireless ethernet.
From your symptoms, the issue ONLY arises when the wireless port is being heavily used by streaming.
I believe you MAY have an interrupt issue where the wireless ethernet is using the same interrupt as one (or more) of your serial ports.
Hope this helps identify and perhaps correct your issues.
Regards,
Rick
It doesn’t need to be interrupts – I have seen some USB devices creating radio interferences with 2.4 GHz Wifi. I have also seen other people report similar issues.
Just use wired ethernet for everything that must be low-latency and reliable, like streaming.
I recently switched work computers and the Windows audio service on my new one crashes whenever the speaker is enabled on a Logitech webcam. If I go into device manager and disable the webcam’s speaker everything is hunky dory again. wouldn’t hurt to tythe same in you’re situation, at least under what seems a fairly safe assumption that you aren’t using its speaker.
Put a KVM in the middle and get all the USB devices to work right on 2 computers. Just for kicks make those 2 computers be virtual machines with passed through PCIE USB controllers.