changed int to float WAV conversion to sample / 0x8000

This commit is contained in:
Weird Constructor 2021-06-13 07:23:25 +02:00
parent c2ee0f0c21
commit 14525276b3
2 changed files with 2 additions and 2 deletions

View file

@ -64,7 +64,7 @@ impl SampleLibrary {
hound::SampleFormat::Int => { hound::SampleFormat::Int => {
for s in rd.samples::<i16>().step_by(channels) { for s in rd.samples::<i16>().step_by(channels) {
let s = s?; let s = s?;
let s = s as f32 / (i16::MAX as f32); let s = s as f32 / (0x8000 as f32);
v.push(s); v.push(s);
} }
}, },

View file

@ -220,7 +220,7 @@ fn check_node_sampl_reload() {
&mut matrix, "check_matrix_serialize.hxy").unwrap(); &mut matrix, "check_matrix_serialize.hxy").unwrap();
let rmsmima = run_and_get_l_rms_mimax(&mut node_exec, 50.0); 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); let fft = run_and_get_fft4096(&mut node_exec, 800, 20.0);
assert_eq!(fft[0], (441, 1023)); assert_eq!(fft[0], (441, 1023));