From 63bb5b8feaf9f62dc241e054190f144f4ed18a24 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sat, 18 Jan 2025 14:28:39 -0500 Subject: [PATCH] tuning for recorder --- interface/src/main.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/interface/src/main.rs b/interface/src/main.rs index 1de1628..35d0a9e 100644 --- a/interface/src/main.rs +++ b/interface/src/main.rs @@ -20,7 +20,7 @@ fn main() -> Result<()> { let (sender, notes) = mpsc::channel(); const POWER_THRESHOLD: f32 = 5.0; - const CLARITY_THRESHOLD: f32 = 0.7; + const CLARITY_THRESHOLD: f32 = 0.85; const PACKET_LEN: usize = 2204; let stream = device.build_input_stream(&config.into(), @@ -42,8 +42,8 @@ fn main() -> Result<()> { for (note,vol) in notes { if let Some(note) = note { //dbg!(note.frequency); - dbg!(note.clarity); - dbg!(vol); + //dbg!(note.clarity); + //dbg!(vol); let note = Note::from_freq(note.frequency, Tuning::EqualTemperament); match note.pitch { Pitch { letter: NoteLetter::A, accidental: 0} => { @@ -61,8 +61,15 @@ fn main() -> Result<()> { Pitch { letter: NoteLetter::G, accidental: 0} => { println!("fire"); } + Pitch { letter: NoteLetter::E, accidental: 0} => { + println!("fire"); + } pitch => { - dbg!(pitch); + if vol > 3000. { + println!("fire"); + } else { + //dbg!(pitch); + } } }