I am looking to do some real time audio processing on a PC (it could be Windows or Linux). For that I need to get digitized audio data from a microphone very quickly. I am wondering what is the typical range of latency I should expect. Is it in the range of micro seconds? Between 1 to 10 ms? More than 10 ms? If it is more than a few ms, is there a way to reduce it to 1 ms or less? If it is not possible on a PC, are there audio card development kits with DSP processor suitable for real time audio processing?
-
In my playing around with a guitar and bass the other night, I found 5 ms round-trip latency barely acceptable. I could not play my best with 10 ms latency - in fact I just would find a different solution if that were the best I could get. Less than 5 ms round-trip would probably be ok with most musicians, I'd be surprised at anyone noticing less than 1 ms (if that's obtainable).– Todd WilcoxCommented Nov 10, 2015 at 15:24
2 Answers
There are many variables that affect total latency because there are several sources of latency. Latency is introduced by the analog to digital conversion process, and then by several different buffers, such as the bus buffer (e.g., the USB buffer) and usually at least two software buffers (from the driver and the DAW). If any plug-ins are part of the signal chain, it gets a lot messier, with some plug-ins introducing 500ms or more of latency (that's rare for most plug-ins but possible or even likely for look-ahead peak limiters or convolution reverbs).
RME, for example, advertises a latency for their BabyFace interface as low as 14 samples for OS X drivers. At a 96 kHz sampling rate, that amounts to less than 1 ms. That's only part of the picture. On my computer, I run the buffer for Ableton Live at 128 samples, which at 44.1 kHz is over 6 ms of latency, and that's one-way. Total round-trip latency for my current settings are about 12ms, which is not fast enough to record with.
In practice, I have always valued reliable recording, which means I want larger buffers, since a buffer underrun is a gap in the recording. Larger buffers mean more samples of latency. Therefore, I make sure I can always monitor without relying on audio routed through the DAW. When I'm recording in a DAW channel, the channel is record armed but also muted. I then use either a mixer or interface low-latency monitoring (a digital mixer built into the interface) to combine near-zero latency audio of the performance mixed with the existing backing tracks or click track.
If you want super-low latency digital audio processing, one option is to get dedicated processing power. There are many audio interfaces available now that including some basic audio processing (e.q., EQ, reverb) as part of their low-latency monitoring digital mixers. There are a few high-end products that combine an interface with dedicated DSP that can be used real-time or for editing and mixing, such as the UAD Apollo products.
As JCPedroza commented, there are tools available to allow real-time processing using native CPU power. I don't know much about those at this time.
With an inexpensive (160 USD) USB audio interface, running OS X on a MacBook Pro with an i5 processor, I can't get the round trip latency lower than about 6ms without really bad artifacts. I suspect a better interface would give me better results. Apparently most of the Thunderbolt interfaces have much lower latency than the USB ones.
Edit: There's a latency chart for one brand of fast Thunderbolt interfaces here.
Round Trip Latency* (ms) tested at 96kHz on OS 10.10 and Mac Pro Buffer Size Pro Tools 11 Logic Pro X Cubase 7 Ableton Live 9 Reaper 4.7 32 n/a 1.67 1.67 2.09 1.44 64 1.38 2.33 2.33 2.42 2.11 128 2.29 3.67 3.67 3.76 3.44
From this we can deduce several things:
- You can get less than 1 ms latency on-way, from mic to samples, but going round-trip takes about double the time and that will be more than 1 ms for all but the most expensive interfaces.
- The software you use matters (I was surprised to see ProTools with the lowest latency).
- Smaller buffer sizes are critical for getting the lowest latency, but can lead to sound quality issues if the computer is underpowered.
- Higher samples rates (the 48 kHz sample rate chart isn't quoted here, but it is slower) are also critical for getting the lowest latency, but again put pressure on the computer hardware.
TL;DR: With the right (mostly expensive) interface, computer, and software, it can be done.
-
1Great answer, but maybe you are under rating computer CPUs for real time audio and live use. There are countless examples of artists successfully incorporating CPUs for live performance audio processing, one famous example is Nine Inch Nails using Mainstage, which runs everything "from vocal effects to guitar patches". Check youtube.com/watch?v=4kU0skUZTIw Commented Nov 7, 2015 at 22:51
-
@JCPedroza If Apple wanted to sell me on something, having NIN performing Survivalism in the video is a good way to do it. Also I was just working with a bass player today and we were talking about making an entire keyboard rig out of a laptop and thinking we couldn't do it, but now it looks like we possibly can. Thanks! Commented Nov 7, 2015 at 23:02
I've been using linux for real time music for many years, and have never had a case where end to end latency was more then a couple of milliseconds. Check out kxstudio. I can not speak to windows or mac as I haven't had experience with using those for music.
I don't have the reps to comment, but of course be careful of taking a laptop on stage, especially with a USB audio interface. But that's another subject.
-
If you are using linux, than I think that your jack Gui should display your latency. But I'm almost sure that it will not include any latency in your audio card or modules. The gold standard, if you want to include everything in the audio chain, is to wire your audio out to your audio in, and record both on separate tracks. Then bring them up in audacity or the like and measure. Commented Nov 8, 2015 at 1:39
-
Oh and by a "couple of milliseconds", that was in general. If the bootup is dedicated to this application, and you are only doing this dedicated realtime application, then unless your processing is a real hog, then you should get under 1ms these days. Again the caveat would be if you are using USB audio, but even so, with usb3, I wonder if that is still an issue. May I ask why you are asking this? Commented Nov 8, 2015 at 1:50
-
1To measure latency, you connect audio out to audio in, and record both to separate tracks. Then in audacity or whatever, measure the difference. Commented Nov 8, 2015 at 2:05