mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-11 15:29:28 -05:00
Move baseband FIR filter defs to common file.
They will likely be shared with multiple decimators/demodulators. Also added normalized filter pass/stop values to each set of taps.
This commit is contained in:
parent
3db0820b54
commit
7de80edcd3
@ -34,149 +34,151 @@ struct fir_taps_real {
|
||||
std::array<int16_t, N> taps;
|
||||
};
|
||||
|
||||
/* 3kHz/6.7kHz @ 96kHz. sum(abs(taps)): 89429 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_031_070_tfilter {
|
||||
.pass_frequency_normalized = 0.031f,
|
||||
.stop_frequency_normalized = 0.070f,
|
||||
// NBFM 16K0F3E emission type /////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=8000, stop=344000, decim=8, fout=384000
|
||||
constexpr fir_taps_real<24> taps_16k0_decim_0 {
|
||||
.pass_frequency_normalized = 8000.0f / 3072000.0f,
|
||||
.stop_frequency_normalized = 344000.0f / 3072000.0f,
|
||||
.taps = { {
|
||||
56, 58, 81, 100, 113, 112, 92, 49,
|
||||
-21, -120, -244, -389, -543, -692, -819, -903,
|
||||
-923, -861, -698, -424, -34, 469, 1073, 1756,
|
||||
2492, 3243, 3972, 4639, 5204, 5634, 5903, 5995,
|
||||
5903, 5634, 5204, 4639, 3972, 3243, 2492, 1756,
|
||||
1073, 469, -34, -424, -698, -861, -923, -903,
|
||||
-819, -692, -543, -389, -244, -120, -21, 49,
|
||||
92, 112, 113, 100, 81, 58, 56, 0,
|
||||
1, 67, 165, 340, 599, 944, 1361, 1820,
|
||||
2278, 2684, 2988, 3152, 3152, 2988, 2684, 2278,
|
||||
1820, 1361, 944, 599, 340, 165, 67, 1,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 4kHz/7.5kHz @ 96kHz. sum(abs(taps)): 96783 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_042_078_tfilter {
|
||||
.pass_frequency_normalized = 0.042f,
|
||||
.stop_frequency_normalized = 0.078f,
|
||||
// IFIR prototype filter: fs=384000, pass=8000, stop=40000, decim=8, fout=48000
|
||||
constexpr fir_taps_real<32> taps_16k0_decim_1 {
|
||||
.pass_frequency_normalized = 8000.0f / 384000.0f,
|
||||
.stop_frequency_normalized = 40000.0f / 384000.0f,
|
||||
.taps = { {
|
||||
-19, 39, 72, 126, 197, 278, 360, 432,
|
||||
478, 485, 438, 327, 152, -82, -359, -651,
|
||||
-922, -1132, -1236, -1192, -968, -545, 81, 892,
|
||||
1852, 2906, 3984, 5012, 5910, 6609, 7053, 7205,
|
||||
7053, 6609, 5910, 5012, 3984, 2906, 1852, 892,
|
||||
81, -545, -968, -1192, -1236, -1132, -922, -651,
|
||||
-359, -82, 152, 327, 438, 485, 478, 432,
|
||||
360, 278, 197, 126, 72, 39, -19, 0,
|
||||
-26, -125, -180, -275, -342, -359, -286, -90,
|
||||
250, 733, 1337, 2011, 2688, 3289, 3740, 3982,
|
||||
3982, 3740, 3289, 2688, 2011, 1337, 733, 250,
|
||||
-90, -286, -359, -342, -275, -180, -125, -26,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 5kHz/8.5kHz @ 96kHz. sum(abs(taps)): 101312 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_052_089_tfilter {
|
||||
.pass_frequency_normalized = 0.052f,
|
||||
.stop_frequency_normalized = 0.089f,
|
||||
// Channel filter: fs=48000, pass=8000, stop=12400, decim=1, fout=48000
|
||||
constexpr fir_taps_real<32> taps_16k0_channel {
|
||||
.pass_frequency_normalized = 8000.0f / 48000.0f,
|
||||
.stop_frequency_normalized = 12400.0f / 48000.0f,
|
||||
.taps = { {
|
||||
-65, -88, -129, -163, -178, -160, -100, 9,
|
||||
160, 340, 523, 675, 758, 738, 591, 313,
|
||||
-76, -533, -987, -1355, -1544, -1472, -1077, -335,
|
||||
738, 2078, 3579, 5104, 6502, 7627, 8355, 8608,
|
||||
8355, 7627, 6502, 5104, 3579, 2078, 738, -335,
|
||||
-1077, -1472, -1544, -1355, -987, -533, -76, 313,
|
||||
591, 738, 758, 675, 523, 340, 160, 9,
|
||||
-100, -160, -178, -163, -129, -88, -65, 0,
|
||||
-73, -285, -376, -8, 609, 538, -584, -1387,
|
||||
-148, 2173, 1959, -2146, -5267, -297, 12915, 24737,
|
||||
24737, 12915, -297, -5267, -2146, 1959, 2173, -148,
|
||||
-1387, -584, 538, 609, -8, -376, -285, -73,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 6kHz/9.6kHz @ 96kHz. sum(abs(taps)): 105088 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_063_100_tfilter {
|
||||
.pass_frequency_normalized = 0.063f,
|
||||
.stop_frequency_normalized = 0.100f,
|
||||
// NBFM 11K0F3E emission type /////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=5500, stop=341500, decim=8, fout=384000
|
||||
constexpr fir_taps_real<24> taps_11k0_decim_0 {
|
||||
.pass_frequency_normalized = 5500.0f / 3072000.0f,
|
||||
.stop_frequency_normalized = 341500.0f / 3072000.0f,
|
||||
.taps = { {
|
||||
43, 21, -2, -54, -138, -245, -360, -453,
|
||||
-493, -451, -309, -73, 227, 535, 776, 876,
|
||||
773, 443, -86, -730, -1357, -1801, -1898, -1515,
|
||||
-585, 869, 2729, 4794, 6805, 8490, 9611, 10004,
|
||||
9611, 8490, 6805, 4794, 2729, 869, -585, -1515,
|
||||
-1898, -1801, -1357, -730, -86, 443, 773, 876,
|
||||
776, 535, 227, -73, -309, -451, -493, -453,
|
||||
-360, -245, -138, -54, -2, 21, 43, 0,
|
||||
38, 102, 220, 406, 668, 1004, 1397, 1822,
|
||||
2238, 2603, 2875, 3020, 3020, 2875, 2603, 2238,
|
||||
1822, 1397, 1004, 668, 406, 220, 102, 38,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 7kHz/10.4kHz @ 96kHz: sum(abs(taps)): 110157 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_073_108_tfilter {
|
||||
.pass_frequency_normalized = 0.073f,
|
||||
.stop_frequency_normalized = 0.108f,
|
||||
// IFIR prototype filter: fs=384000, pass=5500, stop=42500, decim=8, fout=48000
|
||||
constexpr fir_taps_real<32> taps_11k0_decim_1 {
|
||||
.pass_frequency_normalized = 5500.0f / 384000.0f,
|
||||
.stop_frequency_normalized = 42500.0f / 384000.0f,
|
||||
.taps = { {
|
||||
79, 145, 241, 334, 396, 394, 306, 130,
|
||||
-109, -360, -550, -611, -494, -197, 229, 677,
|
||||
1011, 1096, 846, 257, -570, -1436, -2078, -2225,
|
||||
-1670, -327, 1726, 4245, 6861, 9146, 10704, 11257,
|
||||
10704, 9146, 6861, 4245, 1726, -327, -1670, -2225,
|
||||
-2078, -1436, -570, 257, 846, 1096, 1011, 677,
|
||||
229, -197, -494, -611, -550, -360, -109, 130,
|
||||
306, 394, 396, 334, 241, 145, 79, 0,
|
||||
-42, -87, -157, -234, -298, -318, -255, -75,
|
||||
246, 713, 1306, 1976, 2656, 3265, 3724, 3971,
|
||||
3971, 3724, 3265, 2656, 1976, 1306, 713, 246,
|
||||
-75, -255, -318, -298, -234, -157, -87, -42,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 8kHz/11.5kHz @ 96kHz. sum(abs(taps)): 112092 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_083_120_tfilter {
|
||||
.pass_frequency_normalized = 0.083f,
|
||||
.stop_frequency_normalized = 0.120f,
|
||||
// Channel filter: fs=48000, pass=5500, stop=8900, decim=1, fout=48000
|
||||
constexpr fir_taps_real<32> taps_11k0_channel {
|
||||
.pass_frequency_normalized = 5500.0f / 48000.0f,
|
||||
.stop_frequency_normalized = 8900.0f / 48000.0f,
|
||||
.taps = { {
|
||||
-63, -72, -71, -21, 89, 248, 417, 537,
|
||||
548, 407, 124, -237, -563, -723, -621, -238,
|
||||
337, 919, 1274, 1201, 617, -382, -1514, -2364,
|
||||
-2499, -1600, 414, 3328, 6651, 9727, 11899, 12682,
|
||||
11899, 9727, 6651, 3328, 414, -1600, -2499, -2364,
|
||||
-1514, -382, 617, 1201, 1274, 919, 337, -238,
|
||||
-621, -723, -563, -237, 124, 407, 548, 537,
|
||||
417, 248, 89, -21, -71, -72, -63, 0,
|
||||
-68, -345, -675, -867, -582, 247, 1222, 1562,
|
||||
634, -1379, -3219, -3068, 310, 6510, 13331, 17795,
|
||||
17795, 13331, 6510, 310, -3068, -3219, -1379, 634,
|
||||
1562, 1222, 247, -582, -867, -675, -345, -68,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 9kHz/12.4kHz @ 96kHz. sum(abs(taps)): 116249 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_094_129_tfilter {
|
||||
.pass_frequency_normalized = 0.094f,
|
||||
.stop_frequency_normalized = 0.129f,
|
||||
/// NBFM 8K50F3E emission type ////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=4250, stop=340250, decim=8, fout=384000
|
||||
constexpr fir_taps_real<24> taps_4k25_decim_0 {
|
||||
.pass_frequency_normalized = 4250.0f / 3072000.0f,
|
||||
.stop_frequency_normalized = 340250.0f / 3072000.0f,
|
||||
.taps = { {
|
||||
5, -93, -198, -335, -449, -478, -378, -144,
|
||||
166, 444, 563, 440, 82, -395, -788, -892,
|
||||
-589, 73, 859, 1421, 1431, 734, -530, -1919,
|
||||
-2798, -2555, -837, 2274, 6220, 10103, 12941, 13981,
|
||||
12941, 10103, 6220, 2274, -837, -2555, -2798, -1919,
|
||||
-530, 734, 1431, 1421, 859, 73, -589, -892,
|
||||
-788, -395, 82, 440, 563, 444, 166, -144,
|
||||
-378, -478, -449, -335, -198, -93, 5, 0,
|
||||
38, 103, 222, 409, 671, 1006, 1399, 1821,
|
||||
2236, 2599, 2868, 3012, 3012, 2868, 2599, 2236,
|
||||
1821, 1399, 1006, 671, 409, 222, 103, 38,
|
||||
} },
|
||||
};
|
||||
|
||||
/* 10kHz/13.4kHz @ 96kHz. sum(abs(taps)): 118511 */
|
||||
constexpr fir_taps_real<64> taps_64_lp_104_140_tfilter {
|
||||
.pass_frequency_normalized = 0.104f,
|
||||
.stop_frequency_normalized = 0.140f,
|
||||
// IFIR prototype filter: fs=384000, pass=4250, stop=43750, decim=8, fout=48000
|
||||
constexpr fir_taps_real<32> taps_4k25_decim_1 {
|
||||
.pass_frequency_normalized = 4250.0f / 384000.0f,
|
||||
.stop_frequency_normalized = 43750.0f / 384000.0f,
|
||||
.taps = { {
|
||||
89, 159, 220, 208, 84, -147, -412, -597,
|
||||
-588, -345, 58, 441, 595, 391, -128, -730,
|
||||
-1080, -914, -198, 793, 1558, 1594, 678, -942,
|
||||
-2546, -3187, -2084, 992, 5515, 10321, 13985, 15353,
|
||||
13985, 10321, 5515, 992, -2084, -3187, -2546, -942,
|
||||
678, 1594, 1558, 793, -198, -914, -1080, -730,
|
||||
-128, 391, 595, 441, 58, -345, -588, -597,
|
||||
-412, -147, 84, 208, 220, 159, 89, 0,
|
||||
-33, -74, -139, -214, -280, -306, -254, -87,
|
||||
222, 682, 1274, 1951, 2644, 3268, 3741, 3996,
|
||||
3996, 3741, 3268, 2644, 1951, 1274, 682, 222,
|
||||
-87, -254, -306, -280, -214, -139, -74, -33,
|
||||
} },
|
||||
};
|
||||
|
||||
/* Wideband FM channel filter
|
||||
* 103kHz/128kHz @ 768kHz
|
||||
*/
|
||||
constexpr fir_taps_real<64> taps_64_lp_130_169_tfilter {
|
||||
.pass_frequency_normalized = 0.130f,
|
||||
.stop_frequency_normalized = 0.169f,
|
||||
// Channel filter: fs=48000, pass=4250, stop=7900, decim=1, fout=48000
|
||||
constexpr fir_taps_real<32> taps_4k25_channel {
|
||||
.pass_frequency_normalized = 4250.0f / 48000.0f,
|
||||
.stop_frequency_normalized = 7900.0f / 48000.0f,
|
||||
.taps = { {
|
||||
100, 127, 62, -157, -470, -707, -678, -332,
|
||||
165, 494, 400, -85, -610, -729, -253, 535,
|
||||
1026, 734, -263, -1264, -1398, -332, 1316, 2259,
|
||||
1447, -988, -3474, -3769, -385, 6230, 13607, 18450,
|
||||
18450, 13607, 6230, -385, -3769, -3474, -988, 1447,
|
||||
2259, 1316, -332, -1398, -1264, -263, 734, 1026,
|
||||
535, -253, -729, -610, -85, 400, 494, 165,
|
||||
-332, -678, -707, -470, -157, 62, 127, 100,
|
||||
-58, -14, 153, 484, 871, 1063, 770, -141,
|
||||
-1440, -2488, -2435, -614, 3035, 7771, 12226, 14927,
|
||||
14927, 12226, 7771, 3035, -614, -2435, -2488, -1440,
|
||||
-141, 770, 1063, 871, 484, 153, -14, -58,
|
||||
} },
|
||||
};
|
||||
|
||||
// DSB AM 6K00A3E emission type ///////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=3000, stop=339000, decim=8, fout=384000
|
||||
constexpr fir_taps_real<24> taps_6k0_decim_0 {
|
||||
.pass_frequency_normalized = 3000.0f / 3072000.0f,
|
||||
.stop_frequency_normalized = 339000.0f / 3072000.0f,
|
||||
.taps = { {
|
||||
39, 104, 224, 412, 674, 1008, 1400, 1821,
|
||||
2234, 2594, 2863, 3006, 3006, 2863, 2594, 2234,
|
||||
1821, 1400, 1008, 674, 412, 224, 104, 39,
|
||||
} },
|
||||
};
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=3000, stop=45000, decim=8, fout=48000
|
||||
constexpr fir_taps_real<32> taps_6k0_decim_1 {
|
||||
.pass_frequency_normalized = 3000.0f / 384000.0f,
|
||||
.stop_frequency_normalized = 45000.0f / 384000.0f,
|
||||
.taps = { {
|
||||
-26, -63, -123, -195, -263, -295, -253, -99,
|
||||
199, 651, 1242, 1927, 2633, 3273, 3760, 4023,
|
||||
4023, 3760, 3273, 2633, 1927, 1242, 651, 199,
|
||||
-99, -253, -295, -263, -195, -123, -63, -26,
|
||||
} },
|
||||
};
|
||||
|
||||
// Channel filter: fs=48000, pass=3000, stop=6700, decim=1, fout=48000
|
||||
constexpr fir_taps_real<32> taps_6k0_channel {
|
||||
.pass_frequency_normalized = 3000.0f / 48000.0f,
|
||||
.stop_frequency_normalized = 6700.0f / 48000.0f,
|
||||
.taps = { {
|
||||
95, 178, 247, 208, -21, -474, -1080, -1640,
|
||||
-1857, -1411, -83, 2134, 4978, 7946, 10413, 11815,
|
||||
11815, 10413, 7946, 4978, 2134, -83, -1411, -1857,
|
||||
-1640, -1080, -474, -21, 208, 247, 178, 95,
|
||||
} },
|
||||
};
|
||||
|
||||
|
@ -21,31 +21,6 @@
|
||||
|
||||
#include "proc_am_audio.hpp"
|
||||
|
||||
// DSB AM 6K00A3E emission type ///////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=3000, stop=339000, decim=8, fout=384000
|
||||
static constexpr std::array<int16_t, 24> taps_6k0_decim_0 { {
|
||||
39, 104, 224, 412, 674, 1008, 1400, 1821,
|
||||
2234, 2594, 2863, 3006, 3006, 2863, 2594, 2234,
|
||||
1821, 1400, 1008, 674, 412, 224, 104, 39,
|
||||
} };
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=3000, stop=45000, decim=8, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_6k0_decim_1 { {
|
||||
-26, -63, -123, -195, -263, -295, -253, -99,
|
||||
199, 651, 1242, 1927, 2633, 3273, 3760, 4023,
|
||||
4023, 3760, 3273, 2633, 1927, 1242, 651, 199,
|
||||
-99, -253, -295, -263, -195, -123, -63, -26,
|
||||
} };
|
||||
|
||||
// Channel filter: fs=48000, pass=3000, stop=6700, decim=1, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_6k0_channel { {
|
||||
95, 178, 247, 208, -21, -474, -1080, -1640,
|
||||
-1857, -1411, -83, 2134, 4978, 7946, 10413, 11815,
|
||||
11815, 10413, 7946, 4978, 2134, -83, -1411, -1857,
|
||||
-1640, -1080, -474, -21, 208, 247, 178, 95,
|
||||
} };
|
||||
|
||||
NarrowbandAMAudio::NarrowbandAMAudio() {
|
||||
constexpr size_t baseband_fs = 3072000;
|
||||
|
||||
@ -61,11 +36,11 @@ NarrowbandAMAudio::NarrowbandAMAudio() {
|
||||
constexpr size_t channel_filter_decimation_factor = 1;
|
||||
constexpr size_t channel_filter_output_fs = channel_filter_input_fs / channel_filter_decimation_factor;
|
||||
|
||||
decim_0.configure(taps_6k0_decim_0, 33554432);
|
||||
decim_1.configure(taps_6k0_decim_1, 131072);
|
||||
channel_filter.configure(taps_6k0_channel, 1);
|
||||
channel_filter_pass_f = 3000;
|
||||
channel_filter_stop_f = 6700;
|
||||
decim_0.configure(taps_6k0_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_6k0_decim_1.taps, 131072);
|
||||
channel_filter.configure(taps_6k0_channel.taps, 1);
|
||||
channel_filter_pass_f = taps_6k0_channel.pass_frequency_normalized * channel_filter_input_fs;
|
||||
channel_filter_stop_f = taps_6k0_channel.stop_frequency_normalized * channel_filter_input_fs;
|
||||
|
||||
channel_spectrum.set_decimation_factor(std::floor((channel_filter_output_fs / 2) / ((channel_filter_pass_f + channel_filter_stop_f) / 2)));
|
||||
}
|
||||
|
@ -24,81 +24,6 @@
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
// NBFM 16K0F3E emission type /////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=8000, stop=344000, decim=8, fout=384000
|
||||
static constexpr std::array<int16_t, 24> taps_16k0_decim_0 { {
|
||||
1, 67, 165, 340, 599, 944, 1361, 1820,
|
||||
2278, 2684, 2988, 3152, 3152, 2988, 2684, 2278,
|
||||
1820, 1361, 944, 599, 340, 165, 67, 1,
|
||||
} };
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=8000, stop=40000, decim=8, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_16k0_decim_1 { {
|
||||
-26, -125, -180, -275, -342, -359, -286, -90,
|
||||
250, 733, 1337, 2011, 2688, 3289, 3740, 3982,
|
||||
3982, 3740, 3289, 2688, 2011, 1337, 733, 250,
|
||||
-90, -286, -359, -342, -275, -180, -125, -26,
|
||||
} };
|
||||
|
||||
// Channel filter: fs=48000, pass=8000, stop=12400, decim=1, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_16k0_channel { {
|
||||
-73, -285, -376, -8, 609, 538, -584, -1387,
|
||||
-148, 2173, 1959, -2146, -5267, -297, 12915, 24737,
|
||||
24737, 12915, -297, -5267, -2146, 1959, 2173, -148,
|
||||
-1387, -584, 538, 609, -8, -376, -285, -73,
|
||||
} };
|
||||
|
||||
// NBFM 11K0F3E emission type /////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=5500, stop=341500, decim=8, fout=384000
|
||||
static constexpr std::array<int16_t, 24> taps_11k0_decim_0 { {
|
||||
38, 102, 220, 406, 668, 1004, 1397, 1822,
|
||||
2238, 2603, 2875, 3020, 3020, 2875, 2603, 2238,
|
||||
1822, 1397, 1004, 668, 406, 220, 102, 38,
|
||||
} };
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=5500, stop=42500, decim=8, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_11k0_decim_1 { {
|
||||
-42, -87, -157, -234, -298, -318, -255, -75,
|
||||
246, 713, 1306, 1976, 2656, 3265, 3724, 3971,
|
||||
3971, 3724, 3265, 2656, 1976, 1306, 713, 246,
|
||||
-75, -255, -318, -298, -234, -157, -87, -42,
|
||||
} };
|
||||
|
||||
// Channel filter: fs=48000, pass=5500, stop=8900, decim=1, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_11k0_channel { {
|
||||
-68, -345, -675, -867, -582, 247, 1222, 1562,
|
||||
634, -1379, -3219, -3068, 310, 6510, 13331, 17795,
|
||||
17795, 13331, 6510, 310, -3068, -3219, -1379, 634,
|
||||
1562, 1222, 247, -582, -867, -675, -345, -68,
|
||||
} };
|
||||
|
||||
/// NBFM 8K50F3E emission type ////////////////////////////////////////////
|
||||
|
||||
// IFIR image-reject filter: fs=3072000, pass=4250, stop=340250, decim=8, fout=384000
|
||||
static constexpr std::array<int16_t, 24> taps_4k25_decim_0 { {
|
||||
38, 103, 222, 409, 671, 1006, 1399, 1821,
|
||||
2236, 2599, 2868, 3012, 3012, 2868, 2599, 2236,
|
||||
1821, 1399, 1006, 671, 409, 222, 103, 38,
|
||||
} };
|
||||
|
||||
// IFIR prototype filter: fs=384000, pass=4250, stop=43750, decim=8, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_4k25_decim_1 { {
|
||||
-33, -74, -139, -214, -280, -306, -254, -87,
|
||||
222, 682, 1274, 1951, 2644, 3268, 3741, 3996,
|
||||
3996, 3741, 3268, 2644, 1951, 1274, 682, 222,
|
||||
-87, -254, -306, -280, -214, -139, -74, -33,
|
||||
} };
|
||||
|
||||
// Channel filter: fs=48000, pass=4250, stop=7900, decim=1, fout=48000
|
||||
static constexpr std::array<int16_t, 32> taps_4k25_channel { {
|
||||
-58, -14, 153, 484, 871, 1063, 770, -141,
|
||||
-1440, -2488, -2435, -614, 3035, 7771, 12226, 14927,
|
||||
14927, 12226, 7771, 3035, -614, -2435, -2488, -1440,
|
||||
-141, 770, 1063, 871, 484, 153, -14, -58,
|
||||
} };
|
||||
|
||||
NarrowbandFMAudio::NarrowbandFMAudio() {
|
||||
set_mode(Mode::Deviation2K5Narrow);
|
||||
}
|
||||
@ -123,30 +48,30 @@ void NarrowbandFMAudio::set_mode(const Mode mode) {
|
||||
switch(mode) {
|
||||
default:
|
||||
case Mode::Deviation5K:
|
||||
decim_0.configure(taps_16k0_decim_0, 33554432);
|
||||
decim_1.configure(taps_16k0_decim_1, 131072);
|
||||
channel_filter.configure(taps_16k0_channel, channel_filter_decimation_factor);
|
||||
decim_0.configure(taps_16k0_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_16k0_decim_1.taps, 131072);
|
||||
channel_filter.configure(taps_16k0_channel.taps, channel_filter_decimation_factor);
|
||||
demod.configure(demod_input_fs, 5000);
|
||||
channel_filter_pass_f = 8000;
|
||||
channel_filter_stop_f = 12400;
|
||||
channel_filter_pass_f = taps_16k0_channel.pass_frequency_normalized * channel_filter_input_fs;
|
||||
channel_filter_stop_f = taps_16k0_channel.stop_frequency_normalized * channel_filter_input_fs;
|
||||
break;
|
||||
|
||||
case Mode::Deviation2K5Wide:
|
||||
decim_0.configure(taps_11k0_decim_0, 33554432);
|
||||
decim_1.configure(taps_11k0_decim_1, 131072);
|
||||
channel_filter.configure(taps_11k0_channel, channel_filter_decimation_factor);
|
||||
decim_0.configure(taps_11k0_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_11k0_decim_1.taps, 131072);
|
||||
channel_filter.configure(taps_11k0_channel.taps, channel_filter_decimation_factor);
|
||||
demod.configure(demod_input_fs, 2500);
|
||||
channel_filter_pass_f = 5500;
|
||||
channel_filter_stop_f = 8900;
|
||||
channel_filter_pass_f = taps_11k0_channel.pass_frequency_normalized * channel_filter_input_fs;
|
||||
channel_filter_stop_f = taps_11k0_channel.stop_frequency_normalized * channel_filter_input_fs;
|
||||
break;
|
||||
|
||||
case Mode::Deviation2K5Narrow:
|
||||
decim_0.configure(taps_4k25_decim_0, 33554432);
|
||||
decim_1.configure(taps_4k25_decim_1, 131072);
|
||||
channel_filter.configure(taps_4k25_channel, channel_filter_decimation_factor);
|
||||
decim_0.configure(taps_4k25_decim_0.taps, 33554432);
|
||||
decim_1.configure(taps_4k25_decim_1.taps, 131072);
|
||||
channel_filter.configure(taps_4k25_channel.taps, channel_filter_decimation_factor);
|
||||
demod.configure(demod_input_fs, 2500);
|
||||
channel_filter_pass_f = 4250;
|
||||
channel_filter_stop_f = 7900;
|
||||
channel_filter_pass_f = taps_4k25_channel.pass_frequency_normalized * channel_filter_input_fs;
|
||||
channel_filter_stop_f = taps_4k25_channel.stop_frequency_normalized * channel_filter_input_fs;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user