From 81cab06be76ff318338b645340fddd415c82a643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81lvarez?= Date: Sun, 20 Aug 2023 14:45:34 +0200 Subject: [PATCH] allow record on partial detections --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- src/cli/spot.rs | 4 ++++ src/cli/test.rs | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56c4473..601fba3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1291,9 +1291,9 @@ dependencies = [ [[package]] name = "rustpotter" -version = "3.0.0-beta.2" +version = "3.0.0-beta.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "930394679e72e416951e843891fec02158fecb85c9b1edb2d45351e86acd9a81" +checksum = "62e73cbed04283cc5af1dd62c019c9bc25c2637eb63a9cbca8839e2a3c740489" dependencies = [ "candle-core", "candle-nn", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "rustpotter-cli" -version = "3.0.0-beta.2" +version = "3.0.0-beta.4" dependencies = [ "clap", "cpal", diff --git a/Cargo.toml b/Cargo.toml index eec888b..aabf090 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustpotter-cli" -version = "3.0.0-beta.2" +version = "3.0.0-beta.4" edition = "2021" license = "Apache-2.0" description = "CLI for Rustpotter, an open source wakeword spotter forged in rust." @@ -8,7 +8,7 @@ authors = ["Miguel Álvarez Díez "] repository = "https://github.com/GiviMAD/rustpotter" exclude = ["tools/**",".github",".gitignore"] [dependencies] -rustpotter = { version = "3.0.0-beta.2", features = ["debug", "audio"] } +rustpotter = { version = "3.0.0-beta.4", features = ["debug", "audio", "record"] } ctrlc = "3.2.2" clap = { version = "4.1.6", features = ["derive"] } hound = "3.4.0" diff --git a/src/cli/spot.rs b/src/cli/spot.rs index 3bea7cd..f16e7e5 100644 --- a/src/cli/spot.rs +++ b/src/cli/spot.rs @@ -80,6 +80,9 @@ pub struct SpotCommand { #[clap(long)] /// Log rms level ref, gain applied per frame and frame rms level. debug_gain: bool, + #[clap(short, long)] + /// Path to create records, one on the first partial detection and another each one that scores better. + record_path: Option, } pub fn spot(command: SpotCommand) -> Result<(), String> { @@ -126,6 +129,7 @@ pub fn spot(command: SpotCommand) -> Result<(), String> { config.detector.min_scores = command.min_scores; config.detector.score_mode = command.score_mode.into(); config.detector.score_ref = command.score_ref; + config.detector.record_path = command.record_path; config.filters.gain_normalizer.enabled = command.gain_normalizer; config.filters.gain_normalizer.gain_ref = command.gain_ref; config.filters.gain_normalizer.min_gain = command.min_gain; diff --git a/src/cli/test.rs b/src/cli/test.rs index e03173c..c54ae8f 100644 --- a/src/cli/test.rs +++ b/src/cli/test.rs @@ -58,6 +58,9 @@ pub struct TestCommand { #[clap(long)] /// Log rms level ref, gain applied per frame and frame rms level. debug_gain: bool, + #[clap(short, long)] + /// Path to create records, one on the first partial detection and another each one that scores better. + record_path: Option, } pub fn test(command: TestCommand) -> Result<(), String> { println!( @@ -77,6 +80,7 @@ pub fn test(command: TestCommand) -> Result<(), String> { config.detector.min_scores = command.min_scores; config.detector.score_mode = command.score_mode.into(); config.detector.score_ref = command.score_ref; + config.detector.record_path = command.record_path; config.filters.gain_normalizer.enabled = command.gain_normalizer; config.filters.gain_normalizer.gain_ref = command.gain_ref; config.filters.gain_normalizer.min_gain = command.min_gain;