Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

experimental earshot vad implementation (#1967)

CJ Pais20ada47d7f98
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index a291d552..49848534 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -1553,6 +1553,12 @@ version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
+[[package]]
+name = "earshot"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afea66474c4036a7e5fa4b072a3b0a09cd0b01f00134da3115d76b7cc5899f03"
+
[[package]]
name = "embed-resource"
version = "3.0.6"
@@ -2501,6 +2507,7 @@ dependencies = [
"chrono",
"clap",
"cpal",
+ "earshot",
"enigo",
"env_filter",
"ferrous-opencc",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 47d2653c..2afba25c 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -56,6 +56,7 @@ log = "0.4.25"
env_filter = "0.1.0"
tokio = "1.43.0"
vad-rs = { git = "https://github.com/cjpais/vad-rs", default-features = false }
+earshot = "1.2.2"
enigo = "0.6.1"
rodio = { git = "https://github.com/cjpais/rodio.git" }
reqwest = { version = "0.12", features = ["json", "stream", "gzip", "brotli", "deflate"] }
diff --git a/src-tauri/src/audio_toolkit/audio/recorder.rs b/src-tauri/src/audio_toolkit/audio/recorder.rs
index 16cd87f6..57bcc915 100644
--- a/src-tauri/src/audio_toolkit/audio/recorder.rs
+++ b/src-tauri/src/audio_toolkit/audio/recorder.rs
@@ -51,12 +51,13 @@ pub enum VadPolicy {
#[derive(Clone)]
struct VadConfig {
detector: Arc<Mutex<Box<dyn vad::VoiceActivityDetector>>>,
+ frame_samples: usize,
offline_hangover_frames: usize,
streaming_hangover_frames: usize,
}
impl VadConfig {
- /// Post-speech hangover tail (in 30 ms frames) for the given policy.
+ /// Post-speech hangover tail (in backend-sized frames) for the given policy.
/// `Disabled` never reaches the detector, so it maps to the offline value.
fn hangover_for(&self, policy: VadPolicy) -> usize {
match policy {
@@ -114,8 +115,11 @@ impl AudioRecorder {
offline_hangover_frames: usize,
streaming_hangover_frames: usize,
) -> Self {
+ let frame_samples = detector.frame_samples();
+ assert!(frame_samples > 0, "VAD frame size must be non-zero");
self.vad = Some(VadConfig {
detector: Arc::new(Mutex::new(detector)),
+ frame_samples,
offline_hangover_frames,
streaming_hangover_frames,
});
@@ -742,10 +746,16 @@ fn run_consumer(
stop_flag: Arc<AtomicBool>,
stream_running_at: Instant,
) {
+ let frame_samples = vad.as_ref().map_or(
+ (constants::WHISPER_SAMPLE_RATE * 30 / 1000) as usize,
+ |config| config.frame_samples,
+ );
+ let frame_duration =
+ Duration::from_secs_f64(frame_samples as f64 / constants::WHISPER_SAMPLE_RATE as f64);
let mut frame_resampler = FrameResampler::new(
in_sample_rate as usize,
constants::WHISPER_SAMPLE_RATE as usize,
- Duration::from_millis(30),
+ frame_duration,
);
let mut processed_samples = Vec::<f32>::new();
@@ -930,7 +940,8 @@ fn run_consumer(
log::debug!(
"VAD at stop: withheld tail {} frames (~{}ms, {} voiced), in_speech={}, onset_counter={}, hangover_counter={}",
report.withheld_frames,
- report.withheld_frames * 30,
+ report.withheld_frames * cfg.frame_samples * 1000
+ / constants::WHISPER_SAMPLE_RATE as usize,
report.withheld_voiced_frames,
report.in_speech,
report.onset_counter,
diff --git a/src-tauri/src/audio_toolkit/bin/cli.rs b/src-tauri/src/audio_toolkit/bin/cli.rs
index ced616ce..0b9b4da4 100644
--- a/src-tauri/src/audio_toolkit/bin/cli.rs
+++ b/src-tauri/src/audio_toolkit/bin/cli.rs
@@ -4,10 +4,10 @@ use std::io::{self, Write};
use handy_app_lib::audio_toolkit::{
audio::{list_input_devices, CpalDeviceInfo},
vad::{
- SmoothedVad, VAD_OFFLINE_HANGOVER_FRAMES, VAD_ONSET_FRAMES, VAD_PREFILL_FRAMES,
- VAD_STREAMING_HANGOVER_FRAMES,
+ frames_for_duration_ms, SmoothedVad, VAD_OFFLINE_HANGOVER_MS, VAD_ONSET_MS,
+ VAD_PREFILL_MS, VAD_STREAMING_HANGOVER_MS,
},
- AudioRecorder, SileroVad, VadPolicy,
+ AudioRecorder, SileroVad, VadPolicy, VoiceActivityDetector,
};
#[derive(Debug, Clone, PartialEq)]
@@ -179,16 +179,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
print_help();
let silero = SileroVad::new("./resources/models/silero_vad_v4.onnx", 0.5)?;
+ let frame_samples = silero.frame_samples();
+ let offline_hangover_frames = frames_for_duration_ms(VAD_OFFLINE_HANGOVER_MS, frame_samples);
let smoothed_vad = SmoothedVad::new(
Box::new(silero),
- VAD_PREFILL_FRAMES,
- VAD_OFFLINE_HANGOVER_FRAMES,
- VAD_ONSET_FRAMES,
+ frames_for_duration_ms(VAD_PREFILL_MS, frame_samples),
+ offline_hangover_frames,
+ frames_for_duration_ms(VAD_ONSET_MS, frame_samples),
);
let recorder = AudioRecorder::new()?.with_vad(
Box::new(smoothed_vad),
- VAD_OFFLINE_HANGOVER_FRAMES,
- VAD_STREAMING_HANGOVER_FRAMES,
+ offline_hangover_frames,
+ frames_for_duration_ms(VAD_STREAMING_HANGOVER_MS, frame_samples),
);
let mut state = RecorderState::new(recorder);
diff --git a/src-tauri/src/audio_toolkit/mod.rs b/src-tauri/src/audio_toolkit/mod.rs
index f7f453c6..60e0c9ed 100644
--- a/src-tauri/src/audio_toolkit/mod.rs
+++ b/src-tauri/src/audio_toolkit/mod.rs
@@ -14,4 +14,4 @@ pub use text::{
apply_custom_words, normalize_transcription_output, remove_filler_words, OutputLanguageEvidence,
};
pub use utils::get_cpal_host;
-pub use vad::{SileroVad, VoiceActivityDetector};
+pub use vad::{EarshotVad, SileroVad, VoiceActivityDetector};
diff --git a/src-tauri/src/audio_toolkit/vad/earshot.rs b/src-tauri/src/audio_toolkit/vad/earshot.rs
new file mode 100644
index 00000000..bcffce91
--- /dev/null
+++ b/src-tauri/src/audio_toolkit/vad/earshot.rs
@@ -0,0 +1,116 @@
+use anyhow::Result;
+
+use super::{VadFrame, VoiceActivityDetector};
+
+pub const EARSHOT_FRAME_SAMPLES: usize = 256;
+
+/// Pure-Rust Earshot VAD adapter.
+///
+/// Earshot expects exactly 16 ms of mono 16 kHz audio per prediction. The
+/// recorder uses `frame_samples()` to configure its resampler accordingly.
+pub struct EarshotVad {
+ engine: Box<earshot::Detector>,
+ threshold: f32,
+ clamped_frame: [f32; EARSHOT_FRAME_SAMPLES],
+}
+
+impl EarshotVad {
+ pub fn new(threshold: f32) -> Result<Self> {
+ if !(0.0..=1.0).contains(&threshold) {
+ anyhow::bail!("threshold must be between 0.0 and 1.0");
+ }
+
+ Ok(Self {
+ // Construct directly on the heap: Detector keeps roughly 8 KiB of
+ // model state and scratch buffers.
+ engine: earshot::Detector::default_boxed(),
+ threshold,
+ clamped_frame: [0.0; EARSHOT_FRAME_SAMPLES],
+ })
+ }
+}
+
+impl VoiceActivityDetector for EarshotVad {
+ fn push_frame<'a>(&'a mut self, frame: &'a [f32]) -> Result<VadFrame<'a>> {
+ if frame.len() != EARSHOT_FRAME_SAMPLES {
+ anyhow::bail!(
+ "expected {EARSHOT_FRAME_SAMPLES} samples, got {}",
+ frame.len()
+ );
+ }
+ if frame.iter().any(|sample| !sample.is_finite()) {
+ anyhow::bail!("Earshot VAD input contained a non-finite sample");
+ }
+
+ // cpal produces normalized f32 samples, but resampling a full-scale
+ // signal can ring slightly outside [-1, 1]. Earshot documents that
+ // range as a precondition and asserts it in debug builds, so clamp only
+ // the prediction input while preserving the original audio on output.
+ let score = if frame.iter().all(|sample| (-1.0..=1.0).contains(sample)) {
+ self.engine.predict_f32(frame)
+ } else {
+ for (clamped, sample) in self.clamped_frame.iter_mut().zip(frame) {
+ *clamped = sample.clamp(-1.0, 1.0);
+ }
+ self.engine.predict_f32(&self.clamped_frame)
+ };
+
+ if score >= self.threshold {
+ Ok(VadFrame::Speech(frame))
+ } else {
+ Ok(VadFrame::Noise)
+ }
+ }
+
+ fn frame_samples(&self) -> usize {
+ EARSHOT_FRAME_SAMPLES
+ }
+
+ fn reset(&mut self) {
+ self.engine.reset();
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn rejects_wrong_frame_size() {
+ let mut vad = EarshotVad::new(0.5).unwrap();
+ assert!(vad.push_frame(&[0.0; EARSHOT_FRAME_SAMPLES - 1]).is_err());
+ }
+
+ #[test]
+ fn silence_is_not_voice() {
+ let mut vad = EarshotVad::new(0.5).unwrap();
+ assert!(!vad
+ .push_frame(&[0.0; EARSHOT_FRAME_SAMPLES])
+ .unwrap()
+ .is_speech());
+ }
+
+ #[test]
+ fn validates_threshold() {
+ assert!(EarshotVad::new(-0.1).is_err());
+ assert!(EarshotVad::new(1.1).is_err());
+ }
+
+ #[test]
+ fn clamps_resampler_overshoot_without_changing_output() {
+ let mut vad = EarshotVad::new(0.0).unwrap();
+ let frame = [1.01; EARSHOT_FRAME_SAMPLES];
+ match vad.push_frame(&frame).unwrap() {
+ VadFrame::Speech(output) => assert_eq!(output, frame),
+ VadFrame::Noise => panic!("zero threshold should retain the frame"),
+ }
+ }
+
+ #[test]
+ fn rejects_non_finite_audio() {
+ let mut vad = EarshotVad::new(0.5).unwrap();
+ let mut frame = [0.0; EARSHOT_FRAME_SAMPLES];
+ frame[0] = f32::NAN;
+ assert!(vad.push_frame(&frame).is_err());
+ }
+}
diff --git a/src-tauri/src/audio_toolkit/vad/mod.rs b/src-tauri/src/audio_toolkit/vad/mod.rs
index 586eb7e7..f1abc698 100644
--- a/src-tauri/src/audio_toolkit/vad/mod.rs
+++ b/src-tauri/src/audio_toolkit/vad/mod.rs
@@ -1,9 +1,20 @@
use anyhow::Result;
-pub const VAD_PREFILL_FRAMES: usize = 15;
-pub const VAD_OFFLINE_HANGOVER_FRAMES: usize = 15;
-pub const VAD_STREAMING_HANGOVER_FRAMES: usize = 55;
-pub const VAD_ONSET_FRAMES: usize = 2;
+use crate::audio_toolkit::constants;
+
+pub const VAD_PREFILL_MS: u64 = 450;
+pub const VAD_OFFLINE_HANGOVER_MS: u64 = 450;
+pub const VAD_STREAMING_HANGOVER_MS: u64 = 1650;
+pub const VAD_ONSET_MS: u64 = 60;
+
+/// Convert a VAD timing duration to whole detector frames, rounding up so an
+/// alternate backend never shortens Handy's onset, pre-roll, or hangover tail.
+pub const fn frames_for_duration_ms(duration_ms: u64, frame_samples: usize) -> usize {
+ assert!(frame_samples > 0, "VAD frame size must be non-zero");
+ let numerator = duration_ms * constants::WHISPER_SAMPLE_RATE as u64;
+ let denominator = frame_samples as u64 * 1000;
+ numerator.div_ceil(denominator) as usize
+}
pub enum VadFrame<'a> {
/// Speech – may aggregate several frames (prefill + current + hangover)
@@ -20,14 +31,17 @@ impl<'a> VadFrame<'a> {
}
pub trait VoiceActivityDetector: Send + Sync {
- /// Primary streaming API: feed one 30-ms frame, get keep/drop decision.
+ /// Primary streaming API: feed one backend-sized frame, get a keep/drop decision.
fn push_frame<'a>(&'a mut self, frame: &'a [f32]) -> Result<VadFrame<'a>>;
+ /// Required number of mono 16 kHz samples per prediction.
+ fn frame_samples(&self) -> usize;
+
fn is_voice(&mut self, frame: &[f32]) -> Result<bool> {
Ok(self.push_frame(frame)?.is_speech())
}
- /// Set the post-speech hangover tail (in 30 ms frames) applied to
+ /// Set the post-speech hangover tail (in backend-sized frames) applied to
/// subsequent frames. Detectors without a smoothing tail can ignore this.
fn set_hangover_frames(&mut self, _frames: usize) {}
@@ -57,8 +71,31 @@ pub struct VadTailReport {
pub hangover_counter: usize,
}
+mod earshot;
mod silero;
mod smoothed;
+pub use earshot::EarshotVad;
pub use silero::SileroVad;
pub use smoothed::SmoothedVad;
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn duration_profiles_preserve_silero_timings() {
+ assert_eq!(frames_for_duration_ms(VAD_PREFILL_MS, 480), 15);
+ assert_eq!(frames_for_duration_ms(VAD_OFFLINE_HANGOVER_MS, 480), 15);
+ assert_eq!(frames_for_duration_ms(VAD_STREAMING_HANGOVER_MS, 480), 55);
+ assert_eq!(frames_for_duration_ms(VAD_ONSET_MS, 480), 2);
+ }
+
+ #[test]
+ fn duration_profiles_round_up_for_earshot_frames() {
+ assert_eq!(frames_for_duration_ms(VAD_PREFILL_MS, 256), 29);
+ assert_eq!(frames_for_duration_ms(VAD_OFFLINE_HANGOVER_MS, 256), 29);
+ assert_eq!(frames_for_duration_ms(VAD_STREAMING_HANGOVER_MS, 256), 104);
+ assert_eq!(frames_for_duration_ms(VAD_ONSET_MS, 256), 4);
+ }
+}
diff --git a/src-tauri/src/audio_toolkit/vad/silero.rs b/src-tauri/src/audio_toolkit/vad/silero.rs
index b301e833..4fc64eae 100644
--- a/src-tauri/src/audio_toolkit/vad/silero.rs
+++ b/src-tauri/src/audio_toolkit/vad/silero.rs
@@ -50,6 +50,10 @@ impl VoiceActivityDetector for SileroVad {
}
}
+ fn frame_samples(&self) -> usize {
+ SILERO_FRAME_SAMPLES
+ }
+
fn reset(&mut self) {
// Clear the Silero LSTM hidden/cell state so a new session doesn't
// inherit recurrent context from the previous recording.
diff --git a/src-tauri/src/audio_toolkit/vad/smoothed.rs b/src-tauri/src/audio_toolkit/vad/smoothed.rs
index 218cd615..1ac51cb5 100644
--- a/src-tauri/src/audio_toolkit/vad/smoothed.rs
+++ b/src-tauri/src/audio_toolkit/vad/smoothed.rs
@@ -119,6 +119,10 @@ impl VoiceActivityDetector for SmoothedVad {
}
}
+ fn frame_samples(&self) -> usize {
+ self.inner_vad.frame_samples()
+ }
+
fn set_hangover_frames(&mut self, frames: usize) {
self.hangover_frames = frames;
}
@@ -184,6 +188,10 @@ mod tests {
Ok(VadFrame::Noise)
}
}
+
+ fn frame_samples(&self) -> usize {
+ 4
+ }
}
fn frame(value: f32) -> Vec<f32> {
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index ec93568a..98df83e1 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -659,6 +659,7 @@ pub fn run(cli_args: CliArgs) {
shortcut::change_append_trailing_space_setting,
shortcut::change_lazy_stream_close_setting,
shortcut::change_vad_enabled_setting,
+ shortcut::change_vad_backend_setting,
shortcut::change_filler_word_removal_enabled_setting,
shortcut::change_app_language_setting,
shortcut::change_update_checks_setting,
diff --git a/src-tauri/src/managers/audio.rs b/src-tauri/src/managers/audio.rs
index ee964f2f..1dadda34 100644
--- a/src-tauri/src/managers/audio.rs
+++ b/src-tauri/src/managers/audio.rs
@@ -1,24 +1,24 @@
use crate::audio_toolkit::{
list_input_devices,
vad::{
- SmoothedVad, VAD_OFFLINE_HANGOVER_FRAMES, VAD_ONSET_FRAMES, VAD_PREFILL_FRAMES,
- VAD_STREAMING_HANGOVER_FRAMES,
+ frames_for_duration_ms, EarshotVad, SmoothedVad, VAD_OFFLINE_HANGOVER_MS, VAD_ONSET_MS,
+ VAD_PREFILL_MS, VAD_STREAMING_HANGOVER_MS,
},
- AudioRecorder, SileroVad, VadPolicy,
+ AudioRecorder, SileroVad, VadPolicy, VoiceActivityDetector,
};
use crate::helpers::clamshell;
use crate::managers::transcription::StreamRouter;
-use crate::settings::{get_settings, write_settings, AppSettings};
+use crate::settings::{get_settings, write_settings, AppSettings, VadBackend};
use crate::utils;
use log::{debug, error, info, trace, warn};
-use std::path::Path;
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use std::sync::{mpsc, Arc, Mutex};
use std::time::{Duration, Instant};
use tauri::{Emitter, Manager};
const STREAM_IDLE_TIMEOUT: Duration = Duration::from_secs(30);
-const VAD_THRESHOLD: f32 = 0.3;
+const SILERO_VAD_THRESHOLD: f32 = 0.3;
+const EARSHOT_VAD_THRESHOLD: f32 = 0.5;
fn set_mute(mute: bool) {
// Expected behavior:
@@ -278,21 +278,50 @@ struct MicrophoneResolution {
/* ──────────────────────────────────────────────────────────────── */
fn create_audio_recorder(
- vad_path: &Path,
+ backend: VadBackend,
app_handle: &tauri::AppHandle,
selected_channel: Option<u16>,
stream_router: Arc<StreamRouter>,
) -> Result<AudioRecorder, anyhow::Error> {
- // A single Silero engine covers both the offline and streaming policies (never
- // active at once within a recording), so the recorder reconfigures its
- // hangover tail per session rather than keeping two ONNX sessions resident.
- let silero = SileroVad::new(vad_path, VAD_THRESHOLD)
- .map_err(|e| anyhow::anyhow!("Failed to create SileroVad: {}", e))?;
+ let detector: Box<dyn VoiceActivityDetector> = match backend {
+ VadBackend::Silero => {
+ let vad_path = app_handle
+ .path()
+ .resolve(
+ "resources/models/silero_vad_v4.onnx",
+ tauri::path::BaseDirectory::Resource,
+ )
+ .map_err(|e| anyhow::anyhow!("Failed to resolve VAD path: {e}"))?;
+ Box::new(
+ SileroVad::new(vad_path, SILERO_VAD_THRESHOLD)
+ .map_err(|e| anyhow::anyhow!("Failed to create SileroVad: {e}"))?,
+ )
+ }
+ VadBackend::Earshot => Box::new(
+ EarshotVad::new(EARSHOT_VAD_THRESHOLD)
+ .map_err(|e| anyhow::anyhow!("Failed to create EarshotVad: {e}"))?,
+ ),
+ };
+
+ // Earshot uses 16 ms frames while Silero uses 30 ms. Convert the existing
+ // time-based capture profile to each detector's frame size so selecting a
+ // backend does not shorten pre-roll, onset, or post-speech audio.
+ let frame_samples = detector.frame_samples();
+ let prefill_frames = frames_for_duration_ms(VAD_PREFILL_MS, frame_samples);
+ let offline_hangover_frames = frames_for_duration_ms(VAD_OFFLINE_HANGOVER_MS, frame_samples);
+ let streaming_hangover_frames =
+ frames_for_duration_ms(VAD_STREAMING_HANGOVER_MS, frame_samples);
+ let onset_frames = frames_for_duration_ms(VAD_ONSET_MS, frame_samples);
let smoothed_vad = SmoothedVad::new(
- Box::new(silero),
- VAD_PREFILL_FRAMES,
- VAD_OFFLINE_HANGOVER_FRAMES,
- VAD_ONSET_FRAMES,
+ detector,
+ prefill_frames,
+ offline_hangover_frames,
+ onset_frames,
+ );
+
+ info!(
+ "Initialized {:?} VAD backend ({} samples/frame)",
+ backend, frame_samples
);
// Recorder with VAD, a spectrum-level callback that forwards level updates to
@@ -302,8 +331,8 @@ fn create_audio_recorder(
.map_err(|e| anyhow::anyhow!("Failed to create AudioRecorder: {}", e))?
.with_vad(
Box::new(smoothed_vad),
- VAD_OFFLINE_HANGOVER_FRAMES,
- VAD_STREAMING_HANGOVER_FRAMES,
+ offline_hangover_frames,
+ streaming_hangover_frames,
)
.with_selected_channel(selected_channel)
.with_level_callback({
@@ -594,17 +623,9 @@ impl AudioRecordingManager {
pub fn preload_vad(&self) -> Result<(), anyhow::Error> {
let mut recorder_opt = self.recorder.lock().unwrap();
if recorder_opt.is_none() {
- let vad_path = self
- .app_handle
- .path()
- .resolve(
- "resources/models/silero_vad_v4.onnx",
- tauri::path::BaseDirectory::Resource,
- )
- .map_err(|e| anyhow::anyhow!("Failed to resolve VAD path: {}", e))?;
let settings = get_settings(&self.app_handle);
*recorder_opt = Some(create_audio_recorder(
- &vad_path,
+ settings.vad_backend,
&self.app_handle,
settings.selected_channel,
Arc::clone(&self.stream_router),
@@ -840,6 +861,60 @@ impl AudioRecordingManager {
}
}
+ /// Replace the VAD implementation while idle. If the microphone stream is
+ /// currently warm (always-on or lazy-close mode), reopen it with the new
+ /// detector before reporting success. A failed reopen restores the previous
+ /// recorder so the persisted setting can remain unchanged.
+ pub fn update_vad_backend(&self, backend: VadBackend) -> Result<(), anyhow::Error> {
+ let state = self.state.lock().unwrap();
+ if !matches!(*state, RecordingState::Idle) {
+ return Err(anyhow::anyhow!(
+ "Cannot change the VAD backend while recording"
+ ));
+ }
+
+ let settings = get_settings(&self.app_handle);
+ let replacement = create_audio_recorder(
+ backend,
+ &self.app_handle,
+ settings.selected_channel,
+ Arc::clone(&self.stream_router),
+ )?;
+ let was_open = *self.is_open.lock().unwrap();
+
+ // Invalidate any delayed close before swapping the recorder it targets.
+ self.close_generation.fetch_add(1, Ordering::SeqCst);
+ if was_open {
+ self.stop_microphone_stream();
+ }
+
+ let previous_recorder = self.recorder.lock().unwrap().replace(replacement);
+ if was_open {
+ if let Err(change_error) = self.start_microphone_stream() {
+ // Ensure a partially opened replacement cannot retain capture
+ // resources before restoring the known-good detector.
+ if let Some(recorder) = self.recorder.lock().unwrap().as_mut() {
+ let _ = recorder.close();
+ }
+ *self.recorder.lock().unwrap() = previous_recorder;
+
+ if let Err(rollback_error) = self.start_microphone_stream() {
+ error!(
+ "Failed to restore microphone stream after VAD backend change failed: {rollback_error}"
+ );
+ }
+ return Err(anyhow::anyhow!(
+ "Failed to reopen microphone with {:?} VAD: {change_error}",
+ backend
+ ));
+ }
+ }
+
+ info!("VAD backend changed to {:?}", backend);
+ drop(state);
+ Ok(())
+ }
+
pub fn update_selected_device(&self) -> Result<(), anyhow::Error> {
// Device settings changed; re-enumerate the device and restart capture.
self.invalidate_device_cache();
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index 68081bda..76d5127f 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -301,6 +301,14 @@ pub enum OrtAcceleratorSetting {
Rocm,
}
+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Type, Default)]
+#[serde(rename_all = "snake_case")]
+pub enum VadBackend {
+ #[default]
+ Silero,
+ Earshot,
+}
+
#[derive(Clone, Serialize, Deserialize, Type)]
#[serde(transparent)]
pub(crate) struct SecretMap(HashMap<String, String>);
@@ -476,6 +484,9 @@ pub struct AppSettings {
pub extra_recording_buffer_ms: u64,
#[serde(default = "default_vad_enabled")]
pub vad_enabled: bool,
+ /// Experimental detector implementation. Silero remains the stable default.
+ #[serde(default)]
+ pub vad_backend: VadBackend,
/// Which recording overlay to show: None / Minimal / Live. Streaming mode is
/// not gated on this — that follows model capability. Migrated from the old
/// `overlay_position` (position `none` → style `None`).
@@ -934,6 +945,7 @@ pub fn get_default_settings() -> AppSettings {
transcribe_gpu_device: default_transcribe_gpu_device(),
extra_recording_buffer_ms: 0,
vad_enabled: default_vad_enabled(),
+ vad_backend: VadBackend::default(),
overlay_style: default_overlay_style(),
}
}
@@ -1307,6 +1319,7 @@ mod tests {
assert_eq!(settings.log_level, LogLevel::Debug);
assert_eq!(settings.sound_theme, SoundTheme::Pop);
assert!(settings.filler_word_removal_enabled);
+ assert_eq!(settings.vad_backend, VadBackend::Silero);
// The 0.1 integer device index is cleared once for transcribe.cpp 0.2.
// Without an exact device, the retired generic GPU choice becomes Auto.
diff --git a/src-tauri/src/shortcut/mod.rs b/src-tauri/src/shortcut/mod.rs
index 1a1e76aa..6594c27c 100644
--- a/src-tauri/src/shortcut/mod.rs
+++ b/src-tauri/src/shortcut/mod.rs
@@ -23,7 +23,7 @@ use crate::settings::APPLE_INTELLIGENCE_DEFAULT_MODEL_ID;
use crate::settings::{
self, get_settings, AutoSubmitKey, ClipboardHandling, KeyboardImplementation, LLMPrompt,
OverlayPosition, OverlayStyle, PasteMethod, ShortcutBinding, SoundTheme, Theme, TypingTool,
- APPLE_INTELLIGENCE_PROVIDER_ID,
+ VadBackend, APPLE_INTELLIGENCE_PROVIDER_ID,
};
use crate::tray;
@@ -1267,6 +1267,31 @@ pub fn change_vad_enabled_setting(app: AppHandle, enabled: bool) -> Result<(), S
Ok(())
}
+#[tauri::command]
+#[specta::specta]
+pub async fn change_vad_backend_setting(app: AppHandle, backend: VadBackend) -> Result<(), String> {
+ if settings::get_settings(&app).vad_backend == backend {
+ return Ok(());
+ }
+
+ // Construct/swap the detector and, when necessary, reopen cpal away from
+ // the webview thread. Persist only after the runtime change succeeds so a
+ // rejected in-progress switch or failed microphone reopen rolls back cleanly.
+ let manager = app
+ .state::<std::sync::Arc<crate::managers::audio::AudioRecordingManager>>()
+ .inner()
+ .clone();
+ tokio::task::spawn_blocking(move || manager.update_vad_backend(backend))
+ .await
+ .map_err(|e| format!("audio task join failed: {e}"))?
+ .map_err(|e| format!("Failed to update VAD backend: {e}"))?;
+
+ let mut current_settings = settings::get_settings(&app);
+ current_settings.vad_backend = backend;
+ settings::write_settings(&app, current_settings);
+ Ok(())
+}
+
#[tauri::command]
#[specta::specta]
pub fn change_filler_word_removal_enabled_setting(
diff --git a/src/bindings.ts b/src/bindings.ts
index 53458b0b..7710120a 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -359,6 +359,14 @@ async changeVadEnabledSetting(enabled: boolean) : Promise<Result<null, string>>
else return { status: "error", error: e as any };
}
},
+async changeVadBackendSetting(backend: VadBackend) : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("change_vad_backend_setting", { backend }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async changeFillerWordRemovalEnabledSetting(enabled: boolean) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("change_filler_word_removal_enabled_setting", { enabled }) };
@@ -966,6 +974,10 @@ reliable_paste?: boolean; typing_tool?: TypingTool; external_script_path?: strin
* never from the process-local device registry index.
*/
transcribe_gpu_device?: string | null; extra_recording_buffer_ms?: number; vad_enabled?: boolean;
+/**
+ * Experimental detector implementation. Silero remains the stable default.
+ */
+vad_backend?: VadBackend;
/**
* Which recording overlay to show: None / Minimal / Live. Streaming mode is
* not gated on this — that follows model capability. Migrated from the old
@@ -1119,6 +1131,7 @@ export type StreamWorkKind = "transcribing" | "polishing"
export type Theme = "system" | "light" | "dark"
export type TranscribeAcceleratorSetting = "auto" | "cpu" | "gpu"
export type TypingTool = "auto" | "wtype" | "kwtype" | "dotool" | "ydotool" | "xdotool"
+export type VadBackend = "silero" | "earshot"
export type WindowsMicrophonePermissionStatus = { supported: boolean; overall_access: PermissionAccess; device_access: PermissionAccess; app_access: PermissionAccess; desktop_app_access: PermissionAccess }
/** tauri-specta globals **/
diff --git a/src/components/settings/VadBackendSelector.tsx b/src/components/settings/VadBackendSelector.tsx
new file mode 100644
index 00000000..239174b6
--- /dev/null
+++ b/src/components/settings/VadBackendSelector.tsx
@@ -0,0 +1,51 @@
+import React, { useMemo } from "react";
+import { useTranslation } from "react-i18next";
+import type { VadBackend } from "@/bindings";
+import { useSettings } from "@/hooks/useSettings";
+import { Dropdown, type DropdownOption } from "@/components/ui/Dropdown";
+import { SettingContainer } from "@/components/ui/SettingContainer";
+
+interface VadBackendSelectorProps {
+ descriptionMode?: "tooltip" | "inline";
+ grouped?: boolean;
+}
+
+export const VadBackendSelector: React.FC<VadBackendSelectorProps> = ({
+ descriptionMode = "tooltip",
+ grouped = false,
+}) => {
+ const { t } = useTranslation();
+ const { getSetting, updateSetting, isUpdating } = useSettings();
+ const selectedBackend = getSetting("vad_backend") ?? "silero";
+
+ const options = useMemo<DropdownOption[]>(
+ () => [
+ {
+ value: "silero",
+ label: t("settings.advanced.vadBackend.options.silero"),
+ },
+ {
+ value: "earshot",
+ label: t("settings.advanced.vadBackend.options.earshot"),
+ },
+ ],
+ [t],
+ );
+
+ return (
+ <SettingContainer
+ title={t("settings.advanced.vadBackend.title")}
+ description={t("settings.advanced.vadBackend.description")}
+ descriptionMode={descriptionMode}
+ grouped={grouped}
+ layout="horizontal"
+ >
+ <Dropdown
+ options={options}
+ selectedValue={selectedBackend}
+ onSelect={(value) => updateSetting("vad_backend", value as VadBackend)}
+ disabled={isUpdating("vad_backend")}
+ />
+ </SettingContainer>
+ );
+};
diff --git a/src/components/settings/advanced/AdvancedSettings.tsx b/src/components/settings/advanced/AdvancedSettings.tsx
index f8749708..b9397d2c 100644
--- a/src/components/settings/advanced/AdvancedSettings.tsx
+++ b/src/components/settings/advanced/AdvancedSettings.tsx
@@ -22,6 +22,7 @@ import { VoiceActivityDetection } from "../VoiceActivityDetection";
import { AccelerationSelector } from "../AccelerationSelector";
import { LazyStreamClose } from "../LazyStreamClose";
import { FillerWordRemoval } from "../FillerWordRemoval";
+import { VadBackendSelector } from "../VadBackendSelector";
export const AdvancedSettings: React.FC = () => {
const { t } = useTranslation();
@@ -70,6 +71,7 @@ export const AdvancedSettings: React.FC = () => {
/>
<AccelerationSelector descriptionMode="tooltip" grouped={true} />
<LazyStreamClose descriptionMode="tooltip" grouped={true} />
+ <VadBackendSelector descriptionMode="tooltip" grouped={true} />
</SettingsGroup>
)}
</div>
diff --git a/src/i18n/locales/ar/translation.json b/src/i18n/locales/ar/translation.json
index 283c5747..6fdd2160 100644
--- a/src/i18n/locales/ar/translation.json
+++ b/src/i18n/locales/ar/translation.json
@@ -354,6 +354,14 @@
"title": "كشف النشاط الصوتي",
"description": "تصفية الصمت من التسجيلات. النماذج التي تدعم البث تستخدم فترة VAD أطول؛ وتعطيل VAD يسجّل الصوت الخام."
},
+ "vadBackend": {
+ "title": "محرك كشف النشاط الصوتي",
+ "description": "اختر الكاشف المستخدم لتصفية الصمت. Earshot تجريبي؛ ارجع إلى Silero إذا تم اقتطاع الكلام أو الاحتفاظ بالضوضاء.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "إزالة كلمات الحشو",
"description": "يزيل كلمات التردد الشائعة من النصوص. عطّل هذا الخيار للاحتفاظ بها."
diff --git a/src/i18n/locales/bg/translation.json b/src/i18n/locales/bg/translation.json
index f0bb022a..50132e96 100644
--- a/src/i18n/locales/bg/translation.json
+++ b/src/i18n/locales/bg/translation.json
@@ -377,6 +377,14 @@
"title": "Откриване на гласова активност",
"description": "Филтрира тишината от записите. Моделите с поддръжка на стрийминг използват по-дълга опашка на VAD; изключването на VAD записва необработен звук."
},
+ "vadBackend": {
+ "title": "Бекенд за откриване на глас",
+ "description": "Изберете детектора, използван за филтриране на тишината. Earshot е експериментален; върнете се към Silero, ако речта се отрязва или шумът се запазва.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Премахване на думи паразити",
"description": "Премахва често срещаните думи за колебание от транскрипциите. Изключете, за да ги запазите."
diff --git a/src/i18n/locales/cs/translation.json b/src/i18n/locales/cs/translation.json
index 1331583d..866c35d9 100644
--- a/src/i18n/locales/cs/translation.json
+++ b/src/i18n/locales/cs/translation.json
@@ -377,6 +377,14 @@
"title": "Detekce hlasové aktivity",
"description": "Odfiltruje ticho z nahrávek. Modely podporující streaming používají delší doběh VAD; vypnutí VAD nahrává surový zvuk."
},
+ "vadBackend": {
+ "title": "Backend detekce hlasu",
+ "description": "Vyberte detektor používaný k filtrování ticha. Earshot je experimentální; pokud je řeč ořezávána nebo zůstává šum, přepněte zpět na Silero.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Odstranit výplňová slova",
"description": "Odstraňuje běžná slova vyjadřující váhání z přepisů. Vypnutím je zachováte."
diff --git a/src/i18n/locales/da/translation.json b/src/i18n/locales/da/translation.json
index 0b7dd30f..14eaf654 100644
--- a/src/i18n/locales/da/translation.json
+++ b/src/i18n/locales/da/translation.json
@@ -377,6 +377,14 @@
"title": "Stemmeaktivitetsdetektion",
"description": "Filtrer stilhed fra optagelser. Streaming-modeller bruger en længere VAD-hale; deaktivering af VAD optager rå lyd."
},
+ "vadBackend": {
+ "title": "Stemmedetektions-backend",
+ "description": "Vælg den detektor, der bruges til at filtrere stilhed. Earshot er eksperimentel; skift tilbage til Silero, hvis tale klippes eller støj bevares.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Fjern fyldord",
"description": "Fjerner almindelige tøveord fra transskriptioner. Slå fra for at beholde dem."
diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json
index 8041fab8..fc920d95 100644
--- a/src/i18n/locales/de/translation.json
+++ b/src/i18n/locales/de/translation.json
@@ -377,6 +377,14 @@
"title": "Sprachaktivitätserkennung (VAD)",
"description": "Filtert Stille aus Aufnahmen. Streamingfähige Modelle verwenden ein längeres VAD-Ende; das Deaktivieren von VAD nimmt Rohaudio auf."
},
+ "vadBackend": {
+ "title": "VAD-Backend",
+ "description": "Wählt den Detektor zum Herausfiltern von Stille. Earshot ist experimentell; wechseln Sie zurück zu Silero, wenn Sprache abgeschnitten oder Rauschen beibehalten wird.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Füllwörter entfernen",
"description": "Entfernt häufige Verzögerungslaute aus Transkriptionen. Deaktivieren Sie diese Option, um sie beizubehalten."
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index 2bedc69e..27121cbc 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -377,6 +377,14 @@
"title": "Voice Activity Detection",
"description": "Filter silence from recordings. Streaming-capable models use a longer VAD tail; disabling VAD records raw audio."
},
+ "vadBackend": {
+ "title": "Voice Activity Backend",
+ "description": "Choose the detector used to filter silence. Earshot is experimental; switch back to Silero if speech is clipped or noise is retained.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Remove Filler Words",
"description": "Removes common hesitation words from transcriptions. Turn off to keep them."
diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json
index abb7ac32..db106c82 100644
--- a/src/i18n/locales/es/translation.json
+++ b/src/i18n/locales/es/translation.json
@@ -377,6 +377,14 @@
"title": "Detección de actividad de voz",
"description": "Filtra el silencio de las grabaciones. Los modelos compatibles con streaming usan una cola de VAD más larga; desactivar el VAD graba audio sin procesar."
},
+ "vadBackend": {
+ "title": "Backend de detección de voz",
+ "description": "Elige el detector usado para filtrar el silencio. Earshot es experimental; vuelve a Silero si la voz se recorta o se conserva el ruido.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Eliminar muletillas",
"description": "Elimina las muletillas más comunes de las transcripciones. Desactívalo para conservarlas."
diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json
index e4865688..a268f1be 100644
--- a/src/i18n/locales/fr/translation.json
+++ b/src/i18n/locales/fr/translation.json
@@ -377,6 +377,14 @@
"title": "Détection d'activité vocale (VAD)",
"description": "Filtre le silence des enregistrements. Les modèles compatibles avec le streaming utilisent une marge de détection VAD plus longue ; désactiver le VAD enregistre l'audio brut."
},
+ "vadBackend": {
+ "title": "Backend de détection vocale",
+ "description": "Choisissez le détecteur utilisé pour filtrer le silence. Earshot est expérimental ; revenez à Silero si la parole est coupée ou si le bruit est conservé.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Supprimer les mots de remplissage",
"description": "Supprime les hésitations courantes des transcriptions. Désactivez cette option pour les conserver."
diff --git a/src/i18n/locales/he/translation.json b/src/i18n/locales/he/translation.json
index 009288cc..4addf774 100644
--- a/src/i18n/locales/he/translation.json
+++ b/src/i18n/locales/he/translation.json
@@ -377,6 +377,14 @@
"title": "זיהוי פעילות קולית",
"description": "סינון שקט מההקלטות. מודלים התומכים בסטרימינג משתמשים בזנב VAD ארוך יותר; ביטול VAD מקליט אודיו גולמי."
},
+ "vadBackend": {
+ "title": "מנוע זיהוי פעילות קולית",
+ "description": "בחרו את הגלאי המשמש לסינון שקט. Earshot ניסיוני; חזרו ל-Silero אם הדיבור נחתך או שרעש נשמר.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "הסרת מילות מילוי",
"description": "מסיר מילות היסוס נפוצות מתמלולים. השבת כדי להשאיר אותן."
diff --git a/src/i18n/locales/hi/translation.json b/src/i18n/locales/hi/translation.json
index 396c8015..729e8ee7 100644
--- a/src/i18n/locales/hi/translation.json
+++ b/src/i18n/locales/hi/translation.json
@@ -377,6 +377,14 @@
"title": "वॉइस एक्टिविटी डिटेक्शन",
"description": "रिकॉर्डिंग से बिना आवाज़ वाले हिस्से हटाएं. स्ट्रीमिंग वाले मॉडल लंबी VAD टेल इस्तेमाल करते हैं; VAD बंद करने पर कच्चा ऑडियो रिकॉर्ड होता है."
},
+ "vadBackend": {
+ "title": "वॉइस एक्टिविटी बैकएंड",
+ "description": "मौन को फ़िल्टर करने के लिए उपयोग किया जाने वाला डिटेक्टर चुनें। Earshot प्रायोगिक है; यदि बोली कट रही हो या शोर बना रहे तो Silero पर वापस जाएँ।",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "फिलर शब्द हटाएं",
"description": "ट्रांसक्रिप्शन से आम हिचकिचाहट वाले शब्द हटाता है। उन्हें बनाए रखने के लिए इसे बंद करें।"
diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json
index 7c9fdf0e..d76e3737 100644
--- a/src/i18n/locales/it/translation.json
+++ b/src/i18n/locales/it/translation.json
@@ -377,6 +377,14 @@
"title": "Rilevamento dell'attività vocale",
"description": "Filtra il silenzio dalle registrazioni. I modelli che supportano lo streaming utilizzano una coda VAD più lunga; disabilitando la VAD si registra l'audio grezzo."
},
+ "vadBackend": {
+ "title": "Backend di rilevamento vocale",
+ "description": "Scegli il rilevatore usato per filtrare il silenzio. Earshot è sperimentale; torna a Silero se il parlato viene tagliato o il rumore viene mantenuto.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Rimuovi le parole riempitive",
"description": "Rimuove le parole di esitazione più comuni dalle trascrizioni. Disattiva per mantenerle."
diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json
index 4e47da3e..e074d9b3 100644
--- a/src/i18n/locales/ja/translation.json
+++ b/src/i18n/locales/ja/translation.json
@@ -377,6 +377,14 @@
"title": "音声区間検出 (VAD)",
"description": "録音から無音部分を除去します。ストリーミング対応モデルはより長い音声検出区間を使用します。VAD を無効にすると音声をそのまま録音します。"
},
+ "vadBackend": {
+ "title": "音声区間検出バックエンド",
+ "description": "無音のフィルタリングに使用する検出器を選択します。Earshot は実験的機能です。音声が途切れたりノイズが残る場合は Silero に戻してください。",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "フィラー語を削除",
"description": "文字起こしから一般的なフィラー語を削除します。残すにはオフにしてください。"
diff --git a/src/i18n/locales/ko/translation.json b/src/i18n/locales/ko/translation.json
index d67ccab1..25857ac9 100644
--- a/src/i18n/locales/ko/translation.json
+++ b/src/i18n/locales/ko/translation.json
@@ -377,6 +377,14 @@
"title": "음성 활동 감지",
"description": "녹음에서 무음 구간을 걸러냅니다. 스트리밍 지원 모델은 더 긴 VAD 테일을 사용하며, VAD를 끄면 원본 오디오가 그대로 녹음됩니다."
},
+ "vadBackend": {
+ "title": "음성 활동 감지 백엔드",
+ "description": "무음을 필터링하는 데 사용할 감지기를 선택합니다. Earshot은 실험적 기능입니다. 음성이 잘리거나 소음이 남는 경우 Silero로 되돌리세요.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "군더더기 표현 제거",
"description": "전사에서 흔한 머뭇거림 표현을 제거합니다. 그대로 두려면 이 옵션을 끄세요."
diff --git a/src/i18n/locales/ne/translation.json b/src/i18n/locales/ne/translation.json
index 76208584..d177eee8 100644
--- a/src/i18n/locales/ne/translation.json
+++ b/src/i18n/locales/ne/translation.json
@@ -377,6 +377,14 @@
"title": "भ्वाइस एक्टिभिटी डिटेक्सन",
"description": "रेकर्डिङबाट मौनता हटाउँछ। स्ट्रिमिङ-सक्षम मोडेलहरूले लामो VAD टेल प्रयोग गर्छन्; VAD अफ गर्दा कच्चा अडियो रेकर्ड हुन्छ।"
},
+ "vadBackend": {
+ "title": "भ्वाइस एक्टिभिटी ब्याकएन्ड",
+ "description": "मौनता फिल्टर गर्न प्रयोग हुने डिटेक्टर छान्नुहोस्। Earshot प्रयोगात्मक हो; बोली काटिएमा वा आवाज रहिरहेमा Silero मा फर्कनुहोस्।",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "फिलर शब्दहरू हटाउनुहोस्",
"description": "ट्रान्सक्रिप्सनबाट सामान्य हिचकिचाहटका शब्दहरू हटाउँछ। तिनलाई राख्न यो विकल्प बन्द गर्नुहोस्।"
diff --git a/src/i18n/locales/nl/translation.json b/src/i18n/locales/nl/translation.json
index ffe5b66a..b1a5cef3 100644
--- a/src/i18n/locales/nl/translation.json
+++ b/src/i18n/locales/nl/translation.json
@@ -377,6 +377,14 @@
"title": "Spraakactiviteitsdetectie (VAD)",
"description": "Filter stilte uit opnames. Streaming-modellen gebruiken een langere VAD-uitloop; het uitschakelen van VAD neemt de ruwe audio op."
},
+ "vadBackend": {
+ "title": "VAD-backend",
+ "description": "Kies de detector die stilte filtert. Earshot is experimenteel; schakel terug naar Silero als spraak wordt afgekapt of ruis behouden blijft.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Opvulwoorden verwijderen",
"description": "Verwijdert veelvoorkomende aarzelwoorden uit transcripties. Schakel dit uit om ze te behouden."
diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json
index c7708d69..53fc1dfe 100644
--- a/src/i18n/locales/pl/translation.json
+++ b/src/i18n/locales/pl/translation.json
@@ -377,6 +377,14 @@
"title": "Wykrywanie aktywności głosowej",
"description": "Odfiltrowuje ciszę z nagrań. Modele obsługujące streaming używają dłuższego marginesu VAD; wyłączenie VAD nagrywa surowy dźwięk."
},
+ "vadBackend": {
+ "title": "Backend wykrywania głosu",
+ "description": "Wybierz detektor używany do filtrowania ciszy. Earshot jest eksperymentalny; wróć do Silero, jeśli mowa jest ucinana lub szum jest zachowywany.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Usuń wyrazy wypełniające",
"description": "Usuwa typowe słowa wyrażające wahanie z transkrypcji. Wyłącz, aby je zachować."
diff --git a/src/i18n/locales/pt/translation.json b/src/i18n/locales/pt/translation.json
index ea58c050..94a7a062 100644
--- a/src/i18n/locales/pt/translation.json
+++ b/src/i18n/locales/pt/translation.json
@@ -377,6 +377,14 @@
"title": "Detecção de atividade de voz",
"description": "Filtra o silêncio das gravações. Modelos com suporte a streaming usam uma cauda de VAD mais longa; desativar o VAD grava o áudio bruto."
},
+ "vadBackend": {
+ "title": "Backend de detecção de voz",
+ "description": "Escolha o detector usado para filtrar o silêncio. O Earshot é experimental; volte para o Silero se a fala for cortada ou o ruído for mantido.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Remover palavras de preenchimento",
"description": "Remove hesitações comuns das transcrições. Desative para mantê-las."
diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json
index 7e28d4de..358e8ab5 100644
--- a/src/i18n/locales/ru/translation.json
+++ b/src/i18n/locales/ru/translation.json
@@ -377,6 +377,14 @@
"title": "Определение голосовой активности",
"description": "Отфильтровывает тишину из записей. Модели с поддержкой потоковой обработки используют более длинный «хвост» VAD; отключение VAD записывает необработанный звук."
},
+ "vadBackend": {
+ "title": "Движок определения голоса",
+ "description": "Выберите детектор для фильтрации тишины. Earshot — экспериментальный; вернитесь к Silero, если речь обрезается или шум сохраняется.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Удалять слова-паразиты",
"description": "Удаляет распространённые слова-заминки из расшифровок. Отключите, чтобы сохранить их."
diff --git a/src/i18n/locales/sv/translation.json b/src/i18n/locales/sv/translation.json
index 8287ef28..41ff7d0a 100644
--- a/src/i18n/locales/sv/translation.json
+++ b/src/i18n/locales/sv/translation.json
@@ -377,6 +377,14 @@
"title": "Röstaktivitetsdetektering",
"description": "Filtrerar bort tystnad från inspelningar. Modeller med streamingstöd använder en längre VAD-svans; om VAD inaktiveras spelas rått ljud in."
},
+ "vadBackend": {
+ "title": "Backend för röstdetektering",
+ "description": "Välj detektorn som används för att filtrera bort tystnad. Earshot är experimentell; byt tillbaka till Silero om tal klipps eller brus behålls.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Ta bort utfyllnadsord",
"description": "Tar bort vanliga tvekljud från transkriberingar. Stäng av för att behålla dem."
diff --git a/src/i18n/locales/tr/translation.json b/src/i18n/locales/tr/translation.json
index b31980f0..730922b2 100644
--- a/src/i18n/locales/tr/translation.json
+++ b/src/i18n/locales/tr/translation.json
@@ -377,6 +377,14 @@
"title": "Ses Etkinliği Algılama",
"description": "Kayıtlardaki sessizliği filtreler. Akış destekli modeller daha uzun bir VAD kuyruğu kullanır; VAD devre dışı bırakıldığında ham ses kaydedilir."
},
+ "vadBackend": {
+ "title": "Ses Etkinliği Arka Ucu",
+ "description": "Sessizliği filtrelemek için kullanılan algılayıcıyı seçin. Earshot deneyseldir; konuşma kesiliyorsa veya gürültü korunuyorsa Silero'ya geri dönün.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Dolgu Sözcüklerini Kaldır",
"description": "Transkripsiyonlardaki yaygın duraksama sözcüklerini kaldırır. Bunları korumak için kapatın."
diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json
index 7529d172..7e045897 100644
--- a/src/i18n/locales/uk/translation.json
+++ b/src/i18n/locales/uk/translation.json
@@ -377,6 +377,14 @@
"title": "Виявлення голосової активності",
"description": "Відфільтровує тишу із записів. Моделі з підтримкою потокової обробки використовують довший «хвіст» VAD; вимкнення VAD записує необроблений звук."
},
+ "vadBackend": {
+ "title": "Рушій виявлення голосу",
+ "description": "Виберіть детектор для фільтрації тиші. Earshot — експериментальний; поверніться до Silero, якщо мовлення обрізається або шум зберігається.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Видаляти слова-паразити",
"description": "Видаляє поширені слова-вагання з транскрипцій. Вимкніть, щоб зберегти їх."
diff --git a/src/i18n/locales/vi/translation.json b/src/i18n/locales/vi/translation.json
index 5b2303c7..8affb5ac 100644
--- a/src/i18n/locales/vi/translation.json
+++ b/src/i18n/locales/vi/translation.json
@@ -377,6 +377,14 @@
"title": "Phát hiện hoạt động giọng nói",
"description": "Lọc bỏ khoảng lặng khỏi bản ghi. Các mô hình hỗ trợ truyền trực tiếp dùng đuôi VAD dài hơn; tắt VAD sẽ ghi âm thanh thô."
},
+ "vadBackend": {
+ "title": "Bộ phát hiện giọng nói",
+ "description": "Chọn bộ phát hiện dùng để lọc khoảng lặng. Earshot đang thử nghiệm; hãy chuyển về Silero nếu giọng nói bị cắt hoặc tiếng ồn vẫn còn.",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "Loại bỏ từ đệm",
"description": "Loại bỏ các từ ngập ngừng phổ biến khỏi bản chép lời. Tắt để giữ lại các từ này."
diff --git a/src/i18n/locales/zh-TW/translation.json b/src/i18n/locales/zh-TW/translation.json
index 7d6c24ec..3c9c095d 100644
--- a/src/i18n/locales/zh-TW/translation.json
+++ b/src/i18n/locales/zh-TW/translation.json
@@ -377,6 +377,14 @@
"title": "語音活動偵測",
"description": "過濾錄音中的靜音。支援串流的模型會使用較長的 VAD 尾段;停用 VAD 則會錄製原始音訊"
},
+ "vadBackend": {
+ "title": "語音活動偵測後端",
+ "description": "選擇用於過濾靜音的偵測器。Earshot 為實驗性功能;若語音被截斷或雜訊被保留,請切換回 Silero。",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "移除語助詞",
"description": "從轉錄中移除常見的語助詞。關閉此選項即可保留這些詞。"
diff --git a/src/i18n/locales/zh/translation.json b/src/i18n/locales/zh/translation.json
index 12c578d3..6ad66eff 100644
--- a/src/i18n/locales/zh/translation.json
+++ b/src/i18n/locales/zh/translation.json
@@ -377,6 +377,14 @@
"title": "语音活动检测",
"description": "过滤录音中的静音。支持流式的模型会使用更长的 VAD 尾段;停用 VAD 则会录制原始音频。"
},
+ "vadBackend": {
+ "title": "语音活动检测后端",
+ "description": "选择用于过滤静音的检测器。Earshot 为实验性功能;如果语音被截断或噪音被保留,请切换回 Silero。",
+ "options": {
+ "silero": "Silero",
+ "earshot": "Earshot"
+ }
+ },
"fillerWordRemoval": {
"title": "移除语气词",
"description": "从转录中移除常见的语气词。关闭此选项即可保留这些词。"
diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts
index 2ec9e4df..9e8cb6a8 100644
--- a/src/stores/settingsStore.ts
+++ b/src/stores/settingsStore.ts
@@ -6,8 +6,10 @@ import type {
AudioDevice,
TranscribeAcceleratorSetting,
OrtAcceleratorSetting,
+ VadBackend,
} from "@/bindings";
import { commands } from "@/bindings";
+import { toast } from "sonner";
interface SettingsStore {
settings: Settings | null;
@@ -162,6 +164,15 @@ const settingUpdaters: {
commands.changeLazyStreamCloseSetting(value as boolean),
overlay_style: (value) => commands.changeOverlayStyleSetting(value as string),
vad_enabled: (value) => commands.changeVadEnabledSetting(value as boolean),
+ vad_backend: async (value) => {
+ const result = await commands.changeVadBackendSetting(value as VadBackend);
+ if (result.status === "error") {
+ // Rejected switches (e.g. mid-recording) roll the dropdown back via the
+ // throw below; the toast tells the user why.
+ toast.error(result.error);
+ throw new Error(result.error);
+ }
+ },
filler_word_removal_enabled: (value) =>
commands.changeFillerWordRemovalEnabledSetting(value as boolean),
show_tray_icon: (value) =>