andrewrk / andrewrk/libsoundio

Inaccuracy when setting latency

未关闭
#138 2 条评论 1 个 reaction 已指派 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 摘要。