사용자 도구

사이트 도구


Action disabled: backlink
음향:digital:latency
[공지]회원 가입 방법
[공지]글 작성 및 수정 방법

레이턴시

Latency : 지연 시간

디지털 세상에서는 아날로그소리디지털로 바꾸거나, 디지털아날로그로 변환할 때 시간이 걸리고, 사운드를 처리하는 데에 모두 시간이 걸린다. 그 시간을 레이턴시라고 한다.1)

Roundtrip Latency

우리가 소리를 듣는 데에는 위 그림처럼, A/D 컨버팅 과정에서 걸리는 시간, 하드웨어적으로 그 변환된 디지털 신호를 CPU에서 계산할 수 있도록 메인 메모리에 기록하는데 드는 시간(BUS input buffer latency), ASIO 에서 소리를 처리하는데 걸리는 시간(ASIO input latency)을 거쳐서 다시 ASIO에서 소리를 내보내고(ASIO Output Latency), 그 계산 처리 결과물을 메모리에서 기기로 다시 이동시키고(BUS Output Buffer Latency), 그 디지털 신호를 다시 아날로그 신호출력하는 D/A 컨버팅의 시간이 걸린다.

우리가 DAW오디오 인터페이스 설정 등에서 볼 수 있는 Input, Output Latency는 이러한 BUS LatencyASIO Latency 값만을 합산해서 보여준다. 그리고 이러한 Input/Output 레이턴시의 총합을 Roundtrip Latency라고 한다. 2) 여기에 A/D, D/A 과정에 따른 레이턴시까지 합산한 값은, 실질적으로 측정 프로그램으로 측정해야 하며 Realworld Latency라고 한다.

만약, PCI 방식이나 PCIe 방식, Thunderbolt, Ethernet 또는 일부 USB 방식 등에서 DMA (Direct Memory Access)가 지원되어 CPU와 메모리에 직접적으로 디지털 신호를 보내고 받을 수 있는 오디오 인터페이스라면 BUS Input, Output Latency 는 없거나 매우 짧은 시간이다.3) 이러한 DMA 기능을 가진 오디오 인터페이스를 비동기식(Asynchronous)이라고 한다. DAWASIO 데이터를 CPU 처리하는 동일한 시간에 작동하지 않고, 입출력에 입력되고, 나가는 오디오 데이터를 메모리에 미리미리 전달하여 처리하기 때문이다.

Thunderbolt의 경우 태생이 PCIe 방식에서 왔기 때문에, 이러한 비동기식, DMA 동작을 자체 칩셋을 통해 직접 처리할 수 있는 경우가 많고4), USB 의 경우는 오디오 인터페이스 USB 컨트롤러 칩셋 자체에 DMA 를 처리해주는 기능이 들어가 있으면 DMA 동작을 수행할 수 있다.5) 이더넷의 경우에는 이더넷 오디오 프로토콜을 연결하는 인터페이스 카드에서 DMA 지원 여부가 결정된다.


단테 전용 칩으로 DMA 동작을 수행하기 때문에 엄청나게 낮은 레이턴시를 보장하는 Dante accel card

대역폭과 레이턴시

많은 사람들이 Thunderbolt 같은 대역폭이 높은 연결방식이 당연히 레이턴시가 짧을 것이라고 생각하는 경우가 많다. 하지만 대역폭은 어디까지나 대역폭일 뿐이고 오디오 처리 속도와는 관련이 없다. 사실 아주 예전의 오디오 인터페이스들의 경우는 대역폭이 너무 낮아서 한번에 처리해야 할 비트레이트를 한번에 처리하지 못하고 두번, 세번에 걸쳐 전송하는 경우가 있었으나 지금의 인터페이스들의 전송 대역폭은 오디오 신호의 실시간 비트레이트보다 훨씬 높기 때문에 지금은 해당하지 않는다. 24-bit 96kHz 1채널(모노)의 비트레이트는 2.3Mbps 이고, 64채널동시 녹음시 2.3 x 64 = 147.2Mbps 이다. 이는 USB 2.0의 이론상 대역폭인 480Mbps(일반적인 USB 2.0 기기는 실제적으로는 70%(288Mbps) 정도의 성능을 내어준다고 한다.)에 못미친다.


