1
Fork 0

tuning for recorder

This commit is contained in:
Andy Killorin 2025-01-18 14:28:39 -05:00
parent 4945b4d777
commit 63bb5b8fea
Signed by: ank
GPG key ID: 23F9463ECB67FE8C

View file

@ -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);
}
}
}