andrewrk / andrewrk/libsoundio

Inaccuracy when setting latency

Aperta
#138 2 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
C
Stelle
2.1k
Fork
254
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hello,

I am having an issue understanding the relation between latency and read/write counts, using OSX coreaudio, libsoundio 1.1

For example, a desired (single channel) buffer size of 1024 samples, input sample rate 16khz the "perfect" Input latency for my desired buffer is _buffer size / sample rate_, so _1024 / 16000 = 0.064_

I use the same latency for the output (48khz sample rate), meaning the output _should_ have a min/max write count of _buffer size * sample rate ratio_ samples (so 1024 * 48/16 = 3072). The amount of samples available in the buffer is infact the buffer size, 1024, which is fine because I am upsampling to the correct amount of samples.

What is happening is that the output is requesting an unexpected amount of samples, 3344 (so 1115 samples at 16khz), and quickly ends up consuming more samples than the input can provide, getting underflows.

Is there additional, uncontrollable hardware latency that makes the approach I am taking unfeasible? Or am I missing something ....

Thanks

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.