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?
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.
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.