fixes incoming legacy voip stream not being resampled

David Kleingeld created

Change summary

Cargo.lock                | 20 +++++++++++++++++---
crates/audio/Cargo.toml   |  2 +-
crates/audio/src/audio.rs |  1 +
3 files changed, 19 insertions(+), 4 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -2678,9 +2678,10 @@ dependencies = [
 [[package]]
 name = "candle-core"
 version = "0.9.1"
-source = "git+https://github.com/dvdsk/candle?branch=9.1-patched#591d35bb503cb93a63bb49d5fe2d9531ee6ad651"
+source = "git+https://github.com/dvdsk/candle?branch=add-operators#eb7ce1cb6a201400c9c5117bf1d041454768bb03"
 dependencies = [
  "byteorder",
+ "float8",
  "gemm 0.17.1",
  "half",
  "memmap2",
@@ -2699,10 +2700,11 @@ dependencies = [
 [[package]]
 name = "candle-nn"
 version = "0.9.1"
-source = "git+https://github.com/dvdsk/candle?branch=9.1-patched#591d35bb503cb93a63bb49d5fe2d9531ee6ad651"
+source = "git+https://github.com/dvdsk/candle?branch=add-operators#eb7ce1cb6a201400c9c5117bf1d041454768bb03"
 dependencies = [
  "candle-core",
  "half",
+ "libc",
  "num-traits",
  "rayon",
  "safetensors",
@@ -2713,7 +2715,7 @@ dependencies = [
 [[package]]
 name = "candle-onnx"
 version = "0.9.1"
-source = "git+https://github.com/dvdsk/candle?branch=9.1-patched#591d35bb503cb93a63bb49d5fe2d9531ee6ad651"
+source = "git+https://github.com/dvdsk/candle?branch=add-operators#eb7ce1cb6a201400c9c5117bf1d041454768bb03"
 dependencies = [
  "candle-core",
  "candle-nn",
@@ -5948,6 +5950,18 @@ version = "0.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"
 
+[[package]]
+name = "float8"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4203231de188ebbdfb85c11f3c20ca2b063945710de04e7b59268731e728b462"
+dependencies = [
+ "half",
+ "num-traits",
+ "rand 0.9.1",
+ "rand_distr",
+]
+
 [[package]]
 name = "float_next_after"
 version = "1.0.0"

crates/audio/Cargo.toml 🔗

@@ -17,7 +17,7 @@ anyhow.workspace = true
 async-tar.workspace = true
 collections.workspace = true
 crossbeam.workspace = true
-denoise = { path = "/home/davidsk/Documents/denoise"}
+denoise = { path = "/home/davidsk/Documents/denoise" }
 gpui.workspace = true
 log.workspace = true
 parking_lot.workspace = true

crates/audio/src/audio.rs 🔗

@@ -224,6 +224,7 @@ impl Audio {
         cx: &mut App,
     ) -> anyhow::Result<()> {
         let (replay_source, source) = source
+            .constant_params(CHANNEL_COUNT, SAMPLE_RATE)
             .automatic_gain_control(1.0, 2.0, 0.0, 5.0)
             .periodic_access(Duration::from_millis(100), move |agc_source| {
                 agc_source.set_enabled(LIVE_SETTINGS.auto_speaker_volume.load(Ordering::Relaxed));