From 9af562d99dd50ef65f627977ad4061ab407860ad Mon Sep 17 00:00:00 2001 From: ghaisan Date: Wed, 2 Oct 2024 18:08:05 +0700 Subject: [PATCH] write_freq used hard coded values --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 0da5be5..938acc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,13 +4,14 @@ use std::f32::consts::PI; use std::{fs, i16, io}; const SAMPLE_RATE: f32 = 44100.0; +const BITS_PER_SAMPLE: u16 = 16; const MORSE_FREQ: f32 = 600.0; const UNIT_TIME: f32 = 100.0 / 1000.0; // IN MS const SPEC: hound::WavSpec = hound::WavSpec { channels: 1, - sample_rate: 44100, - bits_per_sample: 16, + sample_rate: SAMPLE_RATE as u32, + bits_per_sample: BITS_PER_SAMPLE, sample_format: hound::SampleFormat::Int, };