2

我的 DAC 内部时钟为 48khz,我需要从一个同样为 48khz 但时钟来自不同来源的流中提供它。

这两个源会随着时间的推移而漂移,并且两者之间的任何缓冲都将不可避免地上溢或下溢。

不幸的是,没有可用于源的速率控制机制。

如何最好地处理这个问题?

复制或扔掉偶尔的样品来补偿是否可以接受?我估计每约 70k 个样本 1 个样本,差异为 30ppm。

4

3 回答 3

2

由于您的时钟基本上以两种不同的速度运行,您别无选择,只能复制或丢弃样本。

记录已经读/写了多少样本,并根据当前时间计算您期望读/写的样本数量。然后可以通过复制/丢弃样本来调整差异。

于 2009-02-11T17:57:10.117 回答
1

如果您担心保真度,请使用采样率转换器,而不是删除或复制样本。首先,使用时间戳来测量源采样率和 DAC 采样率之间的相对频率比。使用该比率来控制采样率转换器。一个质量不错的采样率转换器可以为您提供 95 分贝的信噪比。计算成本更高的算法可以为您提供 > 120 db 的信噪比。

看:

--jdkoftinoff

于 2009-02-22T01:58:25.217 回答
0

This may sould like a stupid question, but hear me out: Does the output rate really matter?

Consider this scenario - you have an audio input device. You are sampling an analog waveform input at 48Khz. That waveform could be generated by anything at any rate- from the continuous pressure level measurement of a microphone to an 8Khz voice codec, or lower. The fact that you happen to know that this particular output is also at 48Khz has no bearing on what you are doing.

If there were perfect transmission between the output device and your input, when you compare the original digital waveform to what you read, you will occassionally see that you have duplicated a sample (if your clock is faster) or missed one (if you are slower). But this will happen automatically, without any compensation by you needed. This will easily be as accurate as any attempt by you to figure out when to "duplicate or toss the occasional sample".

In practice, you probably won't get an exact duplicate anyway, between filtering effects and noise in both the DAC and ADC. Unless you are talking about some encoded digital audio format - in which case, ignore everything I've said.

EDIT - Ok, so it is digital audio - S/PDIF?
The signal should carry enough information to implement a phase lock. Ideally in hardware - the rising edges of the signal define the clock rate - you may be able to use PLL hardware to lock your A/D clock to the input. Or oversample for a while and count the rising edges to determine the rate. Or at the software level, measure the rate of framing errors in the 1st four time slots, and adjust your clock to compensate.

于 2009-02-11T19:37:18.303 回答