UA apollo Thunderbolt 레이턴시, 48kHz 128 samples


Scarlett 2i2 USB 레이턴시, 48kHz 128 samples

8차선 도로를 달리는 최고 속도 100km/h 차와, 2차선 도로를 달리는 최고 속도 100km/h 의 차를 생각하면 된다. 대역폭은 도로의 차선에 해당하고, 레이턴시는 최고 속도에 해당한다. 여전히 속도는 100km/h로 동일할 뿐이다.


Near zero latency

  • 거의 0에 가까운 레이턴시
  • 보통 2ms 이하를 말한다.

보통 오디오 인터페이스DSP 믹서디지털 믹스 콘솔에서 많이 사용하는 용어로, 일반적인 DSP 믹서는 완벽한 제로 레이턴시로 동작하지 않기 때문에 제로 레이턴시라는 말보단 Near zero latency라는 말을 사용한다.6) DSP 칩을 무엇을 쓰느냐에 따라 달라질 수 있고, DSP 믹서 소프트웨어에 따라서도 달라질 수 있으나, 보통 2ms 이내로 동작하도록 만든다.

가상악기의 레이턴시와 실제 오디오 녹음 시의 레이턴시

상황 별 레이턴시

우리가 VSTi 등의 가상악기를 연주할 경우, MIDI 입력 레이턴시는 0ms에 가깝다. 오로지 ASIO Output Latency, D/A 레이턴시만이 악기소리오디오 출력에 관여하기 때문에, MIDI 시퀀싱이나 VSTi 연주 등에서는 일반적으로 ASIO Output Latency 만 고려하면 된다. ASIO input 레이턴시와는 관계가 없기 때문에, 입력되는 오디오에 대한 소프트웨어 모니터링을 하는 경우보다 절반 정도의 레이턴시만 고려하면 된다.

사실, 실제 피아노의 경우에도 건반을 끝까지 누르고 나서 해머가 현을 때릴 때까지 약 5ms 정도의 레이턴시가 있다.7) 아마도 어느 정도 존재하는 ASIO Output latency 는 이와 비슷하게 셋팅될 것이다.

ASIO Buffer 만을 고려한 이론적인 레이턴시

ASIO 처리가 실시간8)으로 이루어지고, 칩셋에 의한 아무런 추가 레이턴시가 없는 이상적인 오디오 인터페이스라고 가정 했을 때,

레이턴시

44.1kHz 512 samples 일 때, 512 samples/44.1kHz = 약 11ms.
이고, Input/Output 동시에 고려하면 ASIO 레이턴시만으로 총합 22ms 가 나오게 된다.

따라서, 이것은 상당한 지연시간(레이턴시)를 발생시키고 실제로 연주를 DAW소프트웨어 모니터링하여 녹음하는 데에는 문제가 크다.

96kHz, 512 samples=512/96 = 5.3ms
96kHz, 128 samples=128/96 = 1.3ms9)

위의 계산에서 보면 ASIO Latency 말고 추가로 레이턴시가 존재하지 않는 이상적인 오디오 인터페이스의 경우라도 128 Samples 96kHz에서 최소 Roundtrip Latency10)가 2.6ms가 됨을 알 수 있다.

보통 디지털 믹서DSP 믹서들에서 Near zero latency라고 할때 레이턴시를 2.0ms 이하로 만들기 때문에, 2.6ms 정도면 실시간으로 오디오소프트웨어 모니터링으로 들으면서 사용하는 데는 무리는 없을 것 같다. 하지만, 이 이상의 레이턴시라면, 아마도 민감한 연주자나 보컬은 소리가 살짝 늦게 나오는 것 같다며 불평 할 수 있다. 보통 인/아웃 전체 레이턴시가 5ms 정도 이상이 되면 불편하게 된다. 11)

실제 연주와 레이턴시의 관계

