From 14525276b31d135d58438099356fc3e17774da4a Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Sun, 13 Jun 2021 07:23:25 +0200 Subject: [PATCH] changed int to float WAV conversion to sample / 0x8000 --- src/sample_lib.rs | 2 +- tests/node_sampl.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sample_lib.rs b/src/sample_lib.rs index 6ecdbdb..77c40ae 100644 --- a/src/sample_lib.rs +++ b/src/sample_lib.rs @@ -64,7 +64,7 @@ impl SampleLibrary { hound::SampleFormat::Int => { for s in rd.samples::().step_by(channels) { let s = s?; - let s = s as f32 / (i16::MAX as f32); + let s = s as f32 / (0x8000 as f32); v.push(s); } }, diff --git a/tests/node_sampl.rs b/tests/node_sampl.rs index c8126a9..4393164 100644 --- a/tests/node_sampl.rs +++ b/tests/node_sampl.rs @@ -220,7 +220,7 @@ fn check_node_sampl_reload() { &mut matrix, "check_matrix_serialize.hxy").unwrap(); let rmsmima = run_and_get_l_rms_mimax(&mut node_exec, 50.0); - assert_rmsmima!(rmsmima, (0.5004, -0.9998, 0.9997)); + assert_rmsmima!(rmsmima, (0.5004, -0.9997, 0.9997)); let fft = run_and_get_fft4096(&mut node_exec, 800, 20.0); assert_eq!(fft[0], (441, 1023));