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
Recording: the note's level meter is purple while recording and grey when paused
Eric Brownrout377d8899b74b
diff --git a/app/src/renderer/src/components/LevelBars.tsx b/app/src/renderer/src/components/LevelBars.tsxindex 3eb64c21..5f82b42b 100644--- a/app/src/renderer/src/components/LevelBars.tsx+++ b/app/src/renderer/src/components/LevelBars.tsx@@ -1,13 +1,13 @@import { useEffect, useRef } from 'react'-import { FALL, RISE, SPEECH_PACKET_TIMEOUT, WAVE_PERIOD, silentSpeech, speechAt, speechBars, type SpeechAnchor } from '../../../shared/speechWave'+import { FALL, REST_OPACITY, RISE, SPEECH_PACKET_TIMEOUT, WAVE_PERIOD, silentSpeech, speechAt, speechBars, type SpeechAnchor } from '../../../shared/speechWave'const WIDTH = 15, STROKE = 1.75, STUB = 3-type Props = { height: number; className?: string; testId: string; paused?: boolean; stillBars?: boolean }+type Props = { height: number; className?: string; testId: string; paused?: boolean; stillBars?: boolean; restOpacity?: number }// Scale the centreline. Its non-scaling stroke retains the same round caps at every height.const scale = (value: number, height: number) => `scaleY(${(STUB + value * (height - STUB) - STROKE) / (height - STROKE)})`-export function LevelBars({ height, className = '', testId, paused = false, stillBars = false }: Props) {+export function LevelBars({ height, className = '', testId, paused = false, stillBars = false, restOpacity = REST_OPACITY }: Props) {const ref = useRef<SVGSVGElement>(null)const recent = useRef(silentSpeech)useEffect(() => {@@ -30,7 +30,7 @@ export function LevelBars({ height, className = '', testId, paused = false, stilconst planAt = (ms: number) => speechBars({drive: Math.min(1, Math.max(0, drive + ms / (playing ? RISE : -FALL))),phase: voice.phase + ms,- }, media.matches)+ }, media.matches, restOpacity)const plan = planAt(0)bars.forEach((bar, i) => {const value = marker ? [.35, .525, .7, .525, .35][i] : plan.heights[i]@@ -78,14 +78,14 @@ export function LevelBars({ height, className = '', testId, paused = false, stildocument.addEventListener('visibilitychange', sync)sync()return () => { off(); clearTimeout(deadline); cancel(); media.removeEventListener('change', sync); document.removeEventListener('visibilitychange', sync) }- }, [height, paused, stillBars])+ }, [height, paused, stillBars, restOpacity])return <svg ref={ref} data-testid={testId} aria-hidden="true" width={WIDTH} height={height} viewBox={`0 0 ${WIDTH} ${height}`} className={`recording-wave ${className}`}><g stroke="currentColor" strokeWidth={STROKE} strokeLinecap="round">{Array.from({ length: 5 }, (_, i) => {const x = STROKE / 2 + i * (WIDTH - STROKE) / 4return <line key={i} x1={x} x2={x} y1={STROKE / 2} y2={height - STROKE / 2}- vectorEffect="non-scaling-stroke" style={{ transform: scale(0, height), opacity: .45 }} />+ vectorEffect="non-scaling-stroke" style={{ transform: scale(0, height), opacity: restOpacity }} />})}</g></svg>diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsxindex 6fe26135..c0f35b95 100644--- a/app/src/renderer/src/screens/Note.tsx+++ b/app/src/renderer/src/screens/Note.tsx@@ -383,7 +383,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu<div data-testid={recording ? 'rec-bar' : 'note-bar'} className="note-header-actions"><div className="note-recorder-controls">{recording && !finishing && <>- <LevelBars height={14} testId="note-wave" paused={!!m.paused} className="text-muted" />+ <LevelBars height={14} testId="note-wave" paused={!!m.paused} restOpacity={0.7} className={m.paused ? 'text-muted' : 'text-accent'} /><RecordingTime view={recorder} /></>}<div data-testid="note-state" data-state={m.state} data-paused={!!m.paused} className="note-recording-group" data-treatment={RECORDING_CONTROL_TREATMENT} data-recording={recording && !finishing} role="group" aria-label={recording ? m.paused ? t('Paused') : t('Recording') : t('Meeting controls')}>diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.cssindex 9a9c5643..ed539352 100644--- a/app/src/renderer/src/styles.css+++ b/app/src/renderer/src/styles.css@@ -538,6 +538,9 @@ input::selection, textarea::selection, .note-prose ::selection { background: var.note-meta-row { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-top:16px; }.note-header-actions { display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:12px;margin-inline-start:auto; }.note-recorder-controls { display:flex;align-items:center;gap:8px; }+@media (prefers-reduced-motion:no-preference) {+ .note-recorder-controls .recording-wave { transition:color var(--dur-micro) ease; }+}.note-elapsed { font-size:11px;font-variant-numeric:tabular-nums;color:var(--muted);white-space:nowrap; }.note-primary-tabs { position:relative;display:flex;gap:24px;margin-top:22px;border-bottom:1px solid var(--line); }.note-primary-tabs [role=tab] { display:flex;align-items:center;gap:4px;height:36px;padding-inline:4px;border-bottom:2px solid transparent;color:var(--muted);font-size:13px;font-weight:500; }diff --git a/app/src/shared/speechWave.ts b/app/src/shared/speechWave.tsindex 87bf4361..81fb1443 100644--- a/app/src/shared/speechWave.ts+++ b/app/src/shared/speechWave.ts@@ -1,4 +1,5 @@export const WAVE_PERIOD = 900+export const REST_OPACITY = .45export const RISE = 300, FALL = 520export const SPEECH_PACKET_TIMEOUT = 300export type SpeechAnchor = { at: number; phase: number; drive: number; speaking: boolean }@@ -22,7 +23,7 @@ export function speechSample(previous: SpeechAnchor, input: { me: number; them:return { ...speechAt(previous, now), at: now, speaking: db >= -44.4 || (held && db > -49.2) }}-export function speechBars({ drive, phase }: ReturnType<typeof speechAt>, reduced: boolean) {+export function speechBars({ drive, phase }: ReturnType<typeof speechAt>, reduced: boolean, restOpacity = REST_OPACITY) {const energy = drive * drive * (3 - 2 * drive)// The captured crest is 48 px tall and the trough 14 px. Our 3 px resting stub supplies part of that trough.const heights = Array.from({ length: 5 }, (_, i) => {@@ -30,7 +31,7 @@ export function speechBars({ drive, phase }: ReturnType<typeof speechAt>, reduceconst hump = (1 + Math.cos(2 * Math.PI * angle)) / 2return .70 * energy * (.11 + .89 * hump)})- return { heights, alpha: heights.map(() => .45 + .55 * energy) }+ return { heights, alpha: heights.map(() => restOpacity + (1 - restOpacity) * energy) }}/** Latest possible rest time, for static, reduced-motion renderers if the input stream stops. */diff --git a/app/test/meterTimeline.test.ts b/app/test/meterTimeline.test.tsindex cc1e178f..ff985baa 100644--- a/app/test/meterTimeline.test.ts+++ b/app/test/meterTimeline.test.ts@@ -6,7 +6,10 @@ import { LevelBars } from '../src/renderer/src/components/LevelBars'vi.mock('react', async original => ({ ...await original<typeof import('react')>(), useEffect: vi.fn(), useRef: vi.fn() }))afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals(); vi.clearAllMocks() })-it('interpolates between level packets without renderer frame callbacks and settles when packets stop', () => {+it.each([+ { testId: 'widget-wave', restOpacity: undefined, expectedRest: .45 },+ { testId: 'note-wave', restOpacity: .7, expectedRest: .7 },+])('interpolates between level packets and settles at the resting opacity for $testId', ({ testId, restOpacity, expectedRest }) => {vi.useFakeTimers(); vi.setSystemTime(0)vi.stubGlobal('performance', { now: () => Date.now(), timeOrigin: 0 })const doc = Object.assign(new EventTarget(), { visibilityState: 'visible' })@@ -20,12 +23,16 @@ it('interpolates between level packets without renderer frame callbacks and sett}))const svg = { querySelectorAll: () => bars, dataset: { live: '', level: '' } }vi.mocked(useRef).mockImplementation((value: unknown) => ({ current: value === null ? svg : value }) as never)- LevelBars({ height: 16, testId: 'widget-wave' })+ LevelBars({ height: 16, testId, restOpacity })const cleanup = vi.mocked(useEffect).mock.calls[0][0]()+ expect(bars.every(bar => Number(bar.style.opacity) === expectedRest)).toBe(true)let anchor = silentSpeechconst packet = () => { anchor = speechSample(anchor, { me: .7, them: 0 }, Date.now()); receive({ me: .7, them: 0, speech: anchor }) }packet()const line = bars[4]+ const ramp = line.animate.mock.calls[0][0]+ expect(ramp[0].opacity).toBe(expectedRest)+ expect(ramp.at(-1)!.opacity).toBe(1)const [frames, timing] = line.animate.mock.calls[1]expect(timing).toMatchObject({ delay: 300, duration: 900, iterations: Infinity })expect(line.animate.mock.results[1].value.startTime).toBe(0)@@ -46,6 +53,7 @@ it('interpolates between level packets without renderer frame callbacks and settexpect(line.animate).toHaveBeenCalledTimes(2) // steady packets do not restart travelvi.advanceTimersByTime(821)expect(svg.dataset).toMatchObject({ level: '0.00', live: '0' })+ expect(bars.every(bar => Number(bar.style.opacity) === expectedRest)).toBe(true)expect(line.animate.mock.results.every(result => result.value.cancel.mock.calls.length > 0)).toBe(true)media.matches = true; media.dispatchEvent(new Event('change')); packet()expect(svg.dataset.live).toBe('0')diff --git a/app/test/resumeRequest.test.ts b/app/test/resumeRequest.test.tsindex 4406bce7..06fb2306 100644--- a/app/test/resumeRequest.test.ts+++ b/app/test/resumeRequest.test.ts@@ -67,6 +67,17 @@ beforeEach(() => {})afterEach(() => { unmount(); vi.unstubAllGlobals() })+it('tints the note wave purple while recording, grey on pause, and purple again on resume', async () => {+ meeting.state = 'recording'; requested = undefined+ await render(); await render()+ expect(find(tree, 'note-wave')?.props).toMatchObject({ className: 'text-accent', paused: false, restOpacity: 0.7 })+ for (const paused of [true, false]) {+ meeting = { ...meeting, paused: paused || undefined }+ meetingChanged(); await render(); await render()+ expect(find(tree, 'note-wave')?.props).toMatchObject({ className: paused ? 'text-muted' : 'text-accent', paused })+ }+})+it.each(['', 'Keep this decision.'])('the note Resume button always lands on My notes with content %j', async mine => {notes = { ...notes, status: 'done', mine }; requested = undefinedawait render(); await render()