음악은 생각보다 정밀하다.

탬포 180을 예시로 든다면 1분에 4분 음표가 180개 즉 1초에 4분 음표가 3개 4분 음표 1개=0.3 초

따라서

16분 음표 1개=0.07초=70ms

그래서 3.5ms의 레이턴시만 있어도 연주자에게는 5%의 오차이다.
7ms의 경우에는 10%의 오차
14ms의 경우에는 20%의 오차
20ms의 경우에는 30%의 오차 이것은 연주에 심각한 문제를 가져올 수 있는 수치이다.
DAW를 통한 소프트웨어 모니터링의 문제점은 바로 여기에 있다고 볼 수 있다.

사람이 인식할 수 있는 레이턴시 한계는 15ms?다?

립 씽크

보통 인터넷 등지에서 15ms, 20ms 에 대한 이야기가 많이 돌고 있는데, 이것은 화면의 프레임을 60fps 로 계산 할 때, 1 초를 60으로 나누면 1000/60=16.6ms(50fps 의 경우는 20ms)를 기반으로 하는 이야기 이다. 컴퓨터 게임이나 모니터 화면의 주사율이 60fps 이기 때문에, 게임을 구동하거나 마우스 커서 등은 16.6ms 안쪽에서 연산이 마무리 되면 화면에는 60fps프레임에 맞춰 표현하는데 아무런 문제가 없기 때문에 하는 이야기 이다.

오디오에서는 절대 적용되지 않는 이야기 이다.

오디오에서는 16.6ms 만 되도 소리가 늦게 나오거나 소리가 많이 이상함을 당연하게도 느낄 수 있다.

소프트웨어 모니터링 VS 하드웨어 모니터링

소프트웨어 모니터링

DAW 등을 통해 ASIO Buffer 를 사용하며 소프트웨어 모니터링하는 경우는, DAW믹서 시스템을 이용할 수 있고, 플러그인 이펙터 등을 적용한 소리로 들리는 장점이 있으나, 위의 항목들처럼 Buffer를 작게 설정해도 2ms 이하의 레이턴시는 기대하기 힘들다. 물론 컴퓨터 성능이 더 발전하여 더 작은 Buffer에서도 안정적으로 동작할 수 있게 되면 가능해 질 수 있지만, 플러그인이나 악기를 사용하게 되면 작은 Buffer에서는 사용할 수 있는 플러그인이나 악기의 갯수에 제한을 받게 되므로12) Buffer를 점점 늘려서 사용하게 되고, 그러다 보면 Roundtrip Latency는 점점 늘어가게 된다.13) 따라서 소프트웨어 모니터링을 통한 Near zero latency의 실현은 현실적으로는 아직은 매우 힘들다고 볼 수 있다.

하드웨어 모니터링

콘솔 모니터링, 다이렉트 모니터링

그에 비해 아예 아날로그 믹서 를 통해서 모니터링하고 녹음오디오 인터페이스로 한다던지, 오디오 인터페이스의 자체 다이렉트 모니터링 기능이나 자체 내장된 DSP 믹서를 이용한 모니터링의 경우는 어떠한 경우에도 실시간(Zero Latency 또는 Near zero latency)을 보장하기 때문에, 연주 녹음이나 보컬 녹음을 하는 경우에 가급적 소프트웨어 모니터링은 끄고 이러한 하드웨어 모니터링을 하는 것이, 녹음 퀄리티 향상에 도움이 된다.14)

다만 하드웨어 모니터링은 오디오 인터페이스에서 자체적으로 들어오는 오디오 신호를 바로 모니터링으로 보내주는 것 이므로, DAW에서 사용되는 믹서플러그인 등과는 상관 없이 원래의 오디오 인터페이스에서 처리된 소리로만 들리게 된다.15)

가급적, 녹음 시에는 소프트웨어 모니터링은 보다는 다이렉트 모니터링, 또는 콘솔 모니터링을 사용하는 것을 추천한다.

게임 모드

