write_freq used hard coded values

This commit is contained in:
ghaisan
2024-10-02 18:08:05 +07:00
parent a8e3cfed03
commit 9af562d99d
+3 -2
View File
@@ -4,13 +4,14 @@ use std::f32::consts::PI;
use std::{fs, i16, io}; use std::{fs, i16, io};
const SAMPLE_RATE: f32 = 44100.0; const SAMPLE_RATE: f32 = 44100.0;
const BITS_PER_SAMPLE: u16 = 16;
const MORSE_FREQ: f32 = 600.0; const MORSE_FREQ: f32 = 600.0;
const UNIT_TIME: f32 = 100.0 / 1000.0; // IN MS const UNIT_TIME: f32 = 100.0 / 1000.0; // IN MS
const SPEC: hound::WavSpec = hound::WavSpec { const SPEC: hound::WavSpec = hound::WavSpec {
channels: 1, channels: 1,
sample_rate: 44100, sample_rate: SAMPLE_RATE as u32,
bits_per_sample: 16, bits_per_sample: BITS_PER_SAMPLE,
sample_format: hound::SampleFormat::Int, sample_format: hound::SampleFormat::Int,
}; };