音频因采样率众多,要兼容所有标准采样率,就必须在分频阶段,考虑清楚,虽然采样率众多,但一般是分两类,一类是44.1KHZ的,还有一类是48KHZ,
44.1K类的
176400
88200
44100
29400
22050
14700
11025
7350
48K类的
192000
96000
48000
32000
24000
16000
12000
8000
一般44.1K类的,大家会选择22579200HZ,48K类的选择24576000HZ,但全志的PLL根本无法精确精确分出此频率,只能近似,有研究过此问题的同学吗?
补充,33075是个异类,换成29400
最近编辑记录 xboot (2021-07-20 15:33:48)
离线
PLL音频分频公式,其中N的取值范围1 - 128,M的取值范围1 - 32
PLL_AUDIO(8X) Output = 24MHZ * N * 2 / M
也就是说,要让下面两个公式成立,捡起小学学的找最大公约数技术,找了一圈,根本就没有满足要求的正整数解,全志你这是想干嘛呢,音频难道仅能听个响?
22579200 * 8 = 24000000 * N * 2 / M
24576000 * 8 = 24000000 * N * 2 / M
最近编辑记录 xboot (2021-07-20 11:17:32)
离线
重采样只能算歪门邪道,况且,重采样,效果会更糟,准备写个程序找到误差最小的配置看看。
离线
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <slist.h>
int main(int argc, char * argv[])
{
struct slist_t * sl, * e;
int64_t t1, t2;
double delta;
int n, m;
printf("================= 22.5792MHZ =====================\r\n");
sl = slist_alloc();
t1 = 22579200 * 8;
for(n = 1; n <= 128; n++)
{
for(m = 1; m <= 32; m++)
{
t2 = 24000000LL * n * 2LL / m;
delta = (fabs)((double)(t2 - t1)) / (double)t1;
slist_add(sl, NULL, "%.16f(n = %d, m = %d)", delta, n, m);
}
}
slist_sort(sl);
slist_for_each_entry(e, sl)
{
printf("%s\r\n", e->key);
}
slist_free(sl);
printf("================= 24.576MHZ =====================\r\n");
sl = slist_alloc();
t1 = 24576000 * 8;
for(n = 1; n <= 128; n++)
{
for(m = 1; m <= 32; m++)
{
t2 = 24000000LL * n * 2LL / m;
delta = (fabs)((double)(t2 - t1)) / (double)t1;
slist_add(sl, NULL, "%.16f(n = %d, m = %d)", delta, n, m);
}
}
slist_sort(sl);
slist_for_each_entry(e, sl)
{
printf("%s\r\n", e->key);
}
slist_free(sl);
return 0;
}
离线
================= 22.5792MHZ =====================
0.0003441884566327(n = 79, m = 21)
0.0004001581101190(n = 64, m = 17)
0.0008503401360544(n = 94, m = 25)
0.0009212018140590(n = 113, m = 30)
0.0012168666294643(n = 109, m = 29)
0.0016025589923469(n = 49, m = 13)
0.0016025589923469(n = 98, m = 26)
......
9.8949829931972797(n = 41, m = 1)
9.8949829931972797(n = 82, m = 2)
9.9835600907029480(n = 124, m = 3)
================= 24.576MHZ =====================
0.0001860148111979(n = 86, m = 21)
0.0001890106201172(n = 127, m = 31)
0.0009765625000000(n = 123, m = 30)
0.0009765625000000(n = 41, m = 10)
0.0009765625000000(n = 82, m = 20)
.......
9.8642578125000000(n = 89, m = 2)
9.9863281250000000(n = 45, m = 1)
9.9863281250000000(n = 90, m = 2)
好吧,排在第一个就是误差最小的。
离线
从这结果看,44.1k类的误差万分之3.4,48k类的,误差万分之1.8,还是尽可能远离44.1k吧,全面拥抱48k,44.1k的存在就是就是失足妇女的一次意外而已
离线
我们的一款产品使用的imx6ul 外接的22.576和22.5792晶振
离线