1

I capture a pcm sound at some sampling rate, e.g. 24 kHz. I need to encode it using some codec (I use Opus for that) to send over network. I noticed that at some sampling rate I use for encoding with Opus, I often hear some extra "cracking" noise at the receiving end. At other rates, it sounds ok. That might be an implementation bug, but I though there might be some constraints also that I don't know.

I also noticed that if I use another sampling rate while decoding Opus-encoded audio stream, I get a lower or higher pitch of sound, which seems logical to me. So I've read, that I need to resample on the other end, if receiving side doesn't support the original PCM sampling rate.

So I have 2 questions regarding all this:

  1. Are there any constraints on sampling rate (or other parameters) of audio encoding? (Like I have a 24kHz pcm sound - maybe there are certain sample rates to use with it?)
  2. Are there any common techniques to provide the same sound quality at both sides when sending audio stream over network?
4

2 回答 2

1

噼啪声很可能是一个错误,因为没有限制会导致这种噪声的采样率(采样率转换会带来其他类型的信号变化,特别是在下采样到较低采样率时;但绝对不噼里啪啦)。

一个疯狂的猜测是,输入缓冲区有问题。如果样本被省略或重复,则经常会出现裂纹,这通常是后续缓冲区边界不正确的结果。

无论如何,通过网络实时发送音频数据都需要压缩。所需的数据速率太高了。有提供无损音频压缩的编解码器(例如 FLAC),但与例如 Opus 相比,它们的压缩率相对较低。

于 2015-12-01T09:29:11.503 回答
1

通过在接收端缓冲数据包并在达到一定数量时将它们写入声卡缓冲区来解决该问题。'噼啪'噪音很可能是由于发送到声卡缓冲区的后续帧之间的间隙

于 2015-12-12T15:56:03.183 回答