andrewrk / andrewrk/libsoundio

Inaccuracy when setting latency

オープン
#138 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
C
スター
2.1k
フォーク
254
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。