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.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Call names: a Zoom reader that goes quiet for over 5 s while recording is started again (one froze and left 11 minutes as Them)
christianmatf9291f1a8db3
diff --git a/app/src/main/callNames/index.ts b/app/src/main/callNames/index.tsindex d20090fe..50341e0d 100644--- a/app/src/main/callNames/index.ts+++ b/app/src/main/callNames/index.ts@@ -37,11 +37,15 @@ const kindOf = (bundleId: string): CallKind | null => Object.values(APPS).find((export const WATCH_EVERY_MS = 400/** the apps mark the person talking about this late (Zoom: about 0.75 to 1.2 s after they start) */const APP_LAG_MS = 750+/** no reading for this long while recording: the reader is stuck (seen once, 11 minutes of Them), so it starts again */+export const QUIET_MS = 5000+/** at most this many fresh starts per meeting, so an app that never answers can't start readers forever */+const MAX_RESTARTS = 20/** changes of who talks written to the log, per meeting (enough to check a real call, never a flood) */const LOGGED_CHANGES = 30type Sample = Omit<CallSample, 'ms'> & { t: number }-type Session = { samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; errors: Set<string>; last: string; logged: number }+type Session = { ids: string[]; heardAt: number; restarts: number; samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; errors: Set<string>; last: string; logged: number }export function hookCallNames(p: {store: Pick<Store, 'meeting' | 'segments' | 'setSegmentSpeakers' | 'updateMeeting'>@@ -59,6 +63,8 @@ export function hookCallNames(p: {onBind?: (fn: (m: Meeting) => void) => unknownlog?: (msg: string) => voidnow?: () => number+ /** how the quiet check runs (every 2 s; tests call checkQuiet themselves) */+ every?: (fn: () => void, ms: number) => unknown}) {// info, not log: main.log keeps info, warn and error, and these lines are how a call that stayed Them gets explainedconst log = p.log ?? ((s: string) => console.info(s))@@ -73,6 +79,7 @@ export function hookCallNames(p: {}const onLine = (id: string, s: Session, l: WatchLine) => {+ s.heardAt = now()if (l.error || !l.app || !l.windows) {const why = l.error ?? 'nothing read'if (!s.errors.has(why)) { s.errors.add(why); log(`call names: ${why}${why === 'not-trusted' ? ' (no Accessibility permission): the other side stays Them' : ''}`) }@@ -93,7 +100,7 @@ export function hookCallNames(p: {p.onStart((m) => {const ids = watchIds(m.app)- const s: Session = { everyApp: !m.app, samples: [], priorLines: new Set(p.store.segments(m.id, { hidden: true }).map((line) => line.id)), startedAt: m.resume ? m.resume.startedAt - m.resume.startMs : m.startedAt, pictured: false, errors: new Set(), last: '', logged: 0 }+ const s: Session = { ids, heardAt: now(), restarts: 0, everyApp: !m.app, samples: [], priorLines: new Set(p.store.segments(m.id, { hidden: true }).map((line) => line.id)), startedAt: m.resume ? m.resume.startedAt - m.resume.startMs : m.startedAt, pictured: false, errors: new Set(), last: '', logged: 0 }sessions.set(m.id, s)if (!ids.length) { log(`call names: ${m.app} can't be read, the other side is Them`); return }try { s.watch = p.watch(ids, (l) => onLine(m.id, s, l)) } catch (e) { console.error('call names: the watch did not start', e) }@@ -107,6 +114,7 @@ export function hookCallNames(p: {s.everyApp = falses.watch?.stop(); s.watch = undefinedconst ids = watchIds(m.app)+ s.ids = ids; s.heardAt = now()log(`call names: the call is in ${m.app}, reading only it`)if (!ids.length) returns.pictured = false@@ -147,7 +155,21 @@ export function hookCallNames(p: {finals.set(m.id, final)})+ /** a reader that stopped sending readings is stopped and started again (the cause is logged where it's known) */+ function checkQuiet() {+ for (const [id, s] of sessions) {+ if (!s.watch || !s.ids.length || now() - s.heardAt <= QUIET_MS || s.restarts >= MAX_RESTARTS) continue+ log(`call names: the reader went quiet for ${Math.round((now() - s.heardAt) / 1000)} s; starting it again`)+ s.restarts+++ s.watch.stop(); s.watch = undefined+ s.heardAt = now()+ try { s.watch = p.watch(s.ids, (l) => onLine(id, s, l)) } catch (e) { console.error('call names: the watch did not start', e) }+ }+ }+ ;(p.every ?? ((fn, ms) => setInterval(fn, ms).unref()))(checkQuiet, 2000)+return {+ checkQuiet,/** the name for a line of the other side just heard, or null for Them */nameFor(meetingId: string, startMs: number, endMs: number): string | null {const s = sessions.get(meetingId)diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.tsindex 6b365a20..cb5991a8 100644--- a/app/test/callNames.test.ts+++ b/app/test/callNames.test.ts@@ -54,7 +54,7 @@ function setup(o: { app?: string | null; attendees?: Meeting['attendees'] } = {}let transcribed!: () => voidconst done = new Promise<void>((r) => { transcribed = r })const hook = hookCallNames({- store, myNames: () => ['Alex Morgan'], transcribed: () => done, changed: (id) => changed.push(id), log: (s) => logs.push(s), now: () => clock,+ store, myNames: () => ['Alex Morgan'], transcribed: () => done, changed: (id) => changed.push(id), log: (s) => logs.push(s), now: () => clock, every: () => {},watch: (ids, onLine) => { watched.push(ids); emit = onLine; return { stop: () => { stopped++ } } },onStart: (fn) => starts.push(fn), onStop: (fn) => stops.push(fn), onCapture: (fn) => captures.push(fn), onBind: (fn) => binds.push(fn),})@@ -106,6 +106,22 @@ describe('Webex accessibility roster', () => {})describe('hookCallNames', () => {+ it('a reader that goes quiet (no reading for over 5 s while recording) is started again, and the log says so', () => {+ const s = setup()+ s.start()+ s.emit(zoomLine(1_000_000, ['Alex Morgan', 'Dana Smith'], 'Dana Smith'))+ s.audio(0, 1_004_000); s.hook.checkQuiet()+ expect(s.watched).toHaveLength(1)+ s.audio(0, 1_006_500); s.hook.checkQuiet()+ expect(s.stopped()).toBe(1)+ expect(s.watched).toHaveLength(2)+ expect(s.logs.some((l) => /went quiet/.test(l))).toBe(true)+ // readings again: nothing more to do+ s.emit(zoomLine(1_007_000, ['Alex Morgan', 'Dana Smith'], 'Dana Smith'))+ s.audio(0, 1_009_000); s.hook.checkQuiet()+ expect(s.watched).toHaveLength(2)+ })+it('a recording started by hand watches every call app until its app is known, then only that one (a Teams chat window cannot hide a Meet call, #72)', () => {const s = setup({ app: null })s.start()