TV 나 사운드 기기 등에서 게임 모드(Game Mode)라는 것을 지원하는 경우가 있다. 이것은 영상 장치나 오디오 장치가 내부적으로 DSP를 이용하여 화면이나 사운드에 자체 처리를 하고 있는 경우에, 이 기능을 끔으로써 자체 처리에 걸리던 시간(레이턴시)를 제거하여 빠르게 화면이나 사운드가 나올 수 있도록 하는 기능이다.

Latency

레이턴시: Time delay, time latency

In the digital world, when converting analog sound to digital or vice versa, and when processing sound, time is required. This time delay is called latency. (In simple terms, it means sound is delayed.)

Roundtrip Latency

When we listen to sound, it goes through several stages, as shown in the image above. It starts with the time it takes during the A/D (analog to digital converting) process, then the time needed to record the converted digital signal into the main memory (Bus input buffer latency), the time for processing sound in ASIO (ASIO input latency), and then outputting sound from ASIO (ASIO Output Latency). Afterward, the calculated results are moved from memory back to the device (Bus Output Buffer Latency), and finally, the digital signal is converted back to an analog signal during the D/A (Digital to Analog Converting) process.

The Input and Output Latency values you see in the audio interface settings in your DAW are the sum of Bus Latency and ASIO Latency values. The total latency, including the latency caused by the A/D and D/A processes, should be measured using dedicated measurement software and is referred to as Realworld Latency.

If you are using an audio interface that supports DMA (Direct Memory Access) through methods like PCI, PCIe, Thunderbolt, Ethernet, or certain USB configurations, then Bus Input and Output Latency are either nonexistent or very short. This is because these interfaces can send and receive digital signals directly to and from the CPU and memory. Such audio interfaces are sometimes called asynchronous, as they don't operate at the same time as the DAW, but rather deliver and process audio data in advance for input and output.

PCIe and Thunderbolt interfaces, originating from the PCIe standard, often have the capability to handle DMA through their chipsets, which results in very low latency. However, USB interfaces can also achieve low latency if their USB controller chipset includes DMA functionality. Ethernet interfaces, on the other hand, depend on the presence of DMA support in the interface card that connects to the Ethernet audio protocol.

Bandwidth and Latency

Many people mistakenly assume that high-bandwidth connection methods like Thunderbolt automatically result in low latency. However, bandwidth is just the capacity of the connection and is not directly related to audio processing speed.

Consider it like comparing a car on an 8-lane highway to a car on a 2-lane road, both traveling at 100 km/hour. Bandwidth represents the number of lanes, but the speed remains the same at 100 km/hour.

Near Zero Latency

This term typically refers to latency that is nearly 0 milliseconds, usually 2 milliseconds or less. It is often used in the context of DSP mixers in audio interfaces. DSP mixers do not achieve perfect 0 ms latency, so “Near zero latency” is the term used to describe the minimal latency they provide, usually within 2 ms.

Latency in Virtual Instruments and Real Audio Recording

Latency varies depending on the situation:

- Virtual Instruments: MIDI Input Latency (nearly 0 ms) + Plugin Latency + ASIO Output Latency. - Software Monitoring of Audio Input: ASIO Input Latency + Plugin Latency + ASIO Output Latency. - Direct Audio Input Monitoring: Near Zero Latency.

When using virtual instruments or MIDI, MIDI input latency is almost 0 ms. The main concern is ASIO Output Latency, along with any D/A latency, which affects the audio output of the instrument. In most cases, you only need to consider ASIO Output Latency for MIDI sequencing and VSTi playback.

Real-world instruments, like a piano, also have inherent latency, typically around 5 ms, from the keypress to the sound being produced. ASIO Output Latency for instruments like pianos is usually set to achieve a similar latency.

Theoretical Latency Considering ASIO Buffers

In an ideal audio interface with no additional latency beyond ASIO processing and no DSP plugins adding latency:

- At 44.1 kHz with 512 samples, latency is approximately 11 ms. For roundtrip latency, this becomes 22 ms.

- At 96 kHz with 512 samples, latency is approximately 5.3 ms. At 128 samples, it's around 1.3 ms for input or output alone.

