Difference between revisions of "Electronic music - notes on audio latency"

From Helpful
Jump to: navigation, search
m ("So which API is best?")
m ("So which API is best?")
Line 380: Line 380:
  
 
===="So which API is best?"====
 
===="So which API is best?"====
 +
 +
=====Windows APIs=====
 
<!--
 
<!--
 
 
 
'''When choosing new hardware'''
 
'''When choosing new hardware'''
  
Twenty-something years ago, ASIO was an acronym basically meaning "unlike others, we ''did'' care about latency when writing this driver", so if you wanted low latency, that was the acronym to look for.
+
Twenty-something years ago, ASIO basically meant "we ''did'' care about latency when writing this driver, unlike generic audio hardware", so if you wanted low latency, that was what you wanted.
  
  
A lot of hardware and drivers have recently focused on fairly low latency, meaning that even generic audio may be low enough latency for all instrument playing, including drums, and the only issue left is live processed signals, often vocals.
+
A lot of hardware and drivers have recently designed with low latency in mind, meaning that even generic audio may be low enough latency for all instrument playing, often including drums, and the only issue left is live processed signals, often vocals.
  
 
For example, I have a cheap motherboard with built-in audio is the same, apparently slightly lower latency (via WASAPI) than both my (cheapish) ASIO USB audio interfaces.
 
For example, I have a cheap motherboard with built-in audio is the same, apparently slightly lower latency (via WASAPI) than both my (cheapish) ASIO USB audio interfaces.
Line 418: Line 418:
  
 
That said, things like ''native ASIO &ge; ASIO-wrapped WDM/KS or WASAPI &ge; WASAPI or WDM KS &gt; OS-mixed WDM or MME'', while not wrong, can be misleading because  
 
That said, things like ''native ASIO &ge; ASIO-wrapped WDM/KS or WASAPI &ge; WASAPI or WDM KS &gt; OS-mixed WDM or MME'', while not wrong, can be misleading because  
* ''for a given piece of hardware'', the first three may be basically the same.
+
* ''for a given piece of hardware'', the first three may be roughly the same.
:: And may be higher and lower than other hardware
+
* And may be higher and lower than other hardware
 
* most of this describes the layers on top of the driver, and none can do anything about lazy driver driver, or hardware that can't be pushed further
 
* most of this describes the layers on top of the driver, and none can do anything about lazy driver driver, or hardware that can't be pushed further
  

Revision as of 21:14, 10 June 2021

The physical and human spects dealing with audio, video, and images

Vision and color perception: objectively describing color · the eyes and the brain · physics, numbers, and (non)linearity · color spaces · references, links, and unsorted stuff

Image: file formats · image processing

Video: format notes · encoding notes · On display speed


Audio physics and physiology: Basic sound physics · Human hearing, psychoacoustics · Descriptions used for sound and music

Digital sound and processing: capture, storage, reproduction · programming and codescs · some glossary · Audio and signal processing - unsorted stuff


Electronic music: Some history, ways of making noises · Gaming synth · Notes on audio latency ··· microphones · studio and stage notes · Effects ·

Music electronics: device voltage and impedance, audio and otherwise · amps and speakers · basic audio hacks · Simple ADCs and DACs · digital audio · multichannel and surround ·

Noise stuff: Stray signals and noise · sound-related noise names · electronic non-coupled noise names · electronic coupled noise · ground loop · strategies to avoid coupled noise · Sampling, reproduction, and transmission distortions · (tape) noise reduction


Unsorted: Visuals DIY · Signal analysis, modeling, processing (some audio, some more generic) · Music fingerprinting and identification

For more, see Category:Audio, video, images


Why latency exists (the long version)

Hardware, and the nature of digital audio

Why larger buffers are generally useful

On drivers and APIs

Windows APIs

Some history

On ASIO wrappers

This article/section is a stub — probably a pile of half-sorted notes, is not well-checked so may have incorrect bits. (Feel free to ignore, fix, or tell me)


ASIO usually refers to a driver talking directly to the sound hardware and exposing the ASIO API, much of the point being ignoring windows's sound architecture completely.


ASIO wrappers are different (and the above is often called 'native ASIO' in contrast).

ASIO wrappers open a sound card via a regular Windows sound API (in practice typically WDM/KS or WASAPI), force settings that are lower latency, and present it via ASIO API.

Yes, this is counter to ASIO's shortest-path-to-the-hardware principle.

And yes, you will only get latencies that were always possibly to get from that underlying driver API anyway.

So why add a layer?


Convenience, mostly.

  • It lets you have just one place to configure a small-buffer, possibly-exclusive way to these existing APIs.

You figure out the details just once, in the wrapper's settings, rather than for every DAW-soundcard combination you have, which is usually more work, and the config details may vary somewhat between DAWs which is sometimes more fiddly and/or confusing.

Not unimportantly, using that wrapper can also be easier to explain to people who care more about music than decades of programing history.
  • There's also some DAWs/software that speak mainly or only ASIO, because their approach is to figure out low latency in something external, and talk to that,


There's a few more useful reasons hiding in the details, like

  • you can often force WASAPI card to be fairly low-latency without exclusive mode, which means you don't have to dedicate a sound card, to a DAW that only talks ASIO. Which is pretty convenient e.g. when playing piano on a laptop on the go.
  • some ASIO wrappers can talk to on different sound cards for input and output, at the cost of slightly higher latency, which DAWs talking native ASIO will typically refuse to do (for latency reasons).



As far as I can tell

  • FL Studio ASIO (a.k.a. FLASIO) is a WASAPI wrapper.
Comes with FL studio, also useful in other DAWs
can talk to different sound cards for input and output
  • ASIO4ALLv2 is a WDM/KS wrapper.
needs to force exclusive mode
can talk to different sound cards for input and output
  • "Generic Low Latency ASIO Driver" is similar to ASIO4ALL but with different options
Comes with Cubase


And there appear to also be ASIO multiclient wrappers, basically ASIO in ASIO.

ftp://ftp.steinberg.net/Download/Hardware/ASIO_multiclient_driver/


"So which API is best?"

Windows APIs

Linux APIs

OSX APIs

Lowering latency

In general

Everyday latency

Decide how low is necessary

The basic steps

API stuff

Windows API tweaking

Use a sound API designed for lower latency

Use sound API settings that lower the latency: exclusive mode

Use sound API settings that lower the latency: smaller buffer sizes

Linux API tweaking

OSX API tweaking

DAW considerations

Considering effects

Higher sample rates?

"Delay compensation?"

End-to-end latency

Further considerations

Hardware bus?

On network latency

Unsorted