diff --git a/playback/src/config.rs b/playback/src/config.rs index 85449eb48..e2fafda29 100644 --- a/playback/src/config.rs +++ b/playback/src/config.rs @@ -4,9 +4,7 @@ pub use crate::dither::{mk_ditherer, DithererBuilder, TriangularDitherer}; use crate::{ convert::i24, - filter_coefficients::{ - HZ48000_HIGH, HZ48000_LOW, HZ88200_HIGH, HZ88200_LOW, HZ96000_HIGH, HZ96000_LOW, - }, + filter_coefficients::{HZ48000_COEFFICIENTS, HZ88200_COEFFICIENTS, HZ96000_COEFFICIENTS}, RESAMPLER_INPUT_SIZE, SAMPLE_RATE, }; @@ -33,69 +31,6 @@ const HZ88200_INTERPOLATION_OUTPUT_SIZE: usize = const HZ96000_INTERPOLATION_OUTPUT_SIZE: usize = (RESAMPLER_INPUT_SIZE as f64 * (1.0 / HZ96000_RESAMPLE_FACTOR_RECIPROCAL)) as usize; -#[derive(Clone, Copy, Debug, Default)] -pub enum InterpolationQuality { - Low, - #[default] - High, -} - -impl FromStr for InterpolationQuality { - type Err = (); - - fn from_str(s: &str) -> Result { - use InterpolationQuality::*; - - match s.to_lowercase().as_ref() { - "low" => Ok(Low), - "high" => Ok(High), - _ => Err(()), - } - } -} - -impl std::fmt::Display for InterpolationQuality { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use InterpolationQuality::*; - - match self { - Low => write!(f, "Low"), - High => write!(f, "High"), - } - } -} - -impl InterpolationQuality { - pub fn get_interpolation_coefficients( - &self, - mut coefficients: Vec, - resample_factor_reciprocal: f64, - ) -> Vec { - let mut coefficient_sum = 0.0; - - for (index, coefficient) in coefficients.iter_mut().enumerate() { - *coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract()); - - coefficient_sum += *coefficient; - } - - coefficients - .iter_mut() - .for_each(|coefficient| *coefficient /= coefficient_sum); - - coefficients - } - - fn sinc(x: f64) -> f64 { - if x.abs() < f64::EPSILON { - 1.0 - } else { - let pi_x = std::f64::consts::PI * x; - pi_x.sin() / pi_x - } - } -} - #[derive(Clone, Copy, Debug, Default)] pub enum SampleRate { #[default] @@ -152,14 +87,6 @@ impl std::fmt::Display for SampleRate { } } -#[derive(Debug, Default)] -pub struct ResampleSpec { - pub resample_factor_reciprocal: f64, - pub interpolation_output_size: usize, - pub high_coefficients: Vec, - pub low_coefficients: Vec, -} - impl SampleRate { pub fn as_u32(&self) -> u32 { use SampleRate::*; @@ -207,41 +134,73 @@ impl SampleRate { } } - pub fn get_resample_spec(&self) -> ResampleSpec { + pub fn get_resample_factor_reciprocal(&self) -> Option { + use SampleRate::*; + + match self { + Hz44100 => None, + Hz48000 => Some(HZ48000_RESAMPLE_FACTOR_RECIPROCAL), + Hz88200 => Some(HZ88200_RESAMPLE_FACTOR_RECIPROCAL), + Hz96000 => Some(HZ96000_RESAMPLE_FACTOR_RECIPROCAL), + } + } + + pub fn get_interpolation_output_size(&self) -> Option { use SampleRate::*; match self { - // Dummy values to satisfy - // the match statement. - // 44.1kHz will be bypassed. - Hz44100 => { - warn!("Resampling 44.1kHz to 44.1kHz is just a really CPU intensive no-op, you should not be doing it"); - - ResampleSpec { - resample_factor_reciprocal: 1.0, - interpolation_output_size: RESAMPLER_INPUT_SIZE, - high_coefficients: vec![], - low_coefficients: vec![], - } - } - Hz48000 => ResampleSpec { - resample_factor_reciprocal: HZ48000_RESAMPLE_FACTOR_RECIPROCAL, - interpolation_output_size: HZ48000_INTERPOLATION_OUTPUT_SIZE, - high_coefficients: HZ48000_HIGH.to_vec(), - low_coefficients: HZ48000_LOW.to_vec(), - }, - Hz88200 => ResampleSpec { - resample_factor_reciprocal: HZ88200_RESAMPLE_FACTOR_RECIPROCAL, - interpolation_output_size: HZ88200_INTERPOLATION_OUTPUT_SIZE, - high_coefficients: HZ88200_HIGH.to_vec(), - low_coefficients: HZ88200_LOW.to_vec(), - }, - Hz96000 => ResampleSpec { - resample_factor_reciprocal: HZ96000_RESAMPLE_FACTOR_RECIPROCAL, - interpolation_output_size: HZ96000_INTERPOLATION_OUTPUT_SIZE, - high_coefficients: HZ96000_HIGH.to_vec(), - low_coefficients: HZ96000_LOW.to_vec(), - }, + Hz44100 => None, + Hz48000 => Some(HZ48000_INTERPOLATION_OUTPUT_SIZE), + Hz88200 => Some(HZ88200_INTERPOLATION_OUTPUT_SIZE), + Hz96000 => Some(HZ96000_INTERPOLATION_OUTPUT_SIZE), + } + } + + pub fn get_interpolation_coefficients(&self) -> Option> { + use SampleRate::*; + + match self { + Hz44100 => None, + Hz48000 => Some(Self::calculate_interpolation_coefficients( + HZ48000_COEFFICIENTS.to_vec(), + HZ48000_RESAMPLE_FACTOR_RECIPROCAL, + )), + Hz88200 => Some(Self::calculate_interpolation_coefficients( + HZ88200_COEFFICIENTS.to_vec(), + HZ88200_RESAMPLE_FACTOR_RECIPROCAL, + )), + Hz96000 => Some(Self::calculate_interpolation_coefficients( + HZ96000_COEFFICIENTS.to_vec(), + HZ96000_RESAMPLE_FACTOR_RECIPROCAL, + )), + } + } + + fn calculate_interpolation_coefficients( + mut coefficients: Vec, + resample_factor_reciprocal: f64, + ) -> Vec { + let mut coefficient_sum = 0.0; + + for (index, coefficient) in coefficients.iter_mut().enumerate() { + *coefficient *= Self::sinc((index as f64 * resample_factor_reciprocal).fract()); + + coefficient_sum += *coefficient; + } + + coefficients + .iter_mut() + .for_each(|coefficient| *coefficient /= coefficient_sum); + + coefficients + } + + fn sinc(x: f64) -> f64 { + if x.abs() < f64::EPSILON { + 1.0 + } else { + let pi_x = std::f64::consts::PI * x; + pi_x.sin() / pi_x } } } @@ -361,7 +320,6 @@ pub struct PlayerConfig { pub gapless: bool, pub passthrough: bool, - pub interpolation_quality: InterpolationQuality, pub sample_rate: SampleRate, pub normalisation: bool, @@ -384,7 +342,6 @@ impl Default for PlayerConfig { bitrate: Bitrate::default(), gapless: true, normalisation: false, - interpolation_quality: InterpolationQuality::default(), sample_rate: SampleRate::default(), normalisation_type: NormalisationType::default(), normalisation_method: NormalisationMethod::default(), diff --git a/playback/src/filter_coefficients.rs b/playback/src/filter_coefficients.rs index 96a2c42b7..34c2c21f9 100644 --- a/playback/src/filter_coefficients.rs +++ b/playback/src/filter_coefficients.rs @@ -1,1187 +1,1344 @@ // All Windows calculated with pyfda (Python Filter Design Analysis Tool) // https://github.com/chipmuenk/pyfda // Window = Kaiser -// beta = 8.6 (Similar to a Blackman Window) -// fc = 22.5kHz -// -86dB by 23kHz +// beta = 14 +// fc = 22.6kHz +// -135dB @23kHz +// The assumption is that the input +// is anti-aliased properly, +// We just want to make sure interpolation +// doesn't add any artifacts. #[allow(clippy::excessive_precision)] -pub const HZ48000_HIGH: [f64; 257] = [ - -1.4287799853519804e-19, - -8.529928242661527e-07, - 2.1395999264221267e-06, - -3.880458963785995e-06, - 6.05893601403254e-06, - -8.613527303281799e-06, - 1.1432294466108613e-05, - -1.4350136921309217e-05, - 1.7149627991629572e-05, - -1.956600058898423e-05, - 2.1296664705444228e-05, - -2.201537812656286e-05, - 2.1390883855947267e-05, - -1.9109487313809015e-05, - 1.490069206906713e-05, - -8.564666558168402e-06, - -2.4187562985455694e-19, - 1.0770051522629687e-05, - -2.357480377576126e-05, - 3.80789154370508e-05, - -5.37726902353467e-05, - 6.997172608513909e-05, - -8.582740473543781e-05, - 0.0001003492559243388, - -0.00011243964464523357, - 0.00012094053924787859, - -0.0001246913509069703, - 0.00012259602869291528, - -0.00011369679289372431, - 9.725114087319391e-05, - -7.280811540502643e-05, - 4.027933539700687e-05, - -8.761722338284784e-19, - -4.7224970562679786e-05, - 0.0001000942700094669, - -0.00015680711547266284, - 0.00021508702286534775, - -0.00027223465216542913, - 0.00032521058924288055, - -0.00037074739096535606, - 0.00040548854166410335, - -0.00042615022958145474, - 0.0004297001408507999, - -0.00041354588242148774, - 0.00037572428338265103, - -0.0003150817831073127, - 0.00023143548325566652, - -0.00012570429408715404, - 8.736848542712518e-18, - 0.00014233096258373752, - -0.00029672267470682895, - 0.00045746741021428363, - -0.0006178587763843014, - 0.0007704002699025563, - -0.0009070758950716863, - 0.0010196760363510072, - -0.001100168333253743, - 0.0011411000481453986, - -0.0011360155279515375, - 0.0010798700171927062, - -0.0009694194473815131, - 0.0008035650497546995, - -0.0005836318265664195, - 0.0003135611435773604, - -3.649849800074037e-17, - -0.0003477271314898191, - 0.0007177736996011124, - -0.0010960583702874734, - 0.0014666830951029159, - -0.0018124745987316703, - 0.0021156355406508768, - -0.0023584853377038536, - 0.002524264795160409, - -0.0025979735902941564, - 0.0025672055778467244, - -0.002422944105830126, - 0.0021602782649567656, - -0.0017790014114850766, - 0.001284055499878637, - -0.0006857887606066072, - 7.209995999923543e-18, - 0.000752249860282943, - -0.0015450696726810457, - 0.0023484142653889145, - -0.003128995352023552, - 0.00385140677724417, - -0.004479433137231434, - 0.004977500880593015, - -0.005312222191564676, - 0.005453974732678532, - -0.005378455081534177, - 0.005068140772503758, - -0.004513595500789128, - 0.003714554414731469, - -0.0026807315526779464, - 0.0014322992948101853, - -8.297338214945322e-17, - -0.001575137531433456, - 0.003242489907858635, - -0.004942936992960944, - 0.006610347331237228, - -0.008173416627546943, - 0.009557809308226558, - -0.010688539065884867, - 0.011492512118343826, - -0.011901147266026046, - 0.01185298019699458, - -0.011296156240663045, - 0.01019071615665419, - -0.00851058366772981, - 0.006245171256720193, - -0.0034005320447053696, - 1.0063905996254467e-16, - 0.003915722194550309, - -0.008289049174613953, - 0.013046573943979376, - -0.01810068406300195, - 0.023351692368405477, - -0.02869042197225499, - 0.03400116752010972, - -0.03916493952679325, - 0.044062886688337265, - -0.04857978290438118, - 0.052607461706064784, - -0.056048081078209105, - 0.058817106327538726, - -0.06084590754218613, - 0.06208388100251895, - 0.9375003025680546, - 0.06208388100251895, - -0.06084590754218613, - 0.058817106327538726, - -0.056048081078209105, - 0.052607461706064784, - -0.04857978290438118, - 0.044062886688337265, - -0.03916493952679325, - 0.03400116752010972, - -0.02869042197225499, - 0.023351692368405477, - -0.01810068406300195, - 0.013046573943979376, - -0.008289049174613953, - 0.003915722194550309, - 1.0063905996254467e-16, - -0.0034005320447053696, - 0.006245171256720193, - -0.00851058366772981, - 0.01019071615665419, - -0.011296156240663045, - 0.01185298019699458, - -0.011901147266026046, - 0.011492512118343826, - -0.010688539065884867, - 0.009557809308226558, - -0.008173416627546943, - 0.006610347331237228, - -0.004942936992960944, - 0.003242489907858635, - -0.001575137531433456, - -8.297338214945322e-17, - 0.0014322992948101853, - -0.0026807315526779464, - 0.003714554414731469, - -0.004513595500789128, - 0.005068140772503758, - -0.005378455081534177, - 0.005453974732678532, - -0.005312222191564676, - 0.004977500880593015, - -0.004479433137231434, - 0.00385140677724417, - -0.003128995352023552, - 0.0023484142653889145, - -0.0015450696726810457, - 0.000752249860282943, - 7.209995999923543e-18, - -0.0006857887606066072, - 0.001284055499878637, - -0.0017790014114850766, - 0.0021602782649567656, - -0.002422944105830126, - 0.0025672055778467244, - -0.0025979735902941564, - 0.002524264795160409, - -0.0023584853377038536, - 0.0021156355406508768, - -0.0018124745987316703, - 0.0014666830951029159, - -0.0010960583702874734, - 0.0007177736996011124, - -0.0003477271314898191, - -3.649849800074037e-17, - 0.0003135611435773604, - -0.0005836318265664195, - 0.0008035650497546995, - -0.0009694194473815131, - 0.0010798700171927062, - -0.0011360155279515375, - 0.0011411000481453986, - -0.001100168333253743, - 0.0010196760363510072, - -0.0009070758950716863, - 0.0007704002699025563, - -0.0006178587763843014, - 0.00045746741021428363, - -0.00029672267470682895, - 0.00014233096258373752, - 8.736848542712518e-18, - -0.00012570429408715404, - 0.00023143548325566652, - -0.0003150817831073127, - 0.00037572428338265103, - -0.00041354588242148774, - 0.0004297001408507999, - -0.00042615022958145474, - 0.00040548854166410335, - -0.00037074739096535606, - 0.00032521058924288055, - -0.00027223465216542913, - 0.00021508702286534775, - -0.00015680711547266284, - 0.0001000942700094669, - -4.7224970562679786e-05, - -8.761722338284784e-19, - 4.027933539700687e-05, - -7.280811540502643e-05, - 9.725114087319391e-05, - -0.00011369679289372431, - 0.00012259602869291528, - -0.0001246913509069703, - 0.00012094053924787859, - -0.00011243964464523357, - 0.0001003492559243388, - -8.582740473543781e-05, - 6.997172608513909e-05, - -5.37726902353467e-05, - 3.80789154370508e-05, - -2.357480377576126e-05, - 1.0770051522629687e-05, - -2.4187562985455694e-19, - -8.564666558168402e-06, - 1.490069206906713e-05, - -1.9109487313809015e-05, - 2.1390883855947267e-05, - -2.201537812656286e-05, - 2.1296664705444228e-05, - -1.956600058898423e-05, - 1.7149627991629572e-05, - -1.4350136921309217e-05, - 1.1432294466108613e-05, - -8.613527303281799e-06, - 6.05893601403254e-06, - -3.880458963785995e-06, - 2.1395999264221267e-06, - -8.529928242661527e-07, - -1.4287799853519804e-19, +pub const HZ48000_COEFFICIENTS: [f64; 441] = [ + -5.5898593440858395e-09, + 1.0913945993631158e-08, + -1.8447644976605675e-08, + 2.827144396409727e-08, + -4.024211254126596e-08, + 5.393424208780789e-08, + -6.859027866704468e-08, + 8.308517520382529e-08, + -9.591199739315183e-08, + 1.0519460012849649e-07, + -1.087327859712005e-07, + 1.0408412580796342e-07, + -8.86848554125574e-08, + 6.000998593336837e-08, + -1.577004559076152e-08, + -4.586119154162904e-08, + 1.2599689196417987e-07, + -2.2477744138015385e-07, + 3.4111607321246537e-07, + -4.724677592934554e-07, + 6.14641261245081e-07, + -7.616753200822695e-07, + 9.057999132689763e-07, + -1.0375021477878136e-06, + 1.1457135512601666e-06, + -1.2181312044597222e-06, + 1.2416793423796073e-06, + -1.203110843853056e-06, + 1.0897396368546902e-06, + -8.902857740830988e-07, + 5.958051845116357e-07, + -2.0066637210706277e-07, + -2.964728248754251e-07, + 8.917432702022918e-07, + -1.575258366454465e-06, + 2.3304884039766586e-06, + -3.133880825732906e-06, + 3.954789003134589e-06, + -4.755765447758084e-06, + 5.493264653683118e-06, + -6.118785970798389e-06, + 6.5804682669122424e-06, + -6.825126099315265e-06, + 6.800692381566946e-06, + -6.459006033295035e-06, + 5.758855992315934e-06, + -4.669166586455524e-06, + 3.172185081201199e-06, + -1.2665117895541204e-06, + -1.03020199186843e-06, + 3.6790712906638065e-06, + -6.618493307048923e-06, + 9.763536147331218e-06, + -1.3006355918706097e-05, + 1.621776855098672e-05, + -1.9250063507863773e-05, + 2.194109792982434e-05, + -2.4119652940092734e-05, + 2.561197062580417e-05, + -2.62493228905365e-05, + 2.587639474800888e-05, + -2.436019786792742e-05, + 2.159916874973974e-05, + -1.753205338429578e-05, + 1.2146140242240748e-05, + -5.4843792795412645e-06, + -2.3490806300424058e-06, + 1.1185387411470646e-05, + -2.0789927241851487e-05, + 3.0864061594169206e-05, + -4.10499235121549e-05, + 5.093842847144261e-05, + -6.008052741741006e-05, + 6.800158610947042e-05, + -7.4218620662019e-05, + 7.825996008767842e-05, + -7.968674949726079e-05, + 7.811555978179852e-05, + -7.32412388137807e-05, + 6.485903317938998e-05, + -5.288493556097966e-05, + 3.737317777203735e-05, + -1.8529798647780818e-05, + -3.2787264065962586e-06, + 2.752269911714002e-05, + -5.35130009813505e-05, + 8.041202242309305e-05, + -0.00010725200343989784, + 0.00013296078045639195, + -0.00015639461530264393, + 0.0001763774461684334, + -0.00019174556010807085, + 0.00020139635664185088, + -0.00020433956754364047, + 0.00019974903461390974, + -0.00018701294030899093, + 0.00016578024962487681, + -0.00013600106789386616, + 9.795865791207787e-05, + -5.2290997688264146e-05, + -9.739381704717791e-18, + 5.755314437556841e-05, + -0.00011866760208918341, + 0.00018133809294707513, + -0.00024330563670695718, + 0.000302123199588952, + -0.00035523491844939266, + 0.0004000669070444421, + -0.00043412700043254536, + 0.0004551101994996822, + -0.0004610060670625218, + 0.00045020392805284615, + -0.0004215914644948016, + 0.0003746421932096022, + -0.0003094873873453029, + 0.00022696826284335906, + -0.00012866470181152685, + 1.689742286763739e-05, + 0.00010529867776372365, + -0.0002342313210045292, + 0.0003656379842131002, + -0.0004948024023824145, + 0.0006166982051786728, + -0.0007261562145904291, + 0.0008180507230519797, + -0.0008874989630055257, + 0.0009300670175048999, + -0.0009419746568255424, + 0.0009202910628089344, + -0.0008631131588891992, + 0.0007697183288608902, + -0.0006406837005145801, + 0.00047796489852153126, + -0.00028492822874055335, + 6.633162429063188e-05, + 0.00017174867045272017, + -0.0004220468242159239, + 0.0006762906465326384, + -0.0009254362574008086, + 0.0011599489531411513, + -0.0013701228935083733, + 0.001546430247246284, + -0.0016798886727793661, + 0.0017624345600795145, + -0.0017872883944171794, + 0.0017492979878222297, + -0.0016452452112519153, + 0.0014741022850088684, + -0.0012372246635918064, + 0.0009384690803195541, + -0.0005842273718879016, + 0.00018336923713844407, + 0.0002529099695279072, + -0.0007113370381514373, + 0.0011769014316997163, + -0.0016332820815803972, + 0.002063350416959112, + -0.0024497361819468904, + 0.002775439476565401, + -0.0030244697654446323, + 0.003182490455089602, + -0.003237446154822077, + 0.003180148997875467, + -0.0030048004741988145, + 0.002709426155221013, + -0.0022962024836139226, + 0.0017716574372591662, + -0.001146730303620726, + 0.00043667993465876313, + 0.00033916442021570737, + -0.0011578104251155595, + 0.0019931633638672016, + -0.002816729912607866, + 0.0035984491531386798, + -0.0043076297857655215, + 0.004913967762358028, + -0.005388614487523634, + 0.005705262499773863, + -0.0058412132942403565, + 0.005778390803836313, + -0.00550426410237929, + 0.005012644178091416, + -0.004304322154388249, + 0.003387520068958197, + -0.0022781301803723323, + 0.0009997246304212222, + 0.0004166760123974408, + -0.0019330794642281864, + 0.003505240073662417, + -0.005083607264562403, + 0.00661448470140276, + -0.008041373330975866, + 0.009306464599179479, + -0.010352244152518515, + 0.011123161435909615, + -0.011567316985421985, + 0.01163811704236709, + -0.011295844494554124, + 0.010509096142861966, + -0.009256038905002335, + 0.0075254417576722165, + -0.005317445883581211, + 0.0026440424799879843, + 0.0004707641980389151, + -0.003991121983225501, + 0.00786982793811118, + -0.012049151371098361, + 0.016461966674718012, + -0.02103317032471003, + 0.02568134740237257, + -0.03032064495702292, + 0.034862802680691994, + -0.03921928595751922, + 0.0433034625654074, + -0.04703276228567672, + 0.05033075849961849, + -0.053129112541160387, + 0.05536932509360657, + -0.05700424416688633, + 0.05799928601415643, + 0.941666669923033, + 0.05799928601415643, + -0.05700424416688633, + 0.05536932509360657, + -0.053129112541160387, + 0.05033075849961849, + -0.04703276228567672, + 0.0433034625654074, + -0.03921928595751922, + 0.034862802680691994, + -0.03032064495702292, + 0.02568134740237257, + -0.02103317032471003, + 0.016461966674718012, + -0.012049151371098361, + 0.00786982793811118, + -0.003991121983225501, + 0.0004707641980389151, + 0.0026440424799879843, + -0.005317445883581211, + 0.0075254417576722165, + -0.009256038905002335, + 0.010509096142861966, + -0.011295844494554124, + 0.01163811704236709, + -0.011567316985421985, + 0.011123161435909615, + -0.010352244152518515, + 0.009306464599179479, + -0.008041373330975866, + 0.00661448470140276, + -0.005083607264562403, + 0.003505240073662417, + -0.0019330794642281864, + 0.0004166760123974408, + 0.0009997246304212222, + -0.0022781301803723323, + 0.003387520068958197, + -0.004304322154388249, + 0.005012644178091416, + -0.00550426410237929, + 0.005778390803836313, + -0.0058412132942403565, + 0.005705262499773863, + -0.005388614487523634, + 0.004913967762358028, + -0.0043076297857655215, + 0.0035984491531386798, + -0.002816729912607866, + 0.0019931633638672016, + -0.0011578104251155595, + 0.00033916442021570737, + 0.00043667993465876313, + -0.001146730303620726, + 0.0017716574372591662, + -0.0022962024836139226, + 0.002709426155221013, + -0.0030048004741988145, + 0.003180148997875467, + -0.003237446154822077, + 0.003182490455089602, + -0.0030244697654446323, + 0.002775439476565401, + -0.0024497361819468904, + 0.002063350416959112, + -0.0016332820815803972, + 0.0011769014316997163, + -0.0007113370381514373, + 0.0002529099695279072, + 0.00018336923713844407, + -0.0005842273718879016, + 0.0009384690803195541, + -0.0012372246635918064, + 0.0014741022850088684, + -0.0016452452112519153, + 0.0017492979878222297, + -0.0017872883944171794, + 0.0017624345600795145, + -0.0016798886727793661, + 0.001546430247246284, + -0.0013701228935083733, + 0.0011599489531411513, + -0.0009254362574008086, + 0.0006762906465326384, + -0.0004220468242159239, + 0.00017174867045272017, + 6.633162429063188e-05, + -0.00028492822874055335, + 0.00047796489852153126, + -0.0006406837005145801, + 0.0007697183288608902, + -0.0008631131588891992, + 0.0009202910628089344, + -0.0009419746568255424, + 0.0009300670175048999, + -0.0008874989630055257, + 0.0008180507230519797, + -0.0007261562145904291, + 0.0006166982051786728, + -0.0004948024023824145, + 0.0003656379842131002, + -0.0002342313210045292, + 0.00010529867776372365, + 1.689742286763739e-05, + -0.00012866470181152685, + 0.00022696826284335906, + -0.0003094873873453029, + 0.0003746421932096022, + -0.0004215914644948016, + 0.00045020392805284615, + -0.0004610060670625218, + 0.0004551101994996822, + -0.00043412700043254536, + 0.0004000669070444421, + -0.00035523491844939266, + 0.000302123199588952, + -0.00024330563670695718, + 0.00018133809294707513, + -0.00011866760208918341, + 5.755314437556841e-05, + -9.739381704717791e-18, + -5.2290997688264146e-05, + 9.795865791207787e-05, + -0.00013600106789386616, + 0.00016578024962487681, + -0.00018701294030899093, + 0.00019974903461390974, + -0.00020433956754364047, + 0.00020139635664185088, + -0.00019174556010807085, + 0.0001763774461684334, + -0.00015639461530264393, + 0.00013296078045639195, + -0.00010725200343989784, + 8.041202242309305e-05, + -5.35130009813505e-05, + 2.752269911714002e-05, + -3.2787264065962586e-06, + -1.8529798647780818e-05, + 3.737317777203735e-05, + -5.288493556097966e-05, + 6.485903317938998e-05, + -7.32412388137807e-05, + 7.811555978179852e-05, + -7.968674949726079e-05, + 7.825996008767842e-05, + -7.4218620662019e-05, + 6.800158610947042e-05, + -6.008052741741006e-05, + 5.093842847144261e-05, + -4.10499235121549e-05, + 3.0864061594169206e-05, + -2.0789927241851487e-05, + 1.1185387411470646e-05, + -2.3490806300424058e-06, + -5.4843792795412645e-06, + 1.2146140242240748e-05, + -1.753205338429578e-05, + 2.159916874973974e-05, + -2.436019786792742e-05, + 2.587639474800888e-05, + -2.62493228905365e-05, + 2.561197062580417e-05, + -2.4119652940092734e-05, + 2.194109792982434e-05, + -1.9250063507863773e-05, + 1.621776855098672e-05, + -1.3006355918706097e-05, + 9.763536147331218e-06, + -6.618493307048923e-06, + 3.6790712906638065e-06, + -1.03020199186843e-06, + -1.2665117895541204e-06, + 3.172185081201199e-06, + -4.669166586455524e-06, + 5.758855992315934e-06, + -6.459006033295035e-06, + 6.800692381566946e-06, + -6.825126099315265e-06, + 6.5804682669122424e-06, + -6.118785970798389e-06, + 5.493264653683118e-06, + -4.755765447758084e-06, + 3.954789003134589e-06, + -3.133880825732906e-06, + 2.3304884039766586e-06, + -1.575258366454465e-06, + 8.917432702022918e-07, + -2.964728248754251e-07, + -2.0066637210706277e-07, + 5.958051845116357e-07, + -8.902857740830988e-07, + 1.0897396368546902e-06, + -1.203110843853056e-06, + 1.2416793423796073e-06, + -1.2181312044597222e-06, + 1.1457135512601666e-06, + -1.0375021477878136e-06, + 9.057999132689763e-07, + -7.616753200822695e-07, + 6.14641261245081e-07, + -4.724677592934554e-07, + 3.4111607321246537e-07, + -2.2477744138015385e-07, + 1.2599689196417987e-07, + -4.586119154162904e-08, + -1.577004559076152e-08, + 6.000998593336837e-08, + -8.86848554125574e-08, + 1.0408412580796342e-07, + -1.087327859712005e-07, + 1.0519460012849649e-07, + -9.591199739315183e-08, + 8.308517520382529e-08, + -6.859027866704468e-08, + 5.393424208780789e-08, + -4.024211254126596e-08, + 2.827144396409727e-08, + -1.8447644976605675e-08, + 1.0913945993631158e-08, + -5.5898593440858395e-09, ]; #[allow(clippy::excessive_precision)] -pub const HZ88200_HIGH: [f64; 257] = [ - -2.7177973650537016e-06, - 2.615116391456718e-06, - 4.371253470079787e-06, - -4.527642205236769e-06, - -6.343166732321034e-06, - 7.206853357278462e-06, - 8.608531809529578e-06, - -1.0831207319855358e-05, - -1.11168738348255e-05, - 1.5597004565971875e-05, - 1.3787248972132889e-05, - -2.1716246512168148e-05, - -1.6503125021559895e-05, - 2.9413629227200937e-05, - 1.9107254724178818e-05, - -3.8922617925675015e-05, - -2.139666772922098e-05, - 5.04805630067818e-05, - 2.3117918532840763e-05, - -6.432283649476294e-05, - -2.396273660981686e-05, - 8.067598787603222e-05, - 2.3564231002785538e-05, - -9.974994011030785e-05, - -2.149380441843341e-05, - 0.00012172926954179013, - 1.7258931076241913e-05, - -0.00014676363699943706, - -1.030194790401862e-05, - 0.0001749574609349626, - 1.8686890713852827e-19, - -0.0002063589463295164, - 1.4333731499066454e-05, - 0.00024094860458611302, - -3.344740787382722e-05, - -0.0002786274189628284, - 5.814642716712084e-05, - 0.00031920482651865724, - -8.928776855240112e-05, - -0.0003623867002575848, - 0.0001277727488249831, - 0.0004077635233859557, - -0.00017453818403045162, - -0.00045479895057210033, - 0.0002305459825657413, - 0.000502818948057389, - -0.00029677123118056025, - -0.000551001694669649, - 0.00037418887145730905, - 0.0005983684084941591, - -0.00046375910077735565, - -0.0006437752384124257, - 0.0005664116676635973, - 0.0006859063251323009, - -0.0006830292658687915, - -0.0007232680918226466, - 0.0008144302637888361, - 0.000754184768991671, - -0.0009613510348663591, - -0.0007767950905092509, - 0.0011244281797910076, - 0.0007890500159662434, - -0.0013041809517326277, - -0.000788711236573936, - 0.0015009942108703117, - 0.00077335010432126, - -0.00171510224350985, - -0.0007403464826028671, - 0.0019465737836333772, - 0.0006868868445776879, - -0.002195298570445892, - -0.0006099607339225542, - 0.002460975764167073, - 0.0005063544381987515, - -0.002743104523907686, - -0.00037264038864942025, - 0.003040977026074337, - 0.00020516036410315268, - -0.0033536741696310896, - -1.7263210195899785e-18, - 0.0036800641761425457, - -0.0002470486740043912, - -0.004018804248416292, - 0.0005405410133353366, - 0.004368345402486541, - -0.000885455697808869, - -0.004726940534504569, - 0.0012873008119620815, - 0.005092655727810584, - -0.001752261157027223, - -0.005463384747140825, - 0.0022874024955170562, - 0.005836866607731414, - -0.002900955402436162, - -0.006210706048228085, - 0.0036027121698355103, - 0.006582396679029297, - -0.0044045872407267005, - -0.006949346523208571, - 0.005321419255211435, - 0.007308905616676035, - -0.00637213881767667, - -0.007658395288879785, - 0.007581505281049055, - 0.00799513870616462, - -0.008982757034954967, - -0.008316492227824646, - 0.010621782037025395, - 0.00861987710070591, - -0.012563926080135948, - -0.008902811002566763, - 0.01490560790319659, - 0.0091629389377553, - -0.017795223882502632, - -0.009398062991380806, - 0.021473342249052296, - 0.009606170460125666, - -0.026356732255292163, - -0.009785459899039199, - 0.033234410282523816, - 0.009934364653757865, - -0.04379972993086113, - -0.010051573486085123, - 0.06245943058441552, - 0.01013604794705137, - -0.1053787714300839, - -0.010187036204577683, - 0.31806791600342954, - 0.5102041545837825, - 0.31806791600342954, - -0.010187036204577683, - -0.1053787714300839, - 0.01013604794705137, - 0.06245943058441552, - -0.010051573486085123, - -0.04379972993086113, - 0.009934364653757865, - 0.033234410282523816, - -0.009785459899039199, - -0.026356732255292163, - 0.009606170460125666, - 0.021473342249052296, - -0.009398062991380806, - -0.017795223882502632, - 0.0091629389377553, - 0.01490560790319659, - -0.008902811002566763, - -0.012563926080135948, - 0.00861987710070591, - 0.010621782037025395, - -0.008316492227824646, - -0.008982757034954967, - 0.00799513870616462, - 0.007581505281049055, - -0.007658395288879785, - -0.00637213881767667, - 0.007308905616676035, - 0.005321419255211435, - -0.006949346523208571, - -0.0044045872407267005, - 0.006582396679029297, - 0.0036027121698355103, - -0.006210706048228085, - -0.002900955402436162, - 0.005836866607731414, - 0.0022874024955170562, - -0.005463384747140825, - -0.001752261157027223, - 0.005092655727810584, - 0.0012873008119620815, - -0.004726940534504569, - -0.000885455697808869, - 0.004368345402486541, - 0.0005405410133353366, - -0.004018804248416292, - -0.0002470486740043912, - 0.0036800641761425457, - -1.7263210195899785e-18, - -0.0033536741696310896, - 0.00020516036410315268, - 0.003040977026074337, - -0.00037264038864942025, - -0.002743104523907686, - 0.0005063544381987515, - 0.002460975764167073, - -0.0006099607339225542, - -0.002195298570445892, - 0.0006868868445776879, - 0.0019465737836333772, - -0.0007403464826028671, - -0.00171510224350985, - 0.00077335010432126, - 0.0015009942108703117, - -0.000788711236573936, - -0.0013041809517326277, - 0.0007890500159662434, - 0.0011244281797910076, - -0.0007767950905092509, - -0.0009613510348663591, - 0.000754184768991671, - 0.0008144302637888361, - -0.0007232680918226466, - -0.0006830292658687915, - 0.0006859063251323009, - 0.0005664116676635973, - -0.0006437752384124257, - -0.00046375910077735565, - 0.0005983684084941591, - 0.00037418887145730905, - -0.000551001694669649, - -0.00029677123118056025, - 0.000502818948057389, - 0.0002305459825657413, - -0.00045479895057210033, - -0.00017453818403045162, - 0.0004077635233859557, - 0.0001277727488249831, - -0.0003623867002575848, - -8.928776855240112e-05, - 0.00031920482651865724, - 5.814642716712084e-05, - -0.0002786274189628284, - -3.344740787382722e-05, - 0.00024094860458611302, - 1.4333731499066454e-05, - -0.0002063589463295164, - 1.8686890713852827e-19, - 0.0001749574609349626, - -1.030194790401862e-05, - -0.00014676363699943706, - 1.7258931076241913e-05, - 0.00012172926954179013, - -2.149380441843341e-05, - -9.974994011030785e-05, - 2.3564231002785538e-05, - 8.067598787603222e-05, - -2.396273660981686e-05, - -6.432283649476294e-05, - 2.3117918532840763e-05, - 5.04805630067818e-05, - -2.139666772922098e-05, - -3.8922617925675015e-05, - 1.9107254724178818e-05, - 2.9413629227200937e-05, - -1.6503125021559895e-05, - -2.1716246512168148e-05, - 1.3787248972132889e-05, - 1.5597004565971875e-05, - -1.11168738348255e-05, - -1.0831207319855358e-05, - 8.608531809529578e-06, - 7.206853357278462e-06, - -6.343166732321034e-06, - -4.527642205236769e-06, - 4.371253470079787e-06, - 2.615116391456718e-06, - -2.7177973650537016e-06, +pub const HZ88200_COEFFICIENTS: [f64; 441] = [ + 8.058595303495023e-09, + 1.1164410742675034e-08, + -1.834612444267384e-08, + -1.9424317127161222e-08, + 3.470399824518788e-08, + 2.9351364956778238e-08, + -5.9236287507451805e-08, + -4.0329310022474063e-08, + 9.442874104372886e-08, + 5.1252015927973804e-08, + -1.4314173931971503e-07, + -6.038384481720754e-08, + 2.0858068140401943e-07, + 6.520501212902167e-08, + -2.942387362698457e-07, + -6.224446094258586e-08, + 4.038067790216079e-07, + 4.690389724842506e-08, + -5.410453885504562e-07, + -1.327780034269029e-08, + 7.096140327833705e-07, + -4.602454242949267e-08, + -9.128530361851588e-07, + 1.400476609582702e-07, + 1.153514633239858e-06, + -2.7964061076917227e-07, + -1.4334403784943435e-06, + 4.775799731791637e-07, + 1.7531834199421127e-06, + -7.486542346286468e-07, + -2.1115756528306433e-06, + 1.1096976547849667e-06, + 2.5052415523677086e-06, + -1.579560951498997e-06, + -2.928062524547098e-06, + 2.1790055998776213e-06, + 3.3705978932472636e-06, + -2.9305083169879625e-06, + -3.819471127730182e-06, + 3.857962435833691e-06, + 4.256732566259699e-06, + -4.986263411650372e-06, + -4.659212657071186e-06, + 6.340766694471393e-06, + 4.997882555619488e-06, + -7.946607681454008e-06, + -5.2372417157810265e-06, + 9.82787545875487e-06, + 5.334754812901623e-06, + -1.2006634573170386e-05, + -5.2403628514298615e-06, + 1.450179214314392e-05, + 4.896095547041007e-06, + -1.7327811217900517e-05, + -4.2358139366233924e-06, + 2.0493275397962476e-05, + 3.185113561839259e-06, + -2.3999314299323328e-05, + -1.6614193970150766e-06, + 2.783790441950413e-05, + -4.256961427955263e-07, + -3.1990065271813884e-05, + 3.173941358165234e-06, + 3.6423976202732847e-05, + -6.6874502330466056e-06, + -4.109304498865383e-05, + 1.1075617148554859e-05, + 4.5933964999486754e-05, + -1.6451597498613936e-05, + -5.086480328187937e-05, + 2.2930454547749106e-05, + 5.5783167207100614e-05, + -3.0626938027963004e-05, + -6.0564502192718865e-05, + 3.9652886086818705e-05, + 6.506057728281815e-05, + -5.011424923344988e-05, + -6.909821889691203e-05, + 6.210774281880756e-05, + 7.247835567346191e-05, + -7.571714323934564e-05, + -7.497543888759609e-05, + 9.100925235080701e-05, + 7.633730327249257e-05, + -0.00010802956437643628, + -7.62855320938512e-05, + 0.0001267976797212037, + 7.451638791140095e-05, + -0.00014730252036808646, + -7.07023665277954e-05, + 0.0001694974117200991, + 6.449442612161366e-05, + -0.00019329510563245006, + -5.552493646478074e-05, + 0.00021856282870987093, + 4.3411384450590315e-05, + -0.0002451174484729746, + -2.7760861958449754e-05, + 0.0002727208574707514, + 8.175350446293262e-06, + -0.000301075681582451, + 1.574219627451329e-05, + 0.00032982142336850854, + -4.438098369240243e-05, + -0.00035853115416994107, + 7.811475026563357e-05, + 0.00038670886951244185, + -0.0001172934263370293, + -0.00041378762106725593, + 0.00016223413753128256, + 0.00043912853481092385, + -0.00021321162792908824, + -0.00046202081900482506, + 0.00027044819406513414, + 0.00048168285712122966, + -0.00033410323586767206, + -0.0004972644698625385, + 0.00040426254465270706, + 0.0005078504169930537, + -0.00048092746079596055, + -0.0005124651939204006, + 0.0005640040443189775, + 0.0005100791599751228, + -0.0006532924099242525, + -0.0004996160153454388, + 0.0007484763835897675, + 0.00047996162188758965, + -0.0008491136402864984, + -0.0004499741398607246, + 0.0009546264813266019, + 0.00040849542838602043, + -0.0010642934049170283, + -0.000354363632505217, + 0.001177241614330107, + 0.000286426854550079, + -0.001292440594369857, + -0.00020355778259918607, + 0.0014086968681774087, + 0.00010466912458052477, + -0.0015246500225421789, + 1.1270326422551116e-05, + 0.0016387700604035705, + -0.00014521919138887294, + -0.0017493561037246722, + 0.00029804678389965455, + 0.0018545364278860156, + -0.00047051639918976965, + -0.0019522697595270074, + 0.0006632688581607293, + 0.0020403477124734453, + -0.0008768065605402637, + -0.002116398169818111, + 0.0011114783072262479, + 0.0021778893426735923, + -0.0013674651535379796, + -0.002222134145214816, + 0.001644767552386974, + 0.0022462944180159875, + -0.0019431940391347999, + -0.0022473844026248474, + 0.0022623516980562197, + 0.00222227271309064, + -0.002601638633898592, + -0.0021676818552305863, + 0.0029602386511356302, + 0.002080184098173319, + -0.0033371183183543013, + -0.001956192185604954, + 0.003731026566081312, + 0.0017919429579041331, + -0.004140496933626799, + -0.0015834713997048186, + 0.004563852544654041, + 0.0013265718694908902, + -0.0049992138527111905, + -0.0010167422176221208, + 0.00544450915747939, + 0.000649105018922161, + -0.005897487850658758, + -0.00021829802361471122, + 0.006355736307925873, + -0.0002816771658912436, + -0.006816696300987976, + 0.0008576637844305542, + 0.007277685762173749, + -0.0015176385169022642, + -0.007735921693995098, + 0.0022711133594585575, + 0.00818854497842636, + -0.003129701081607966, + -0.008632646805992813, + 0.004107922250082698, + 0.009065296413811269, + -0.005224377805944017, + -0.009483569795103775, + 0.006503490381188878, + 0.009884579020956796, + -0.0079781587424328, + -0.010265501798697115, + 0.009693932014604889, + 0.010623610880579911, + -0.011715821106246794, + -0.010956302931813112, + 0.014139916389609585, + 0.011261126468450096, + -0.01711429433601848, + -0.011535808483432447, + 0.020879213033550573, + 0.011778279393000688, + -0.02585114200918336, + -0.011986695955653133, + 0.03281880835765306, + 0.012159461841535801, + -0.04347528622408931, + -0.012295245561211103, + 0.06222704404440664, + 0.01239299549868499, + -0.10523907567217393, + -0.01245195183379903, + 0.3180212648808669, + 0.5124716493354751, + 0.3180212648808669, + -0.01245195183379903, + -0.10523907567217393, + 0.01239299549868499, + 0.06222704404440664, + -0.012295245561211103, + -0.04347528622408931, + 0.012159461841535801, + 0.03281880835765306, + -0.011986695955653133, + -0.02585114200918336, + 0.011778279393000688, + 0.020879213033550573, + -0.011535808483432447, + -0.01711429433601848, + 0.011261126468450096, + 0.014139916389609585, + -0.010956302931813112, + -0.011715821106246794, + 0.010623610880579911, + 0.009693932014604889, + -0.010265501798697115, + -0.0079781587424328, + 0.009884579020956796, + 0.006503490381188878, + -0.009483569795103775, + -0.005224377805944017, + 0.009065296413811269, + 0.004107922250082698, + -0.008632646805992813, + -0.003129701081607966, + 0.00818854497842636, + 0.0022711133594585575, + -0.007735921693995098, + -0.0015176385169022642, + 0.007277685762173749, + 0.0008576637844305542, + -0.006816696300987976, + -0.0002816771658912436, + 0.006355736307925873, + -0.00021829802361471122, + -0.005897487850658758, + 0.000649105018922161, + 0.00544450915747939, + -0.0010167422176221208, + -0.0049992138527111905, + 0.0013265718694908902, + 0.004563852544654041, + -0.0015834713997048186, + -0.004140496933626799, + 0.0017919429579041331, + 0.003731026566081312, + -0.001956192185604954, + -0.0033371183183543013, + 0.002080184098173319, + 0.0029602386511356302, + -0.0021676818552305863, + -0.002601638633898592, + 0.00222227271309064, + 0.0022623516980562197, + -0.0022473844026248474, + -0.0019431940391347999, + 0.0022462944180159875, + 0.001644767552386974, + -0.002222134145214816, + -0.0013674651535379796, + 0.0021778893426735923, + 0.0011114783072262479, + -0.002116398169818111, + -0.0008768065605402637, + 0.0020403477124734453, + 0.0006632688581607293, + -0.0019522697595270074, + -0.00047051639918976965, + 0.0018545364278860156, + 0.00029804678389965455, + -0.0017493561037246722, + -0.00014521919138887294, + 0.0016387700604035705, + 1.1270326422551116e-05, + -0.0015246500225421789, + 0.00010466912458052477, + 0.0014086968681774087, + -0.00020355778259918607, + -0.001292440594369857, + 0.000286426854550079, + 0.001177241614330107, + -0.000354363632505217, + -0.0010642934049170283, + 0.00040849542838602043, + 0.0009546264813266019, + -0.0004499741398607246, + -0.0008491136402864984, + 0.00047996162188758965, + 0.0007484763835897675, + -0.0004996160153454388, + -0.0006532924099242525, + 0.0005100791599751228, + 0.0005640040443189775, + -0.0005124651939204006, + -0.00048092746079596055, + 0.0005078504169930537, + 0.00040426254465270706, + -0.0004972644698625385, + -0.00033410323586767206, + 0.00048168285712122966, + 0.00027044819406513414, + -0.00046202081900482506, + -0.00021321162792908824, + 0.00043912853481092385, + 0.00016223413753128256, + -0.00041378762106725593, + -0.0001172934263370293, + 0.00038670886951244185, + 7.811475026563357e-05, + -0.00035853115416994107, + -4.438098369240243e-05, + 0.00032982142336850854, + 1.574219627451329e-05, + -0.000301075681582451, + 8.175350446293262e-06, + 0.0002727208574707514, + -2.7760861958449754e-05, + -0.0002451174484729746, + 4.3411384450590315e-05, + 0.00021856282870987093, + -5.552493646478074e-05, + -0.00019329510563245006, + 6.449442612161366e-05, + 0.0001694974117200991, + -7.07023665277954e-05, + -0.00014730252036808646, + 7.451638791140095e-05, + 0.0001267976797212037, + -7.62855320938512e-05, + -0.00010802956437643628, + 7.633730327249257e-05, + 9.100925235080701e-05, + -7.497543888759609e-05, + -7.571714323934564e-05, + 7.247835567346191e-05, + 6.210774281880756e-05, + -6.909821889691203e-05, + -5.011424923344988e-05, + 6.506057728281815e-05, + 3.9652886086818705e-05, + -6.0564502192718865e-05, + -3.0626938027963004e-05, + 5.5783167207100614e-05, + 2.2930454547749106e-05, + -5.086480328187937e-05, + -1.6451597498613936e-05, + 4.5933964999486754e-05, + 1.1075617148554859e-05, + -4.109304498865383e-05, + -6.6874502330466056e-06, + 3.6423976202732847e-05, + 3.173941358165234e-06, + -3.1990065271813884e-05, + -4.256961427955263e-07, + 2.783790441950413e-05, + -1.6614193970150766e-06, + -2.3999314299323328e-05, + 3.185113561839259e-06, + 2.0493275397962476e-05, + -4.2358139366233924e-06, + -1.7327811217900517e-05, + 4.896095547041007e-06, + 1.450179214314392e-05, + -5.2403628514298615e-06, + -1.2006634573170386e-05, + 5.334754812901623e-06, + 9.82787545875487e-06, + -5.2372417157810265e-06, + -7.946607681454008e-06, + 4.997882555619488e-06, + 6.340766694471393e-06, + -4.659212657071186e-06, + -4.986263411650372e-06, + 4.256732566259699e-06, + 3.857962435833691e-06, + -3.819471127730182e-06, + -2.9305083169879625e-06, + 3.3705978932472636e-06, + 2.1790055998776213e-06, + -2.928062524547098e-06, + -1.579560951498997e-06, + 2.5052415523677086e-06, + 1.1096976547849667e-06, + -2.1115756528306433e-06, + -7.486542346286468e-07, + 1.7531834199421127e-06, + 4.775799731791637e-07, + -1.4334403784943435e-06, + -2.7964061076917227e-07, + 1.153514633239858e-06, + 1.400476609582702e-07, + -9.128530361851588e-07, + -4.602454242949267e-08, + 7.096140327833705e-07, + -1.327780034269029e-08, + -5.410453885504562e-07, + 4.690389724842506e-08, + 4.038067790216079e-07, + -6.224446094258586e-08, + -2.942387362698457e-07, + 6.520501212902167e-08, + 2.0858068140401943e-07, + -6.038384481720754e-08, + -1.4314173931971503e-07, + 5.1252015927973804e-08, + 9.442874104372886e-08, + -4.0329310022474063e-08, + -5.9236287507451805e-08, + 2.9351364956778238e-08, + 3.470399824518788e-08, + -1.9424317127161222e-08, + -1.834612444267384e-08, + 1.1164410742675034e-08, + 8.058595303495023e-09, ]; #[allow(clippy::excessive_precision)] -pub const HZ96000_HIGH: [f64; 257] = [ - -7.143923102926616e-20, - -4.351257283515671e-06, - -1.0907621221693655e-06, - 6.683906965798109e-06, - 3.2790831797631692e-06, - -9.13620584774856e-06, - -6.874774126129371e-06, - 1.1310163453885296e-05, - 1.2126657588758059e-05, - -1.265575645173113e-05, - -1.9166554046744026e-05, - 1.248152779539428e-05, - 2.794862730250771e-05, - -9.984713045871162e-06, - -3.8189337778906546e-05, - 4.303067618516991e-06, - 4.931445698739215e-05, - 5.411099152784563e-06, - -6.042042478905683e-05, - -1.989624512124905e-05, - 7.025763351163002e-05, - 3.967018140695091e-05, - -7.72428741451272e-05, - -6.490829524996992e-05, - 7.9507093138109e-05, - 9.532015440656505e-05, - -7.498274957040692e-05, - -0.00013003529388340405, - 6.153246053554203e-05, - 0.0001675104888314477, - -3.711737577180626e-05, - -0.00020547154270862667, - 4.380875381487169e-19, - 0.0002409023748839593, - 5.102778188775271e-05, - -0.0002700928372585857, - -0.00011640463560427953, - 0.00028875415767545045, - 0.00019556435946416691, - -0.0002922072182944144, - -0.0002867246276901985, - 0.0002756441457161496, - 0.0003867211644368446, - -0.0002344581317859229, - -0.0004909090262693411, - 0.00016463032935658855, - 0.0005931514994811955, - -6.315646659694906e-05, - -0.0006859142317553148, - -7.151005261521953e-05, - 0.0007604775938269121, - 0.0002390268636629881, - -0.0008072740136891249, - -0.00043677525441936056, - 0.0008163493865283938, - 0.0006595508119830226, - -0.0007779390126639911, - -0.0008993661964713373, - 0.0006831393454389286, - 0.00114539774688185, - -0.0005246477263799965, - -0.00138410277847316, - 0.00029753389026130304, - 0.0015995271835870914, - -1.8249308204396214e-17, - -0.001773813531049159, - -0.0003659190459608399, - 0.0018879086841156133, - 0.0007937657463383715, - -0.0019224576000959562, - -0.0012722307423329708, - 0.0018588571537189837, - 0.0017849305448029394, - -0.0016804313624166863, - -0.002310431475418928, - 0.0013736781639519724, - 0.0028225487316737353, - -0.0009295287890346657, - -0.0032909363527835883, - 0.0003445546173767534, - 0.003681968512252244, - 0.0003779460639632543, - -0.00395989577856263, - -0.0012270471817312566, - 0.004088242707216325, - 0.0021835391818022633, - -0.004031396395209965, - -0.003219566441111553, - 0.0037563205210019465, - 0.004298589347141008, - -0.003234316955594173, - -0.005375681266525964, - 0.0024427482073774184, - 0.00639814422962896, - -0.0013666295279113297, - -0.007306395272526002, - 4.1486825665423373e-17, - 0.008035036709816487, - 0.0016530123829845687, - -0.008513975101161425, - -0.0035775058023473096, - 0.008669388760192265, - 0.005747558403911614, - -0.008424248812489233, - -0.008126459615440715, - 0.007697946272157984, - 0.01066743495767241, - -0.006404309173724075, - -0.013314855511628901, - 0.004446782604876781, - 0.016005897813639956, - -0.00170849842523587, - -0.018672595414079837, - -0.001967340732302961, - 0.021244201096702293, - 0.006816838930484501, - -0.02364976015970634, - -0.013239145641295004, - 0.02582078137402188, - 0.021992767160156825, - -0.027693884168079493, - -0.03472848053143565, - 0.02921329883114049, - 0.05579974177257601, - -0.03033310130622086, - -0.10130968278740993, - 0.03101907530302571, - 0.3167001312508388, - 0.46875167199845, - 0.3167001312508388, - 0.03101907530302571, - -0.10130968278740993, - -0.03033310130622086, - 0.05579974177257601, - 0.02921329883114049, - -0.03472848053143565, - -0.027693884168079493, - 0.021992767160156825, - 0.02582078137402188, - -0.013239145641295004, - -0.02364976015970634, - 0.006816838930484501, - 0.021244201096702293, - -0.001967340732302961, - -0.018672595414079837, - -0.00170849842523587, - 0.016005897813639956, - 0.004446782604876781, - -0.013314855511628901, - -0.006404309173724075, - 0.01066743495767241, - 0.007697946272157984, - -0.008126459615440715, - -0.008424248812489233, - 0.005747558403911614, - 0.008669388760192265, - -0.0035775058023473096, - -0.008513975101161425, - 0.0016530123829845687, - 0.008035036709816487, - 4.1486825665423373e-17, - -0.007306395272526002, - -0.0013666295279113297, - 0.00639814422962896, - 0.0024427482073774184, - -0.005375681266525964, - -0.003234316955594173, - 0.004298589347141008, - 0.0037563205210019465, - -0.003219566441111553, - -0.004031396395209965, - 0.0021835391818022633, - 0.004088242707216325, - -0.0012270471817312566, - -0.00395989577856263, - 0.0003779460639632543, - 0.003681968512252244, - 0.0003445546173767534, - -0.0032909363527835883, - -0.0009295287890346657, - 0.0028225487316737353, - 0.0013736781639519724, - -0.002310431475418928, - -0.0016804313624166863, - 0.0017849305448029394, - 0.0018588571537189837, - -0.0012722307423329708, - -0.0019224576000959562, - 0.0007937657463383715, - 0.0018879086841156133, - -0.0003659190459608399, - -0.001773813531049159, - -1.8249308204396214e-17, - 0.0015995271835870914, - 0.00029753389026130304, - -0.00138410277847316, - -0.0005246477263799965, - 0.00114539774688185, - 0.0006831393454389286, - -0.0008993661964713373, - -0.0007779390126639911, - 0.0006595508119830226, - 0.0008163493865283938, - -0.00043677525441936056, - -0.0008072740136891249, - 0.0002390268636629881, - 0.0007604775938269121, - -7.151005261521953e-05, - -0.0006859142317553148, - -6.315646659694906e-05, - 0.0005931514994811955, - 0.00016463032935658855, - -0.0004909090262693411, - -0.0002344581317859229, - 0.0003867211644368446, - 0.0002756441457161496, - -0.0002867246276901985, - -0.0002922072182944144, - 0.00019556435946416691, - 0.00028875415767545045, - -0.00011640463560427953, - -0.0002700928372585857, - 5.102778188775271e-05, - 0.0002409023748839593, - 4.380875381487169e-19, - -0.00020547154270862667, - -3.711737577180626e-05, - 0.0001675104888314477, - 6.153246053554203e-05, - -0.00013003529388340405, - -7.498274957040692e-05, - 9.532015440656505e-05, - 7.9507093138109e-05, - -6.490829524996992e-05, - -7.72428741451272e-05, - 3.967018140695091e-05, - 7.025763351163002e-05, - -1.989624512124905e-05, - -6.042042478905683e-05, - 5.411099152784563e-06, - 4.931445698739215e-05, - 4.303067618516991e-06, - -3.8189337778906546e-05, - -9.984713045871162e-06, - 2.794862730250771e-05, - 1.248152779539428e-05, - -1.9166554046744026e-05, - -1.265575645173113e-05, - 1.2126657588758059e-05, - 1.1310163453885296e-05, - -6.874774126129371e-06, - -9.13620584774856e-06, - 3.2790831797631692e-06, - 6.683906965798109e-06, - -1.0907621221693655e-06, - -4.351257283515671e-06, - -7.143923102926616e-20, -]; - -#[allow(clippy::excessive_precision)] -pub const HZ48000_LOW: [f64; 129] = [ - -1.4287804154623814e-19, - -2.181517823792544e-06, - 6.5581470578797384e-06, - -1.3749507785319245e-05, - 2.4253243796448185e-05, - -3.8332995273522084e-05, - 5.589709009118714e-05, - -7.637845076415545e-05, - 9.862862369540776e-05, - -0.00012084049392574903, - 0.00014051485346619586, - -0.0001544852936160124, - 0.00015901371827411808, - -0.0001499650577703289, - 0.00012306455887295043, - -7.423453305983806e-05, - 8.761724975855263e-19, - 0.00010205526341099535, - -0.0002328085860166881, - 0.00039112756777908054, - -0.0005734475676350329, - 0.0007734400525193427, - -0.000981815162903983, - 0.001186299507498468, - -0.0013718244260180216, - 0.0015209507112593692, - -0.0016145432755263242, - 0.0016326939677845523, - -0.0015558734461504878, - 0.001366274669719045, - -0.0010492923645293963, - 0.000595066029150748, - -3.649850898800486e-17, - -0.0007318359380147118, - 0.0015875268203384464, - -0.0025444539959421624, - 0.0035698505829804923, - -0.004620849350959662, - 0.005645080848996707, - -0.006581853334149319, - 0.007363915351356501, - -0.007919768248015761, - 0.008176461349835438, - -0.008062769060436804, - 0.007512618931198147, - -0.006468614873048888, - 0.004885482036021499, - -0.002733251011439905, - 8.297340712720699e-17, - 0.0033060150358527928, - -0.007154990546444822, - 0.011495082976006515, - -0.016252871396153546, - 0.021334807123689837, - -0.026629632648107943, - 0.032011701411864754, - -0.03734508091577928, - 0.042488277143797916, - -0.047299381109978895, - 0.051641410759341526, - -0.05538760532182361, - 0.05842642570422467, - -0.06066602406289918, - 0.06203796801866447, - 0.9375005847868952, - 0.06203796801866447, - -0.06066602406289918, - 0.05842642570422467, - -0.05538760532182361, - 0.051641410759341526, - -0.047299381109978895, - 0.042488277143797916, - -0.03734508091577928, - 0.032011701411864754, - -0.026629632648107943, - 0.021334807123689837, - -0.016252871396153546, - 0.011495082976006515, - -0.007154990546444822, - 0.0033060150358527928, - 8.297340712720699e-17, - -0.002733251011439905, - 0.004885482036021499, - -0.006468614873048888, - 0.007512618931198147, - -0.008062769060436804, - 0.008176461349835438, - -0.007919768248015761, - 0.007363915351356501, - -0.006581853334149319, - 0.005645080848996707, - -0.004620849350959662, - 0.0035698505829804923, - -0.0025444539959421624, - 0.0015875268203384464, - -0.0007318359380147118, - -3.649850898800486e-17, - 0.000595066029150748, - -0.0010492923645293963, - 0.001366274669719045, - -0.0015558734461504878, - 0.0016326939677845523, - -0.0016145432755263242, - 0.0015209507112593692, - -0.0013718244260180216, - 0.001186299507498468, - -0.000981815162903983, - 0.0007734400525193427, - -0.0005734475676350329, - 0.00039112756777908054, - -0.0002328085860166881, - 0.00010205526341099535, - 8.761724975855263e-19, - -7.423453305983806e-05, - 0.00012306455887295043, - -0.0001499650577703289, - 0.00015901371827411808, - -0.0001544852936160124, - 0.00014051485346619586, - -0.00012084049392574903, - 9.862862369540776e-05, - -7.637845076415545e-05, - 5.589709009118714e-05, - -3.8332995273522084e-05, - 2.4253243796448185e-05, - -1.3749507785319245e-05, - 6.5581470578797384e-06, - -2.181517823792544e-06, - -1.4287804154623814e-19, -]; - -#[allow(clippy::excessive_precision)] -pub const HZ88200_LOW: [f64; 129] = [ - 5.875800344814529e-06, - 4.851699044013074e-06, - -1.5670438235895964e-05, - -9.287225758882044e-06, - 3.2188588517572685e-05, - 1.452725442412174e-05, - -5.80015310113526e-05, - -1.975318175268538e-05, - 9.615523116437566e-05, - 2.3552114164532385e-05, - -0.00015014174552603567, - -2.375916580017386e-05, - 0.00022383889492568076, - 1.729437074025395e-05, - -0.00032141607023776947, - -1.8686789504441635e-19, - 0.00044720587729591056, - -3.351608912018519e-05, - -0.0006055434276587542, - 9.002640046744051e-05, - 0.0008005773235174634, - -0.00017781632159122524, - -0.0010360586296973909, - 0.00030680368023040425, - 0.0013151162221446207, - -0.0004886505249968164, - -0.0016400286962743556, - 0.0007368790790811487, - 0.0020120043638640903, - -0.0010670133701345262, - -0.0024309816366330315, - 0.0014967816965620656, - 0.002895462190517508, - -0.002046435147324143, - -0.0034023886674580135, - 0.002739267989293373, - 0.003947077286631264, - -0.003602474524851333, - -0.0045232136384107564, - 0.0046685585578356776, - 0.005122917204805467, - -0.005977654559924746, - -0.005736876918489128, - 0.007581382917565772, - 0.006354556507022021, - -0.009549372598113655, - -0.006964464667634032, - 0.011980635507338782, - 0.007554481497059819, - -0.015024288868017965, - -0.008112229280669358, - 0.018919636740583255, - 0.008625472935527727, - -0.024080164100849143, - -0.009082533288527662, - 0.031289629556764974, - 0.009472695101363785, - -0.042234282967316725, - -0.009786591428611496, - 0.06131211363458383, - 0.01001654655736988, - -0.10467821599139523, - -0.010156861410646928, - 0.31783087768940993, - 0.5102013912850153, - 0.31783087768940993, - -0.010156861410646928, - -0.10467821599139523, - 0.01001654655736988, - 0.06131211363458383, - -0.009786591428611496, - -0.042234282967316725, - 0.009472695101363785, - 0.031289629556764974, - -0.009082533288527662, - -0.024080164100849143, - 0.008625472935527727, - 0.018919636740583255, - -0.008112229280669358, - -0.015024288868017965, - 0.007554481497059819, - 0.011980635507338782, - -0.006964464667634032, - -0.009549372598113655, - 0.006354556507022021, - 0.007581382917565772, - -0.005736876918489128, - -0.005977654559924746, - 0.005122917204805467, - 0.0046685585578356776, - -0.0045232136384107564, - -0.003602474524851333, - 0.003947077286631264, - 0.002739267989293373, - -0.0034023886674580135, - -0.002046435147324143, - 0.002895462190517508, - 0.0014967816965620656, - -0.0024309816366330315, - -0.0010670133701345262, - 0.0020120043638640903, - 0.0007368790790811487, - -0.0016400286962743556, - -0.0004886505249968164, - 0.0013151162221446207, - 0.00030680368023040425, - -0.0010360586296973909, - -0.00017781632159122524, - 0.0008005773235174634, - 9.002640046744051e-05, - -0.0006055434276587542, - -3.351608912018519e-05, - 0.00044720587729591056, - -1.8686789504441635e-19, - -0.00032141607023776947, - 1.729437074025395e-05, - 0.00022383889492568076, - -2.375916580017386e-05, - -0.00015014174552603567, - 2.3552114164532385e-05, - 9.615523116437566e-05, - -1.975318175268538e-05, - -5.80015310113526e-05, - 1.452725442412174e-05, - 3.2188588517572685e-05, - -9.287225758882044e-06, - -1.5670438235895964e-05, - 4.851699044013074e-06, - 5.875800344814529e-06, -]; - -#[allow(clippy::excessive_precision)] -pub const HZ96000_LOW: [f64; 129] = [ - -7.143944801213435e-20, - -1.1128313185646072e-05, - -3.3433343718178e-06, - 2.368294142133405e-05, - 1.3125839456769717e-05, - -4.065919588349948e-05, - -3.361363034503314e-05, - 6.0198389114399714e-05, - 6.974138571798226e-05, - -7.816273123033217e-05, - -0.000126460783407638, - 8.758503947913682e-05, - 0.0002077626777155509, - -7.835700358335798e-05, - -0.0003154059452699033, - 3.729708416324331e-05, - 0.0004474410769117699, - 5.1274839240568415e-05, - -0.0005966722898292008, - -0.00020436483462002328, - 0.0007492498350107482, - 0.0004384998464839666, - -0.0008836155865344651, - -0.0007673289520005847, - 0.000970032155449486, - 0.0011987515041766601, - -0.0009709031498968383, - -0.0017317724164334631, - 0.0008420376771297366, - 0.0023533499143115976, - -0.0005349278077261196, - -0.00303553840647302, - 1.824936363314565e-17, - 0.003733226210629766, - 0.0008093189947979181, - -0.004382713612447862, - -0.0019320007678197645, - 0.004901261108562161, - 0.0033946608064293073, - -0.00518754915999129, - -0.005207105621787521, - 0.0051227092580119855, - 0.007358664812266444, - -0.004571166160481191, - -0.009815768367302802, - 0.003379862524796346, - 0.012521152261727227, - -0.0013732462347513066, - -0.015394948058705999, - -0.0016610156480375167, - 0.018337745467632928, - 0.006006200853277362, - -0.021235526836812676, - -0.012095713970371423, - 0.02396617954234677, - 0.020705989626446524, - -0.02640711788557473, - -0.03348753234339166, - 0.028443411089665006, - 0.05477521964516673, - -0.029975735264560804, - -0.10063702926794785, - 0.030927455828749166, - 0.3164667874739216, - 0.4687530957411302, - 0.3164667874739216, - 0.030927455828749166, - -0.10063702926794785, - -0.029975735264560804, - 0.05477521964516673, - 0.028443411089665006, - -0.03348753234339166, - -0.02640711788557473, - 0.020705989626446524, - 0.02396617954234677, - -0.012095713970371423, - -0.021235526836812676, - 0.006006200853277362, - 0.018337745467632928, - -0.0016610156480375167, - -0.015394948058705999, - -0.0013732462347513066, - 0.012521152261727227, - 0.003379862524796346, - -0.009815768367302802, - -0.004571166160481191, - 0.007358664812266444, - 0.0051227092580119855, - -0.005207105621787521, - -0.00518754915999129, - 0.0033946608064293073, - 0.004901261108562161, - -0.0019320007678197645, - -0.004382713612447862, - 0.0008093189947979181, - 0.003733226210629766, - 1.824936363314565e-17, - -0.00303553840647302, - -0.0005349278077261196, - 0.0023533499143115976, - 0.0008420376771297366, - -0.0017317724164334631, - -0.0009709031498968383, - 0.0011987515041766601, - 0.000970032155449486, - -0.0007673289520005847, - -0.0008836155865344651, - 0.0004384998464839666, - 0.0007492498350107482, - -0.00020436483462002328, - -0.0005966722898292008, - 5.1274839240568415e-05, - 0.0004474410769117699, - 3.729708416324331e-05, - -0.0003154059452699033, - -7.835700358335798e-05, - 0.0002077626777155509, - 8.758503947913682e-05, - -0.000126460783407638, - -7.816273123033217e-05, - 6.974138571798226e-05, - 6.0198389114399714e-05, - -3.361363034503314e-05, - -4.065919588349948e-05, - 1.3125839456769717e-05, - 2.368294142133405e-05, - -3.3433343718178e-06, - -1.1128313185646072e-05, - -7.143944801213435e-20, +pub const HZ96000_COEFFICIENTS: [f64; 441] = [ + -1.079877906613748e-08, + -5.816482006876221e-09, + 2.14252840479858e-08, + 1.644823899883182e-08, + -3.423198573606121e-08, + -3.586817419344434e-08, + 4.72792269445946e-08, + 6.710223522329533e-08, + -5.718097280613143e-08, + -1.1296318743109678e-07, + 5.8845760023105516e-08, + 1.754966843058843e-07, + -4.5333064148152184e-08, + -2.55280393877378e-07, + 7.887725761857262e-09, + 3.506039566704585e-07, + 6.378372985812827e-08, + -4.5658020607887855e-07, + -1.8093627225211698e-07, + 5.642622389016971e-07, + 3.5486329942871434e-07, + -6.598645688127186e-07, + -5.956028482318442e-07, + 7.242072721958525e-07, + 9.102784315795048e-07, + -7.325169751206937e-07, + -1.30111762799947e-06, + 6.547248366360244e-07, + 1.763235780231912e-06, + -4.56396569626582e-07, + -2.282320419334115e-06, + 1.0041059949396591e-07, + 2.8324009692072383e-06, + 4.5053403985806337e-07, + -3.3739337299273417e-06, + -1.230549299872703e-06, + 3.852469275789067e-06, + 2.2663651128868673e-06, + -4.198193065120927e-06, + -3.572428328097531e-06, + 4.3266350744513984e-06, + 5.145501196981806e-06, + -4.1408259002349235e-06, + -6.95906342007277e-06, + 3.5351311814369222e-06, + 8.957916875570293e-06, + -2.400920941768864e-06, + -1.1053478057679391e-05, + 6.341249441753755e-07, + 1.3120311152221342e-05, + 1.8554089352802243e-06, + -1.4994495382014747e-05, + -5.132994742898774e-06, + 1.647442483790088e-05, + 9.22704417068226e-06, + -1.7324599538517497e-05, + -1.4116458895057936e-05, + 1.7282876773270887e-05, + 1.971825985244138e-05, + -1.6071508275150188e-05, + -2.5876394878813287e-05, + 1.3412091118001551e-05, + 3.235279363117955e-05, + -9.044311988679537e-06, + -3.8821816856393324e-05, + 2.748073489920096e-06, + 4.486926081467628e-05, + 5.6317303151034115e-06, + -4.999701379265777e-05, + -1.6158857168018527e-05, + 5.363431004310114e-05, + 2.877917530857051e-05, + -5.5156281370333755e-05, + -4.329563248875133e-05, + 5.391016756327052e-05, + 5.9346672634451695e-05, + -4.924911989125568e-05, + -7.639019801345494e-05, + 4.057302974796815e-05, + 9.369522850867177e-05, + -2.7375257182782152e-05, + -0.00011034333467630022, + 9.293548278501526e-06, + 0.00012524170075742044, + 1.383715098905581e-05, + -0.00013714929756337754, + -4.193281589089592e-05, + 0.00014471711147236022, + 7.461268661843834e-05, + -0.00014654269273845963, + -0.00011115945323635047, + 0.00014123847265870926, + 0.000150491066875432, + -0.00012751238455282522, + -0.00019114792758542898, + 0.0001042583482550357, + 0.00023129893545618108, + -7.06531916655492e-05, + -0.0002687693800171527, + 2.6255643301519532e-05, + 0.000301092877490911, + 2.889780070011791e-05, + -0.0003255885546151292, + -9.420598849454212e-05, + 0.00033946344566465283, + 0.0001684314770230706, + -0.00033993865651880045, + -0.00024965054938278966, + 0.00032439631254454517, + 0.0003352310709698163, + -0.00029054271658050806, + -0.00042184378132604334, + 0.00023658158227850837, + 0.0005055116389256671, + -0.0001613897678859756, + -0.0005817004699287977, + 6.468671180651762e-05, + 0.0006454524458362533, + 5.281214135463601e-05, + -0.0006915618790277906, + -0.00018926814881122883, + 0.000714790552452938, + 0.00034162877402785035, + -0.0007101173847592819, + -0.0005055831539232401, + 0.0006730147876627268, + 0.0006755726300424369, + -0.0005997417249942117, + -0.0008448633023848339, + 0.00048764136735651443, + 0.0010056854669598767, + -0.0003354294889188652, + -0.001149442099810962, + 0.0001434585038852857, + 0.0012669854378331033, + 8.605859371557195e-05, + -0.0013489572973602085, + -0.0003488800466319532, + 0.0013861852093199807, + 0.0006386377128833845, + -0.0013701229004342275, + -0.0009468231473704807, + 0.001293320293740428, + 0.0012628680602686808, + -0.0011499052250757546, + -0.0015743266041785549, + 0.0009360566583558054, + 0.001867163058549785, + -0.0006504475016193067, + -0.0021261440690781386, + 0.0002946343249142407, + 0.002335329834336233, + 0.00012662852539631036, + -0.002478653717090949, + -0.0006051716599622664, + 0.0025405749233313292, + 0.0011293091165455959, + -0.002506784382546535, + -0.0016838680343575472, + 0.0023649400266211543, + 0.0022503605932307595, + -0.002105404542346633, + -0.002807304021947901, + 0.001721956584918316, + 0.0033306885610649424, + -0.0012124455773972365, + -0.0037945869152243433, + 0.0005793607348454727, + 0.004171892215354463, + 0.00016971305357886603, + -0.004435165123855847, + -0.0010217763199813468, + 0.004557564758766223, + 0.00195825184850509, + -0.0045138328857219035, + -0.002954989403394932, + 0.004281296610914965, + 0.003982442446921648, + -0.003840851852837595, + -0.005006011427274409, + 0.00317788837726348, + 0.005986537221031309, + -0.002283117291579833, + -0.006880915636751068, + 0.0011532636856457289, + 0.007642789016691886, + 0.00020840942395630347, + -0.008223252836158386, + -0.0017917746200836891, + 0.008571491688270835, + 0.0035797333429711748, + -0.008635226158765013, + -0.005548343415115933, + 0.008360802279192898, + 0.007667186722225688, + -0.007692673977107417, + -0.009899973719828929, + 0.006571887526367808, + 0.012205372026292318, + -0.004932916451786409, + -0.014538037169428537, + 0.0026976882043333824, + 0.016849814982096506, + 0.00023540226769265576, + -0.019091077581331675, + -0.004012003511439891, + 0.021212148668528424, + 0.008861863396554733, + -0.023164769354312442, + -0.01518298610565233, + 0.024903553071409647, + 0.02373807312791805, + -0.02638737754150122, + -0.036187265861208455, + 0.027580663267870634, + 0.05689808474315233, + -0.028454491601256668, + -0.1019916622614968, + 0.028987520945239317, + 0.31693038415361274, + 0.4708333373415475, + 0.31693038415361274, + 0.028987520945239317, + -0.1019916622614968, + -0.028454491601256668, + 0.05689808474315233, + 0.027580663267870634, + -0.036187265861208455, + -0.02638737754150122, + 0.02373807312791805, + 0.024903553071409647, + -0.01518298610565233, + -0.023164769354312442, + 0.008861863396554733, + 0.021212148668528424, + -0.004012003511439891, + -0.019091077581331675, + 0.00023540226769265576, + 0.016849814982096506, + 0.0026976882043333824, + -0.014538037169428537, + -0.004932916451786409, + 0.012205372026292318, + 0.006571887526367808, + -0.009899973719828929, + -0.007692673977107417, + 0.007667186722225688, + 0.008360802279192898, + -0.005548343415115933, + -0.008635226158765013, + 0.0035797333429711748, + 0.008571491688270835, + -0.0017917746200836891, + -0.008223252836158386, + 0.00020840942395630347, + 0.007642789016691886, + 0.0011532636856457289, + -0.006880915636751068, + -0.002283117291579833, + 0.005986537221031309, + 0.00317788837726348, + -0.005006011427274409, + -0.003840851852837595, + 0.003982442446921648, + 0.004281296610914965, + -0.002954989403394932, + -0.0045138328857219035, + 0.00195825184850509, + 0.004557564758766223, + -0.0010217763199813468, + -0.004435165123855847, + 0.00016971305357886603, + 0.004171892215354463, + 0.0005793607348454727, + -0.0037945869152243433, + -0.0012124455773972365, + 0.0033306885610649424, + 0.001721956584918316, + -0.002807304021947901, + -0.002105404542346633, + 0.0022503605932307595, + 0.0023649400266211543, + -0.0016838680343575472, + -0.002506784382546535, + 0.0011293091165455959, + 0.0025405749233313292, + -0.0006051716599622664, + -0.002478653717090949, + 0.00012662852539631036, + 0.002335329834336233, + 0.0002946343249142407, + -0.0021261440690781386, + -0.0006504475016193067, + 0.001867163058549785, + 0.0009360566583558054, + -0.0015743266041785549, + -0.0011499052250757546, + 0.0012628680602686808, + 0.001293320293740428, + -0.0009468231473704807, + -0.0013701229004342275, + 0.0006386377128833845, + 0.0013861852093199807, + -0.0003488800466319532, + -0.0013489572973602085, + 8.605859371557195e-05, + 0.0012669854378331033, + 0.0001434585038852857, + -0.001149442099810962, + -0.0003354294889188652, + 0.0010056854669598767, + 0.00048764136735651443, + -0.0008448633023848339, + -0.0005997417249942117, + 0.0006755726300424369, + 0.0006730147876627268, + -0.0005055831539232401, + -0.0007101173847592819, + 0.00034162877402785035, + 0.000714790552452938, + -0.00018926814881122883, + -0.0006915618790277906, + 5.281214135463601e-05, + 0.0006454524458362533, + 6.468671180651762e-05, + -0.0005817004699287977, + -0.0001613897678859756, + 0.0005055116389256671, + 0.00023658158227850837, + -0.00042184378132604334, + -0.00029054271658050806, + 0.0003352310709698163, + 0.00032439631254454517, + -0.00024965054938278966, + -0.00033993865651880045, + 0.0001684314770230706, + 0.00033946344566465283, + -9.420598849454212e-05, + -0.0003255885546151292, + 2.889780070011791e-05, + 0.000301092877490911, + 2.6255643301519532e-05, + -0.0002687693800171527, + -7.06531916655492e-05, + 0.00023129893545618108, + 0.0001042583482550357, + -0.00019114792758542898, + -0.00012751238455282522, + 0.000150491066875432, + 0.00014123847265870926, + -0.00011115945323635047, + -0.00014654269273845963, + 7.461268661843834e-05, + 0.00014471711147236022, + -4.193281589089592e-05, + -0.00013714929756337754, + 1.383715098905581e-05, + 0.00012524170075742044, + 9.293548278501526e-06, + -0.00011034333467630022, + -2.7375257182782152e-05, + 9.369522850867177e-05, + 4.057302974796815e-05, + -7.639019801345494e-05, + -4.924911989125568e-05, + 5.9346672634451695e-05, + 5.391016756327052e-05, + -4.329563248875133e-05, + -5.5156281370333755e-05, + 2.877917530857051e-05, + 5.363431004310114e-05, + -1.6158857168018527e-05, + -4.999701379265777e-05, + 5.6317303151034115e-06, + 4.486926081467628e-05, + 2.748073489920096e-06, + -3.8821816856393324e-05, + -9.044311988679537e-06, + 3.235279363117955e-05, + 1.3412091118001551e-05, + -2.5876394878813287e-05, + -1.6071508275150188e-05, + 1.971825985244138e-05, + 1.7282876773270887e-05, + -1.4116458895057936e-05, + -1.7324599538517497e-05, + 9.22704417068226e-06, + 1.647442483790088e-05, + -5.132994742898774e-06, + -1.4994495382014747e-05, + 1.8554089352802243e-06, + 1.3120311152221342e-05, + 6.341249441753755e-07, + -1.1053478057679391e-05, + -2.400920941768864e-06, + 8.957916875570293e-06, + 3.5351311814369222e-06, + -6.95906342007277e-06, + -4.1408259002349235e-06, + 5.145501196981806e-06, + 4.3266350744513984e-06, + -3.572428328097531e-06, + -4.198193065120927e-06, + 2.2663651128868673e-06, + 3.852469275789067e-06, + -1.230549299872703e-06, + -3.3739337299273417e-06, + 4.5053403985806337e-07, + 2.8324009692072383e-06, + 1.0041059949396591e-07, + -2.282320419334115e-06, + -4.56396569626582e-07, + 1.763235780231912e-06, + 6.547248366360244e-07, + -1.30111762799947e-06, + -7.325169751206937e-07, + 9.102784315795048e-07, + 7.242072721958525e-07, + -5.956028482318442e-07, + -6.598645688127186e-07, + 3.5486329942871434e-07, + 5.642622389016971e-07, + -1.8093627225211698e-07, + -4.5658020607887855e-07, + 6.378372985812827e-08, + 3.506039566704585e-07, + 7.887725761857262e-09, + -2.55280393877378e-07, + -4.5333064148152184e-08, + 1.754966843058843e-07, + 5.8845760023105516e-08, + -1.1296318743109678e-07, + -5.718097280613143e-08, + 6.710223522329533e-08, + 4.72792269445946e-08, + -3.586817419344434e-08, + -3.423198573606121e-08, + 1.644823899883182e-08, + 2.14252840479858e-08, + -5.816482006876221e-09, + -1.079877906613748e-08, ]; diff --git a/playback/src/resampler.rs b/playback/src/resampler.rs index 25c3a749a..fe82d4845 100644 --- a/playback/src/resampler.rs +++ b/playback/src/resampler.rs @@ -7,9 +7,8 @@ use std::{ }; use crate::{ - config::{InterpolationQuality, SampleRate}, - player::PLAYER_COUNTER, - RESAMPLER_INPUT_SIZE, SAMPLE_RATE as SOURCE_SAMPLE_RATE, + config::SampleRate, player::PLAYER_COUNTER, RESAMPLER_INPUT_SIZE, + SAMPLE_RATE as SOURCE_SAMPLE_RATE, }; struct DelayLine { @@ -88,27 +87,27 @@ struct MonoSincResampler { } impl MonoSincResampler { - fn new(sample_rate: SampleRate, interpolation_quality: InterpolationQuality) -> Self { - let spec = sample_rate.get_resample_spec(); + fn new(sample_rate: SampleRate) -> Self { + let coefficients = sample_rate + .get_interpolation_coefficients() + .unwrap_or_default(); - let coefficients = match interpolation_quality { - InterpolationQuality::Low => spec.low_coefficients, - InterpolationQuality::High => spec.high_coefficients, - }; + let resample_factor_reciprocal = sample_rate + .get_resample_factor_reciprocal() + .unwrap_or_default(); - let delay_line_latency = - (coefficients.len() as f64 * spec.resample_factor_reciprocal) as u64; + let interpolation_output_size = sample_rate + .get_interpolation_output_size() + .unwrap_or_default(); - Self { - interpolator: ConvolutionFilter::new( - interpolation_quality - .get_interpolation_coefficients(coefficients, spec.resample_factor_reciprocal), - ), + let delay_line_latency = (coefficients.len() as f64 * resample_factor_reciprocal) as u64; + Self { + interpolator: ConvolutionFilter::new(coefficients), input_buffer: Vec::with_capacity(SOURCE_SAMPLE_RATE as usize), - resample_factor_reciprocal: spec.resample_factor_reciprocal, + resample_factor_reciprocal, delay_line_latency, - interpolation_output_size: spec.interpolation_output_size, + interpolation_output_size, } } @@ -281,7 +280,7 @@ pub struct StereoInterleavedResampler { } impl StereoInterleavedResampler { - pub fn new(sample_rate: SampleRate, interpolation_quality: InterpolationQuality) -> Self { + pub fn new(sample_rate: SampleRate) -> Self { debug!("Sample Rate: {sample_rate}"); let resampler = match sample_rate { @@ -292,7 +291,7 @@ impl StereoInterleavedResampler { Resampler::Bypass } _ => { - debug!("Interpolation Quality: {interpolation_quality}"); + debug!("Interpolation Type: Windowed Sinc"); // The player increments the player id when it gets it... let player_id = PLAYER_COUNTER.load(Ordering::SeqCst).saturating_sub(1); @@ -300,12 +299,15 @@ impl StereoInterleavedResampler { let left_thread_name = format!("resampler:{player_id}:left"); let right_thread_name = format!("resampler:{player_id}:right"); - let left = MonoSincResampler::new(sample_rate, interpolation_quality); - let right = MonoSincResampler::new(sample_rate, interpolation_quality); - Resampler::Worker { - left_resampler: ResampleWorker::new(left, left_thread_name), - right_resampler: ResampleWorker::new(right, right_thread_name), + left_resampler: ResampleWorker::new( + MonoSincResampler::new(sample_rate), + left_thread_name, + ), + right_resampler: ResampleWorker::new( + MonoSincResampler::new(sample_rate), + right_thread_name, + ), } } }; diff --git a/playback/src/sample_pipeline.rs b/playback/src/sample_pipeline.rs index bae88279d..53bbc29f3 100644 --- a/playback/src/sample_pipeline.rs +++ b/playback/src/sample_pipeline.rs @@ -23,8 +23,7 @@ impl SamplePipeline { sink: Box, volume_getter: Box, ) -> Self { - let resampler = - StereoInterleavedResampler::new(config.sample_rate, config.interpolation_quality); + let resampler = StereoInterleavedResampler::new(config.sample_rate); let normaliser = Normaliser::new(config, volume_getter); let converter = Converter::new(config.ditherer); diff --git a/src/main.rs b/src/main.rs index 231b24518..f959267a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,8 +24,8 @@ use librespot::{ playback::{ audio_backend::{self, SinkBuilder, BACKENDS}, config::{ - AudioFormat, Bitrate, InterpolationQuality, NormalisationMethod, NormalisationType, - PlayerConfig, SampleRate, VolumeCtrl, + AudioFormat, Bitrate, NormalisationMethod, NormalisationType, PlayerConfig, SampleRate, + VolumeCtrl, }, dither, mixer::{self, MixerConfig, MixerFn}, @@ -240,7 +240,6 @@ fn get_setup() -> Setup { const VOLUME_RANGE: &str = "volume-range"; const ZEROCONF_PORT: &str = "zeroconf-port"; const ZEROCONF_INTERFACE: &str = "zeroconf-interface"; - const INTERPOLATION_QUALITY: &str = "interpolation-quality"; const SAMPLE_RATE: &str = "sample-rate"; // Mostly arbitrary. @@ -579,11 +578,6 @@ fn get_setup() -> Setup { ZEROCONF_INTERFACE, "Comma-separated interface IP addresses on which zeroconf will bind. Defaults to all interfaces. Ignored by DNS-SD.", "IP" - ).optopt( - "", - INTERPOLATION_QUALITY, - "Interpolation Quality to use if Resampling {Low|High}. Defaults to High.", - "QUALITY" ).optopt( "", SAMPLE_RATE, @@ -800,32 +794,6 @@ fn get_setup() -> Setup { }) .unwrap_or_default(); - let interpolation_quality = opt_str(INTERPOLATION_QUALITY) - .as_deref() - .map(|interpolation_quality| match sample_rate { - SampleRate::Hz44100 => { - warn!( - "--{} has no effect with a sample rate of {sample_rate}.", - INTERPOLATION_QUALITY - ); - - InterpolationQuality::default() - } - _ => InterpolationQuality::from_str(interpolation_quality).unwrap_or_else(|_| { - let default_value = &format!("{}", InterpolationQuality::default()); - invalid_error_msg( - INTERPOLATION_QUALITY, - "", - interpolation_quality, - "Low, High", - default_value, - ); - - exit(1); - }), - }) - .unwrap_or_default(); - let format = opt_str(FORMAT) .as_deref() .map(|format| { @@ -1671,7 +1639,6 @@ fn get_setup() -> Setup { bitrate, gapless, passthrough, - interpolation_quality, sample_rate, normalisation, normalisation_type,