oficina / meet Public

Meter the capture hook before the suppressor too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev b2295f8f5ffbad2d5a41fc091b412b66cc514a6c parent 62f0d63
1 file changed, +8 −0
  • native/apple/Sources/CallsKit/NoiseSuppression.swift +8 −0
diff --git a/native/apple/Sources/CallsKit/NoiseSuppression.swift b/native/apple/Sources/CallsKit/NoiseSuppression.swift
index ce0168e..b8fb4d6 100644
--- a/native/apple/Sources/CallsKit/NoiseSuppression.swift
+++ b/native/apple/Sources/CallsKit/NoiseSuppression.swift
@@ -290,10 +290,18 @@ public final class CaptureDenoiser: NSObject, RTCAudioCustomProcessingDelegate,
lock.withLock { $0.buffers += 1 }
guard audioBuffer.channels >= 1 else { return }
let samples = audioBuffer.rawBuffer(forChannel: 0)
+ inputLevel.record(samples, frames: audioBuffer.frames, at: clock())
if audioBuffer.channels == 1 { process(samples, frames: audioBuffer.frames) }
observe(samples, frames: audioBuffer.frames)
}
+ /// The same buffers measured on the way *in*, before the suppressor:
+ /// what the microphone delivers after WebRTC's echo canceller and
+ /// high-pass filter. "Is the microphone picking anything up" is asked
+ /// of this one, because a quiet room the suppressor has taken down by
+ /// 30 dB can look dead afterwards and is not.
+ public let inputLevel = CaptureLevel()
+
/// What leaves the hook, measured: the level of every buffer after the
/// suppressor and gain have had it (or passed it through), which is the
/// audio that is encoded and sent. Read by the microphone meter.