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
Mac: switching the mic mid-recording no longer crashes the recorder, and finishing gets past empty parts a crash left (#27)
christianmatfcbbd2f10c6a
diff --git a/app/e2e/audioCompact.spec.ts b/app/e2e/audioCompact.spec.tsindex 69163eea..7c5f335f 100644--- a/app/e2e/audioCompact.spec.ts+++ b/app/e2e/audioCompact.spec.ts@@ -176,3 +176,20 @@ test('the live HE writer commits five-second fragments that remain readable afteawait closed}})++test('finishing gets past the empty files a recorder that crashed at once left behind (issue #27)', async ({}, info) => {+ const dir = info.outputPath('crashed-at-start')+ mkdirSync(dir, { recursive: true })+ for (const track of tracks) {+ await run('/usr/bin/afconvert', ['-f', 'm4af', '-d', 'aac@48000', '-b', '64000', '-c', '1', join(import.meta.dirname, 'fixtures', `meeting-${track}.wav`), join(dir, `${track}.m4a`)])+ // the restarted recorder died before writing a byte+ writeFileSync(join(dir, `${track}.1.m4a`), '')+ }+ const before = await inspect(dir).catch(() => null)+ writeFileSync(join(dir, 'part.1.json'), JSON.stringify({ startMs: 90_000 }))+ await run(helper, ['join', '--dir', dir])+ expect(readdirSync(dir).filter((f) => /\.1\.m4a$|^part\.1\.json$/.test(f))).toEqual([])+ const after = await inspect(dir)+ for (const track of tracks) expect(after.tracks[track].durationMs).toBeGreaterThan(1000)+ expect(before).toBeNull()+})diff --git a/app/native/yogurt-audio/main.swift b/app/native/yogurt-audio/main.swiftindex c0377140..245e65e4 100644--- a/app/native/yogurt-audio/main.swift+++ b/app/native/yogurt-audio/main.swift@@ -473,10 +473,13 @@ final class Mic {/// the tap, in the input's format now (a new output device can change its rate)private func tap(_ e: AVAudioEngine) -> Bool {let input = e.inputNode- let fmt = input.outputFormat(forBus: 0)+ // the microphone's own format now: after a switch (a headset in hands-free mode at 16 kHz, then the Mac's own mic)+ // the node's remembered format can be the old one, and a tap asking for it threw an exception that ended the+ // recorder (issue #27). nil takes the bus's format as it is, and each buffer says its own rate.+ let fmt = input.inputFormat(forBus: 0)guard fmt.sampleRate > 0, fmt.channelCount > 0 else { log("no microphone"); return false }let onBuffer = self.onBuffer- input.installTap(onBus: 0, bufferSize: AVAudioFrameCount(fmt.sampleRate / 10), format: fmt) { b, _ in+ input.installTap(onBus: 0, bufferSize: AVAudioFrameCount(fmt.sampleRate / 10), format: nil) { b, _ inguard let m = mono(b, firstOnly: true) else { return }work.async { onBuffer(m) }}@@ -908,6 +911,8 @@ func joinParts(_ dir: URL) -> Int32 {out.openWriter()var used = 0, unreadable = falsefor (n, url, startMs) in parts {+ // a recorder that died before writing a byte (it crashed as it started) leaves an empty part: nothing to keep+ if n > 0, ((try? fm.attributesOfItem(atPath: url.path)[.size]) as? Int) == 0 { log("join: \(url.lastPathComponent) is empty; skipped"); continue }let asset = AVURLAsset(url: url)guard let src = asset.tracks(withMediaType: .audio).first, let reader = try? AVAssetReader(asset: asset) else { log("join: unreadable \(url.lastPathComponent); keeping all parts"); unreadable = true; break }let o = AVAssetReaderTrackOutput(track: src, outputSettings: [