Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

chore: disable silero on windows

Louis Beaumont1d87fe95d5f2
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 44a8d6f47..9e331ba21 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.2.31"
+version = "0.2.32"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-audio/Cargo.toml b/screenpipe-audio/Cargo.toml
index 242e69000..cba5e4041 100644
--- a/screenpipe-audio/Cargo.toml
+++ b/screenpipe-audio/Cargo.toml
@@ -35,7 +35,6 @@ candle = { workspace = true }
candle-nn = { workspace = true }
candle-transformers = { workspace = true }
ndarray = "0.15.6"
-vad-rs = "0.1.3"
tokenizers = { workspace = true }
anyhow = "1.0.86"
byteorder = "1.5.0"
@@ -63,11 +62,15 @@ reqwest = { workspace = true }
screenpipe-core = { path = "../screenpipe-core" }
-[target.'cfg(target_os = "windows")'.dependencies]
-ort = { version = "2.0.0-rc.5", features = ["load-dynamic"], default-features = false }
-esaxx-rs = "0.1.10"
-samplerate = { version = "0.2.4" }
-libsamplerate-sys = "0.1.10"
+# [target.'cfg(target_os = "windows")'.dependencies]
+# ort = { version = "2.0.0-rc.5", features = ["load-dynamic"], default-features = false }
+# esaxx-rs = "0.1.10"
+# samplerate = { version = "0.2.4" }
+# libsamplerate-sys = "0.1.10"
+
+# not windows
+[target.'cfg(not(target_os = "windows"))'.dependencies]
+vad-rs = "0.1.3"
[target.'cfg(target_os = "macos")'.dependencies]
once_cell = "1.17.1"
diff --git a/screenpipe-audio/src/stt.rs b/screenpipe-audio/src/stt.rs
index 3a2ffabb7..5ca8255cd 100644
--- a/screenpipe-audio/src/stt.rs
+++ b/screenpipe-audio/src/stt.rs
@@ -22,10 +22,13 @@ use rubato::{
use crate::{
multilingual,
pcm_decode::pcm_decode,
- vad_engine::{SileroVad, VadEngine, VadEngineEnum, WebRtcVad},
+ vad_engine::{VadEngine, VadEngineEnum, WebRtcVad},
AudioTranscriptionEngine,
};
+#[cfg(not(target_os = "windows"))]
+use crate::vad_engine::SileroVad;
+
use hound::{WavSpec, WavWriter};
use std::io::Cursor;
@@ -734,9 +737,10 @@ pub async fn create_whisper_channel(
) = unbounded_channel();
let mut vad_engine: Box<dyn VadEngine + Send> = match vad_engine {
VadEngineEnum::WebRtc => Box::new(WebRtcVad::new()),
+ #[cfg(not(target_os = "windows"))]
VadEngineEnum::Silero => Box::new(SileroVad::new()?),
};
-
+
let shutdown_flag = Arc::new(AtomicBool::new(false));
let shutdown_flag_clone = shutdown_flag.clone();
diff --git a/screenpipe-audio/src/vad_engine.rs b/screenpipe-audio/src/vad_engine.rs
index 5c1b99c87..a360dce03 100644
--- a/screenpipe-audio/src/vad_engine.rs
+++ b/screenpipe-audio/src/vad_engine.rs
@@ -1,11 +1,14 @@
-use std::path::PathBuf;
-use vad_rs::{Vad};
use anyhow;
-use std::io::Write;
use log::debug;
+use std::io::Write;
+use std::path::PathBuf;
+
+#[cfg(not(target_os = "windows"))]
+use vad_rs::Vad;
pub enum VadEngineEnum {
WebRtc,
+ #[cfg(not(target_os = "windows"))]
Silero,
}
@@ -26,12 +29,11 @@ impl WebRtcVad {
impl VadEngine for WebRtcVad {
fn is_voice_segment(&mut self, audio_chunk: &[f32]) -> anyhow::Result<bool> {
// Convert f32 to i16
- let i16_chunk: Vec<i16> = audio_chunk
- .iter()
- .map(|&x| (x * 32767.0) as i16)
- .collect();
+ let i16_chunk: Vec<i16> = audio_chunk.iter().map(|&x| (x * 32767.0) as i16).collect();
- let result = self.0.is_voice_segment(&i16_chunk)
+ let result = self
+ .0
+ .is_voice_segment(&i16_chunk)
.map_err(|e| anyhow::anyhow!("WebRTC VAD error: {:?}", e))?;
// debug!("WebRTC VAD result: is_voice_segment = {}", result);
@@ -40,10 +42,12 @@ impl VadEngine for WebRtcVad {
}
}
+#[cfg(not(target_os = "windows"))]
pub struct SileroVad {
vad: Vad,
}
+#[cfg(not(target_os = "windows"))]
impl SileroVad {
pub fn new() -> anyhow::Result<Self> {
debug!("Initializing SileroVad...");
@@ -59,7 +63,8 @@ impl SileroVad {
fn download_model() -> anyhow::Result<PathBuf> {
debug!("Downloading SileroVAD model...");
- let url = "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx";
+ let url =
+ "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx";
let response = reqwest::blocking::get(url)?;
let model_data = response.bytes()?;
@@ -97,12 +102,14 @@ impl VadEngine for SileroVad {
pub fn create_vad_engine(engine: VadEngineEnum) -> anyhow::Result<Box<dyn VadEngine>> {
match engine {
VadEngineEnum::WebRtc => Ok(Box::new(WebRtcVad::new())),
+ #[cfg(not(target_os = "windows"))]
VadEngineEnum::Silero => {
let silero_vad = SileroVad::new()?;
Ok(Box::new(silero_vad))
- },
+ }
}
}
unsafe impl Send for WebRtcVad {}
-unsafe impl Send for SileroVad {}
\ No newline at end of file
+#[cfg(not(target_os = "windows"))]
+unsafe impl Send for SileroVad {}
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index b2b489fe7..7cb38a991 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -54,6 +54,7 @@ impl From<CliOcrEngine> for CoreOcrEngine {
pub enum CliVadEngine {
#[clap(name = "webrtc")]
WebRtc,
+ #[cfg(not(target_os = "windows"))]
#[clap(name = "silero")]
Silero,
}
@@ -62,6 +63,7 @@ impl From<CliVadEngine> for VadEngineEnum {
fn from(cli_engine: CliVadEngine) -> Self {
match cli_engine {
CliVadEngine::WebRtc => VadEngineEnum::WebRtc,
+ #[cfg(not(target_os = "windows"))]
CliVadEngine::Silero => VadEngineEnum::Silero,
}
}
@@ -169,9 +171,11 @@ pub struct Cli {
pub disable_vision: bool,
/// VAD engine to use for speech detection
- #[arg(long, value_enum, default_value_t = CliVadEngine::Silero)] // Silero or WebRtc
+ #[cfg_attr(not(target_os = "windows"), arg(long, value_enum, default_value_t = CliVadEngine::Silero))]
+ #[cfg_attr(target_os = "windows", arg(long, value_enum, default_value_t = CliVadEngine::WebRtc))]
pub vad_engine: CliVadEngine,
+
/// List of windows to ignore (by title) for screen recording - we use contains to match, example:
/// --ignored-windows "Spotify" --ignored-windows "Bit" will ignore both "Bitwarden" and "Bittorrent"
/// --ignored-windows "porn" will ignore "pornhub" and "youporn"