These calculations show that even in an ideal scenario with no additional latency, a 128-sample buffer at 96 kHz still results in a minimum roundtrip latency of 2.6 ms. This makes achieving real-time monitoring challenging for lower buffer settings in most practical cases.

Real Performance and Latency

Music demands precision. For example, at a tempo of 180 BPM, a 16th note lasts 70 ms. So:

- 7 ms of latency represents a 10% error. - 14 ms is a 20% error. - 20 ms is a 30% error.

These errors can significantly affect the performance. This is where software monitoring falls short.

Is the Human Perceptible Limit for Latency 15 ms?

The commonly mentioned figures of 15 ms or 20 ms are based on screen frame rates of 60 fps (or 50 fps). The statement is discussing the fact that computer games or the refresh rate of monitor screens being at 60 frames per second (fps) means that when a game is running or when operations like mouse cursor movements are processed within approximately 16.6 milliseconds (ms), they can be displayed on the screen smoothly at the 60fps frame rate without any issues.

In the context of audio, 16.6 ms (or 20 ms for 50 fps) is not acceptable. Even a 16.6 ms latency can result in noticeable delays and audio anomalies.

Software Monitoring vs. Hardware Monitoring

Software Monitoring

involves using DAWs with ASIO buffers for monitoring. While it offers the advantage of using DAW mixers and applying plugin effects to the monitored sound, achieving sub-2 ms latency is challenging. As buffer sizes increase, roundtrip latency also increases, limiting the feasibility of real-time monitoring.

Hardware Monitoring

on the other hand, bypasses DAWs and relies on analog mixers, audio interfaces' direct monitoring features, or built-in DSP mixers. It guarantees real-time (zero or near-zero) latency but plays back audio as processed by the audio interface, independent of DAW mixers or plugins. This is recommended for recording scenarios, as it enhances recording quality.

In conclusion, for recording purposes, especially when minimal latency is crucial, using hardware monitoring or direct monitoring is recommended over software monitoring.

retronica 2019/09/19 07:21

1)
쉽게 말해서 소리가 지연된다.
2)
A/D D/A에 따른 레이턴시는 합산 되지 않는다.
3)
특정 오디오 인터페이스들이 아주 짧은 레이턴시가 가능한 이유, 또한 저가형 USB 오디오인터페이스들이 긴 레이턴시를 가지는 이유이기도 하다. DMA를 가능하게 하는 별도의 Chipset이나 기능이 없기 때문.
4)
따라서 대부분의 PCIe, Thunderbolt 방식들은 매우 낮은 레이턴시를 보여준다.
5)
USB 방식에도 불구하고 매우 낮은 레이턴시를 보여주는 제품들이 있다.
6)
DSP신호처리를 하는 것에 시간이 걸린다.
7)
다만 피아노 제조사들도 이 레이턴시를 더 줄이기 위해 해머 액션을 계속 발전시켜왔다.
8)
플러그인이나 DSP 계산이 아무런 레이턴시를 추가 하지 않는 경우
9)
Input, 또는 Output 한 경로에서만
10)
Input + Output Latency
11)
실제로 민감한 연주자나 보컬은 불평한다.
12)
버퍼가 작을수록 CPU부하가 커진다.
13)
어떤 플러그인들은 자체적으로 처리 시간이 있어서 레이턴시를 더 추가 하기도 한다.
14)
DAW 에서 모니터링을 켜고 하드웨어 모니터링도 같이 하면 소리가 겹쳐 들리게 된다.
15)
오디오 인터페이스DSP 믹서의 자체적인 이펙터플러그인이 있으면 이것은 작동한다. 그래서 오디오 인터페이스의 자체 DSP 믹서에 추가로 컴프레서이퀄라이저가 있거나 전용 플러그인을 걸 수 있는 제품들이 선호되기도 한다.
검색
[홈레코딩 필독서]"모두의 홈레코딩"구매링크


음향/digital/latency.txt · 마지막으로 수정됨: 2024/04/14 저자 127.0.0.1