Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Recording: the sound level indicator moves with a normal speaking voice

Eric Brownroutad2a4b563a51
diff --git a/app/src/shared/wave.ts b/app/src/shared/wave.ts
index f00f7c55..13607a3e 100644
--- a/app/src/shared/wave.ts
+++ b/app/src/shared/wave.ts
@@ -37,5 +37,11 @@ export function barPlan(p: { reduced: boolean; paused: boolean; level: number; b
export const frameKey = (plan: { heights: number[]; alpha: number[] }, span: number): string =>
plan.heights.map((v) => Math.round(v * span)).join() + '|' + Math.round(plan.alpha[0] * 100)
-/** Capture maps -60..0 dBFS to 0..1; show -51..-12 dBFS across the meter's range. */
-export const micLevel = (lv: { me: number; them: number }): number => Number.isFinite(lv.me) ? Math.max(0, Math.min(1, (lv.me - .15) / .65)) : 0
+const METER_GAIN = 10
+
+/** Capture already measures dBFS. Give quiet speech more travel while retaining headroom for louder speech. */
+export function micLevel({ me }: { me: number; them: number }): number {
+ if (!Number.isFinite(me)) return 0
+ const level = Math.max(0, Math.min(1, (me - .15) / .65)) // −51 to −12 dBFS
+ return METER_GAIN * level / (1 + (METER_GAIN - 1) * level)
+}
diff --git a/app/test/wave.test.ts b/app/test/wave.test.ts
index f2b5e69b..fd7249c6 100644
--- a/app/test/wave.test.ts
+++ b/app/test/wave.test.ts
@@ -5,14 +5,25 @@ describe('microphone meter', () => {
it('keeps silence quiet and makes ordinary speech visible without using call audio', () => {
expect(micLevel({ me: 0, them: 1 })).toBe(0)
expect(micLevel({ me: .15, them: 1 })).toBe(0)
- const speech = [-40, -25, -12].map(db => micLevel({ me: (db + 60) / 60, them: 0 }))
- expect(speech[0]).toBeGreaterThan(.25)
- expect(speech[1]).toBeGreaterThan(.6)
- expect(speech[2]).toBe(1)
+ const speech = [-45, -42, -25, -12].map(db => micLevel({ me: (db + 60) / 60, them: 0 }))
+ expect(speech[0]).toBeCloseTo(.65, 2)
+ expect(speech[1]).toBeCloseTo(.75, 2)
+ expect(speech[2]).toBeCloseTo(.95, 2)
+ expect(speech[3]).toBe(1)
expect(micLevel({ me: Infinity, them: 0 })).toBe(0)
expect(micLevel({ me: -1, them: 0 })).toBe(0)
expect(micLevel({ me: 2, them: 0 })).toBe(1)
})
+ it('shows a quiet 100 ms syllable on both meters without lifting silence', () => {
+ const wave = new Wave()
+ wave.target = micLevel({ me: .30, them: .79 })
+ wave.step(100)
+ for (const [bars, height] of [[3, 14], [5, 16]] as const) {
+ const plan = barPlan({ bars, level: wave.level, paused: false, reduced: false })
+ expect(3 + Math.round(Math.max(...plan.heights) * (height - 3))).toBe(bars === 3 ? 10 : 11)
+ }
+ expect(micLevel({ me: .1, them: .79 })).toBe(0)
+ })
it('attacks in 60ms and releases in 220ms without a scrolling delay', () => {
const w = new Wave()
w.target = 1; w.step(60)