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.

Upload an audio file: pick an MP3, M4A or WAV, set when the meeting happened, and Yogurt transcribes it into a new note on this computer

Eric Brownrout98e2ee4e1feb
diff --git a/app/e2e/rewriteConfirm.spec.ts b/app/e2e/rewriteConfirm.spec.ts
index 943ae76e..df2cd64c 100644
--- a/app/e2e/rewriteConfirm.spec.ts
+++ b/app/e2e/rewriteConfirm.spec.ts
@@ -32,6 +32,8 @@ test('keyboard regeneration focuses the optional note, respects Search, and rest
await expect(page.getByTestId('note-rename')).toBeFocused()
await page.keyboard.press('ArrowDown')
await page.keyboard.press('ArrowDown')
+ await expect(page.getByTestId('note-transcribe-again')).toBeFocused()
+ await page.keyboard.press('ArrowDown')
await expect(page.getByTestId('note-write-again')).toBeFocused()
await expect(page.getByTestId('note-write-again')).toHaveText('Regenerate summary')
await page.keyboard.press('Enter')
@@ -52,6 +54,7 @@ test('keyboard regeneration focuses the optional note, respects Search, and rest
await page.keyboard.press('Enter')
await page.keyboard.press('ArrowDown')
await page.keyboard.press('ArrowDown')
+ await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
await expect(page.getByTestId('note-regenerate-input')).toBeFocused()
// Escape discards the one-time note without changing the saved summary.
diff --git a/app/e2e/startRecording.spec.ts b/app/e2e/startRecording.spec.ts
index 6907e825..52abcac9 100644
--- a/app/e2e/startRecording.spec.ts
+++ b/app/e2e/startRecording.spec.ts
@@ -294,6 +294,8 @@ test('two live meetings open the title-bar menu; arrows, Enter and Escape choose
await stop(page)
await page.getByTestId('nav-home').click()
await page.getByTestId('recording-choices').press('ArrowUp')
+ await expect(menu.getByTestId('recording-upload')).toBeFocused()
+ await page.keyboard.press('ArrowUp')
await expect(menu.getByTestId('recording-unattached')).toBeFocused()
await page.keyboard.press('Enter')
await expect(page.getByTestId('note-state')).toHaveAttribute('data-state', 'recording')
diff --git a/app/src/main/asr/backfill.ts b/app/src/main/asr/backfill.ts
index c53dd12e..cc620e34 100644
--- a/app/src/main/asr/backfill.ts
+++ b/app/src/main/asr/backfill.ts
@@ -26,6 +26,7 @@ async function* pieces(src: AsyncIterable<Float32Array>): AsyncGenerator<Float32
/** Feeds the tracks to the pipeline; resolves with the ms of meeting time fed (the longer track) */
export async function feedRecording(p: {
+ fromMs?: Partial<Record<Track, number>>
tracks: Partial<Record<Track, AsyncIterable<Float32Array>>>
push: (track: Track, ms: number, samples: Float32Array) => void
backlogMs: () => number
@@ -45,7 +46,8 @@ export async function feedRecording(p: {
if (r.done) { f.done = true; continue }
while (p.backlogMs() > max && !p.stopped?.()) await wait(250)
if (p.stopped?.()) break
- p.push(f.track, f.ms, r.value)
+ const skip = Math.min(r.value.length, Math.max(0, Math.ceil(((p.fromMs?.[f.track] ?? 0) - f.ms) * 16)))
+ if (skip < r.value.length) p.push(f.track, f.ms + skip / 16, r.value.subarray(skip))
f.ms += r.value.length / 16
}
for (const f of feeds) await f.it.return(undefined)
diff --git a/app/src/main/asr/index.ts b/app/src/main/asr/index.ts
index 9f1467b5..d7de7a62 100644
--- a/app/src/main/asr/index.ts
+++ b/app/src/main/asr/index.ts
@@ -1,3 +1,5 @@
+import {previousSpeaker} from '../../shared/transcriptReplacement'
+import { AUDIO_SPEAKER } from '../../shared/audioUpload'
import { onCaptureStart, recordingFinished, type TranscribeWarn, type Track } from '../capture'
import { onMeetingStart, onMeetingStop } from '../meeting'
import { isFake } from '../paths'
@@ -22,6 +24,7 @@ import type { Chunk } from './chunker'
type Session = { complete?: () => boolean; pipeline: Pipeline | null; priorLines: Set<number>; done?: Promise<void>; store?: SessionStore; refresh?: (id: string) => void
/** a saved recording that could not be read to the end (transcribeRecorded): the meeting keeps waiting */
failed?: boolean
+ replacement?: boolean
/** Apple's speech listens in this locale for the meeting (null: whisper only); off once whisper hears another language */
speech?: string | null }
@@ -86,14 +89,15 @@ type SessionStore = Pick<Store, 'updateMeeting'> & Partial<Pick<Store, 'segments
let server: WhisperServer | undefined
let serverKey: string | undefined
const sessions = new Map<string, Session>()
-type Recorded = (id: string, tracks: Partial<Record<Track, AsyncIterable<Float32Array>>>, stopped?: () => boolean) => Promise<boolean>
+export type RecordedOptions = { signal?: AbortSignal; progress?: (ms: number) => void; fromMs?: Partial<Record<Track,number>>; save?: (segments: Omit<Segment,'id'>[]) => void }
+type Recorded = (id: string, tracks: Partial<Record<Track, AsyncIterable<Float32Array>>>, stopped?: () => boolean, options?: RecordedOptions) => Promise<boolean>
let recorded: Recorded = async () => false
/**
* A meeting recorded before the speech model was in (#30): its saved tracks (16 kHz) go through the same pipeline as a
* live meeting. true: all of it is transcribed (the meeting no longer waits); false: no model yet, already being
* transcribed, or the recording couldn't be read to the end (it waits for the next try).
*/
-export const transcribeRecorded: Recorded = (id, tracks, stopped) => recorded(id, tracks, stopped)
+export const transcribeRecorded: Recorded = (id, tracks, stopped, options) => recorded(id, tracks, stopped, options)
/** how much was heard in each language, per meeting; kept after the transcript is done, for the notes */
const heard = new Map<string, Map<string, number>>()
@@ -178,10 +182,11 @@ export function hookTranscription(p: {
void (sp.locales ?? (() => readSpeechLocales(sp.binary)))().then((l) => { speechLocales = l; if (l.available) console.log(`speech: Apple's on-device speech can listen in ${l.installed.length} of ${l.supported.length} locales`) })
} else { speechDeps = undefined; speechLocales = { available: false, supported: [], installed: [] } }
/** later: the saved recording of a meeting that was waiting for the speech model (transcribeRecorded) */
- const open = (id: string, later = false): Session => {
+ const open = (id: string, later = false, options?: RecordedOptions): Session => {
const have = sessions.get(id)
if (have) return have
// A later live session cannot finish audio awaiting deferred transcription; the recording itself can.
+ const priorSegments=later?p.store.segments?.(id)??[]:[]
const pendingBefore = later ? false : p.store.meeting?.(id)?.transcriptionPending
p.store.updateMeeting(id, { transcriptionPending: true })
let saveFailed = false
@@ -207,20 +212,32 @@ export function hookTranscription(p: {
// the model takes a few seconds to load: start now, so the first chunk does not wait for it
srv.url().catch((e) => console.error('whisper-server did not start', e))
transcribe = createTranscriber({ url: () => srv.url(), recover: recoverer(srv), onLanguage: (_t, lang, chars, locked) => hear(lang, chars, locked), prompt: promptOf,
- language: () => whisperLanguage(spokenNow()) })
+ language: () => whisperLanguage(spokenNow()), signal: options?.signal })
} else {
console.warn('no speech model yet: this meeting is recorded but not transcribed')
setTimeout(() => warnOnce('no-speech-model'), NO_MODEL_NOTE_DELAY_MS)
}
}
+ if (transcribe && options) {
+ const read = transcribe
+ transcribe = async (chunk, opts) => {
+ if (options.signal?.aborted) return []
+ try {
+ const lines = await read(chunk, opts)
+ if (options.signal?.aborted) return []
+ options.progress?.(chunk.startMs + chunk.samples.length / 16)
+ return lines
+ } catch (error) { if (options.signal?.aborted) return []; throw error }
+ }
+ }
const s: Session = {
- complete: () => !!transcribe && !pendingBefore && !saveFailed && !warned.has('transcribe-failed') && !s.failed,
- store: p.store, refresh: p.refresh, speech: speechLocaleFor(id), priorLines: new Set(p.store.segments?.(id).map((s) => s.id) ?? []),
+ complete: () => !!transcribe && !pendingBefore && !saveFailed && !warned.has('transcribe-failed') && !s.failed && !options?.signal?.aborted,
+ replacement: !!options?.save, store: p.store, refresh: p.refresh, speech: speechLocaleFor(id), priorLines: new Set(p.store.segments?.(id).map((s) => s.id) ?? []),
pipeline: transcribe ? createPipeline({ meetingId: id, transcribe, save: (segs) => {
- try { p.store.addSegments(segs) } catch (e) { saveFailed = true; throw e }
+ try { if(options?.save) options.save(segs); else p.store.addSegments(segs) } catch (e) { saveFailed = true; throw e }
if (segs.some(s => s.hidden)) p.refresh?.(id)
- }, emit: p.send, emitPartial: p.sendPartial, holdMs: p.holdMs, extraWaitMs: p.extraWaitMs, onWarn: warnOnce,
- nameOf: p.nameOf && ((a, b) => p.nameOf!(id, a, b)),
+ }, emit: options?.save ? () => {} : p.send, emitPartial: options?.save ? undefined : p.sendPartial, holdMs: p.holdMs, extraWaitMs: p.extraWaitMs, onWarn: warnOnce,
+ nameOf: (a, b) => p.store.meeting?.(id)?.source === 'audio-file' ? AUDIO_SPEAKER : p.nameOf?.(id, a, b) ?? previousSpeaker(priorSegments,'them',a,b),
respell: (t) => { const m = p.store.meeting?.(id); return m ? respell(t, meetingWords(m)) : t } }) : null,
}
if (s.speech) s.pipeline?.setQuickReads(false)
@@ -229,19 +246,19 @@ export function hookTranscription(p: {
}
const offStart = (p.onStart ?? onMeetingStart)((m) => { open(m.id) })
- recorded = async (id, tracks, stopped) => {
+ recorded = async (id, tracks, stopped, options) => {
if (sessions.has(id) || !p.modelPath()) return false
- const s = open(id, true)
+ const s = open(id, true, options)
if (!s.pipeline) { sessions.delete(id); return false }
const pipe = s.pipeline
// no live view to keep up with: only the saved lines
pipe.setQuickReads(false)
let ms = 0
- try { ms = await feedRecording({ tracks, push: (t, at, x) => pipe.push(t, at, x), backlogMs: () => pipe.backlogMs(), stopped }) } catch (e) { s.failed = true; console.error('reading a saved recording failed', id, e) }
- if (stopped?.()) s.failed = true
+ try { ms = await feedRecording({ tracks, fromMs: options?.fromMs, push: (t, at, x) => pipe.push(t, at, x), backlogMs: () => pipe.backlogMs(), stopped: () => !!stopped?.() || !!options?.signal?.aborted }) } catch (e) { s.failed = true; console.error('reading a saved recording failed', id, e) }
+ if (stopped?.() || options?.signal?.aborted) s.failed = true
await finishSession(id, s, undefined, p.store)
console.log(`ASR transcribed ${Math.round(ms / 1000)} s of a saved recording${s.failed ? ', not all of it' : ''}`)
- return !s.failed
+ return !!s.complete?.()
}
// each capture of a meeting (a restarted recorder is a new one) feeds that meeting's session
const offCapture = onCaptureStart((c, meetingId) => {
@@ -301,9 +318,9 @@ function sweepEcho(id: string, s: Session) {
function finishSession(id: string, s: Session, audioDone: () => Promise<void> = () => Promise.resolve(), store?: SessionStore): Promise<void> {
s.store ??= store
s.done ??= audioDone().then(() => s.pipeline?.finish()).then(() => {
- sweepEcho(id, s)
- if (s.complete?.()) s.store?.updateMeeting(id, { transcriptionPending: false })
- }).catch((e) => console.error('finishing the transcript failed', e)).finally(() => {
+ if (!s.replacement) sweepEcho(id, s)
+ if (!s.replacement && s.complete?.()) s.store?.updateMeeting(id, { transcriptionPending: false })
+ }).catch((e) => { s.failed = true; console.error('finishing the transcript failed', e) }).finally(() => {
// the meeting's main language is kept with it, for notes written later (after a restart too)
const lang = meetingLanguage(id)
if (lang) { try { s.store?.updateMeeting(id, { language: lang }) } catch (e) { console.error('saving the language failed', e) } }
diff --git a/app/src/main/asr/transcribe.ts b/app/src/main/asr/transcribe.ts
index e54f2974..380c4e5e 100644
--- a/app/src/main/asr/transcribe.ts
+++ b/app/src/main/asr/transcribe.ts
@@ -46,6 +46,7 @@ type Opts = {
/** a request failed: bring the server back (true) or give up (false). Asked on each failed call; the server decides how often it agrees. */
recover?: (reason: 'gone' | 'timeout', used?: string) => Promise<boolean>
/** how long one request may take before the server is taken to be hung (default: requestTimeoutMs) */
+ signal?: AbortSignal
timeoutMs?: number
fetchFn?: typeof fetch
/** the language a chunk was heard in, and how much was said in it (the notes are written in the main one) */
@@ -98,11 +99,12 @@ export function createTranscriber(o: Opts): Transcribe {
if (!guess) form.set('no_language_probabilities', 'true')
if (prompt) form.set('prompt', prompt)
used = await o.url()
- return fetchFn(`${used}/inference`, { method: 'POST', body: form, signal: AbortSignal.timeout(o.timeoutMs ?? requestTimeoutMs(c.samples.length)) })
+ return fetchFn(`${used}/inference`, { method: 'POST', body: form, signal: o.signal ? AbortSignal.any([o.signal, AbortSignal.timeout(o.timeoutMs ?? requestTimeoutMs(c.samples.length))]) : AbortSignal.timeout(o.timeoutMs ?? requestTimeoutMs(c.samples.length)) })
}
let res: Response
try { res = await send() } catch (err) {
// the server crashed or hung: one chance to bring it back, then the chunk is tried again
+ o.signal?.throwIfAborted()
const reason = err instanceof Error && err.name === 'TimeoutError' ? 'timeout' : 'gone'
if (!(await o.recover?.(reason, used).catch(() => false))) throw err
res = await send()
diff --git a/app/src/main/audio.ts b/app/src/main/audio.ts
index 1088d5a6..e4afd862 100644
--- a/app/src/main/audio.ts
+++ b/app/src/main/audio.ts
@@ -30,7 +30,7 @@ const TYPES: Record<AudioExt, string> = { m4a: 'audio/mp4', ogg: 'audio/ogg', wa
*/
export function audioExts(platform: string, fake: boolean): AudioExt[] {
if (fake) return ['wav']
- return platform === 'darwin' ? ['m4a', 'ogg'] : ['ogg', 'm4a']
+ return platform === 'darwin' ? ['m4a', 'ogg', 'wav'] : ['ogg', 'm4a', 'wav']
}
/** The file of one track in a meeting's folder: the first of these kinds that exists */
export function trackFile(dir: string, track: string, exts: readonly AudioExt[]): string | null {
diff --git a/app/src/main/audioUpload.ts b/app/src/main/audioUpload.ts
new file mode 100644
index 00000000..3222595a
--- /dev/null
+++ b/app/src/main/audioUpload.ts
@@ -0,0 +1,126 @@
+import { randomUUID } from 'node:crypto'
+import { createReadStream } from 'node:fs'
+import { mkdir, open, rename, rm, type FileHandle } from 'node:fs/promises'
+import { basename, extname, join } from 'node:path'
+import type { Store } from './store'
+import { uploadDayAllowed, type AudioUploadFile, type AudioUploadStatus } from '../shared/audioUpload'
+import { t } from '../shared/i18n'
+import { wavBytes } from './asr/transcribe'
+
+async function writeAll(file: FileHandle, bytes: Uint8Array, position: number) {
+ let written = 0
+ while (written < bytes.length) {
+ const { bytesWritten } = await file.write(bytes, written, bytes.length - written, position + written)
+ if (!bytesWritten) throw new Error('Audio write failed')
+ written += bytesWritten
+ }
+}
+
+type Job = { owner: number; file: AudioUploadFile; input: FileHandle; output?: FileHandle; dir: string; samples: number; modified: number; status?: AudioUploadStatus; id?: string; title?: string; at?: number; cancelled?: boolean; durable?: boolean; writing: Promise<void>; operation?: Promise<unknown>; wait?: Promise<void>; wake?: () => void }
+type UploadStore = Pick<Store,'createMeeting'|'updateMeeting'|'meeting'|'interruptAudioPreparations'>
+/** Uploaded audio is canonical 16 kHz mono PCM; stream it without reading hours of audio into RAM. */
+export async function* uploadedAudio(file: string): AsyncGenerator<Float32Array> {
+ let rest:Buffer=Buffer.alloc(0)
+ for await(const bytes of createReadStream(file,{start:44,highWaterMark:32768})) {
+ const b=rest.length?Buffer.concat([rest,bytes]):bytes as Buffer,n=b.length-b.length%2,out=new Float32Array(n/2)
+ for(let i=0;i<out.length;i++)out[i]=b.readInt16LE(i*2)/32768
+ rest=b.subarray(n);if(out.length)yield out
+ }
+ if(rest.length)throw new Error('Incomplete PCM audio')
+}
+export function createAudioUploads(d:{
+ root: string; store:UploadStore; recording:()=>boolean
+ prepared:(id:string)=>void; changed:()=>void; send:(owner:number,token:string,status:AudioUploadStatus)=>void
+}) {
+ const jobs=new Map<string,Job>()
+ const get=(owner:number,token:unknown)=>{const j=typeof token==='string'?jobs.get(token):undefined;if(!j||j.owner!==owner)throw new Error('Unknown audio selection');return j}
+ const tell=(j:Job,status:AudioUploadStatus)=>{const changed=j.status?.phase!==status.phase;j.status={...status,...(j.id?{meetingId:j.id}:{})};if(j.id&&changed&&status.phase!=='done'){d.store.updateMeeting(j.id,{transcriptionState:status.phase==='error'?'error':status.phase==='cancelling'?'stopped':status.phase==='reading'||status.phase==='waiting-recording'?'preparing':status.phase});d.changed()}d.send(j.owner,j.file.token,j.status)}
+ const control=async<T>(j:Job,task:()=>Promise<T>):Promise<T>=>{
+ if(j.operation)throw new Error('Audio upload is busy')
+ const operation=task();j.operation=operation
+ try{return await operation}finally{if(j.operation===operation)j.operation=undefined}
+ }
+ const waitForRecording=async(j:Job)=>{
+ while(d.recording()&&!j.cancelled){
+ tell(j,{phase:'waiting-recording'})
+ j.wait??=new Promise<void>(resolve=>{j.wake=()=>{j.wait=undefined;j.wake=undefined;resolve()}})
+ await j.wait
+ }
+ if(j.cancelled)throw new Error('Cancelled')
+ }
+ const cleanup=async(j:Job)=>{await j.output?.close().catch(()=>{});j.output=undefined;await j.input.close().catch(()=>{});await rm(j.dir,{recursive:true,force:true})}
+ return {
+ async select(owner:number,path:string):Promise<AudioUploadFile> {
+ for(const [token,j] of jobs)if(j.status?.phase==='done')jobs.delete(token)
+ if([...jobs.values()].some(j=>j.status?.phase!=='done'&&!j.cancelled))throw new Error('Audio upload is busy')
+ if(!['.mp3','.m4a','.wav'].includes(extname(path).toLowerCase()))throw new Error('Unsupported audio format')
+ const input=await open(path,'r')
+ try {
+ const stat=await input.stat();if(!stat.isFile()||stat.size<12||stat.size>8*1024**3)throw new Error('Unsupported audio file')
+ const token=randomUUID(),name=basename(path),file={token,name,title:name.slice(0,-extname(name).length).trim().slice(0,200)||t('Recording'),modifiedAt:stat.mtimeMs,size:stat.size}
+ jobs.set(token,{owner,file,input,dir:join(d.root,'.uploads',token),samples:0,modified:stat.mtimeMs,writing:Promise.resolve()});return file
+ }catch(error){await input.close();throw error}
+ },
+ info(owner:number,token:unknown){return get(owner,token).file},
+ async start(owner:number,token:unknown,title:unknown,at:unknown):Promise<{size:number;decode:boolean}> {
+ const j=get(owner,token)
+ return control(j,async()=>{
+ if(j.cancelled||j.output)throw new Error('Audio upload is busy')
+ if(typeof title!=='string'||!title.trim()||title.length>200||typeof at!=='number'||!Number.isFinite(at)||!uploadDayAllowed(at)||at<new Date(1900,0,1).getTime()||at>new Date(10000,0,1).getTime()-86400000)throw new Error('Invalid audio details')
+ if(d.recording()){tell(j,{phase:'error',error:'busy'});return{size:j.file.size,decode:false}}
+ j.title=title.replace(/\s+/g,' ').trim();j.at=at
+ if(!j.id){const id=j.file.token;d.store.createMeeting({title:j.title,titleSource:'user',source:'audio-file',startedAt:at,endedAt:null,eventId:null,app:null,attendees:[],state:'stopped',transcriptionPending:true},id);j.id=id}
+ d.store.updateMeeting(j.id,{title:j.title,startedAt:at,transcriptionPending:true,transcriptionState:'preparing'});d.changed()
+ await mkdir(j.dir,{recursive:true});j.output=await open(join(j.dir,'audio.wav'),'w');await writeAll(j.output,wavBytes(new Float32Array(0)),0)
+ j.writing=Promise.resolve();j.samples=0;if(!j.cancelled)tell(j,{phase:'preparing',fraction:0});return{size:j.file.size,decode:true}
+ })
+ },
+ async read(owner:number,token:unknown,offset:unknown,length:unknown):Promise<Uint8Array> {
+ const j=get(owner,token)
+ await waitForRecording(j)
+ if(j.cancelled||typeof offset!=='number'||typeof length!=='number'||!Number.isSafeInteger(offset)||!Number.isSafeInteger(length)||offset<0||length<1||length>1024**2||offset+length>j.file.size)throw new Error('Invalid audio read')
+ const b=Buffer.alloc(length),{bytesRead}=await j.input.read(b,0,length,offset)
+ if(bytesRead!==length)throw new Error('Audio file changed');return b
+ },
+ async write(owner:number,token:unknown,samples:unknown,fraction:unknown) {
+ const j=get(owner,token)
+ await waitForRecording(j)
+ if(j.cancelled||!j.output||!(samples instanceof Float32Array)||samples.length>65536||typeof fraction!=='number'||!Number.isFinite(fraction)||fraction<0||fraction>1||samples.some(x=>!Number.isFinite(x)))throw new Error('Invalid audio samples')
+ if(j.samples+samples.length>16000*60*60*24)throw new Error('Audio exceeds 24 hours')
+ const bytes=wavBytes(samples).subarray(44),offset=44+j.samples*2;j.samples+=samples.length
+ j.writing=j.writing.then(async()=>{if(j.cancelled)throw new Error('Cancelled');await writeAll(j.output!,bytes,offset)})
+ await j.writing
+ if(!j.cancelled)tell(j,{phase:'preparing',fraction})
+ },
+ async finish(owner:number,token:unknown) {
+ const j=get(owner,token)
+ return control(j,async()=>{
+ if(j.cancelled||!j.output||!j.samples||j.at==null||!j.title)throw new Error('Incomplete audio')
+ await j.writing
+ const stat=await j.input.stat();if(stat.size!==j.file.size||stat.mtimeMs!==j.modified)throw new Error('Audio file changed')
+ const header=wavBytes(new Float32Array(0));header.writeUInt32LE(36+j.samples*2,4);header.writeUInt32LE(j.samples*2,40)
+ await writeAll(j.output,header,0);await j.output.sync();await j.output.close();j.output=undefined
+ if(j.cancelled)return
+ const id=j.file.token,durationMs=j.samples/16,startedAt=d.store.meeting(id)?.startedAt??j.at,folder=join(d.root,id)
+ await mkdir(folder,{recursive:true});await rename(join(j.dir,'audio.wav'),join(folder,'them.wav'))
+ j.id=id;j.durable=true;d.store.updateMeeting(id,{durationMs,endedAt:startedAt+durationMs});if(!j.cancelled){d.prepared(id);tell(j,{phase:'done',meetingId:id})}await cleanup(j)
+ })
+ },
+ async failed(owner:number,token:unknown,error:unknown) {
+ const j=get(owner,token);if(j.cancelled)return
+ await j.writing.catch(()=>{});await j.output?.close().catch(()=>{});j.output=undefined
+ tell(j,{phase:'error',error:error==='format'?'format':'read'})
+ },
+ async cancel(owner:number,token:unknown) {
+ const j=get(owner,token);if(j.status?.phase==='done')return
+ j.cancelled=true;j.wake?.();tell(j,{phase:'cancelling'})
+ await j.operation?.catch(()=>{});await j.writing.catch(()=>{})
+ if(j.id){d.store.updateMeeting(j.id,{transcriptionPending:!!j.durable,transcriptionState:j.durable?'stopped':'error'});d.changed()}
+ await cleanup(j);jobs.delete(j.file.token)
+ },
+ resume(){for(const j of jobs.values()){if(!d.recording())j.wake?.()}},
+ preparing:(id:string)=>[...jobs.values()].find(j=>j.id===id&&j.status?.phase!=='done'),
+ owns:(id:string)=>[...jobs.values()].some(j=>j.id===id&&j.status?.phase!=='done'),
+ tokens:(owner:number)=>[...jobs.values()].filter(j=>j.owner===owner&&j.status?.phase!=='done').map(j=>j.file.token),
+ }
+}
diff --git a/app/src/main/audioUploadIpc.ts b/app/src/main/audioUploadIpc.ts
new file mode 100644
index 00000000..99065d4b
--- /dev/null
+++ b/app/src/main/audioUploadIpc.ts
@@ -0,0 +1,32 @@
+import { dialog, ipcMain, type BrowserWindow, type IpcMainInvokeEvent } from 'electron'
+import { rm } from 'node:fs/promises'
+import { join } from 'node:path'
+import { t } from '../shared/i18n'
+import { createAudioUploads } from './audioUpload'
+export function hookAudioUploads(d:Omit<Parameters<typeof createAudioUploads>[0],'send'>&{window:()=>BrowserWindow|null|undefined; exiting:()=>boolean}) {
+ const uploads=createAudioUploads({...d,send:(owner,token,status)=>{const win=d.window();if(win?.webContents.id===owner)win.webContents.send('audio-upload:status',token,status)}})
+ d.store.interruptAudioPreparations()
+ const cleaned=rm(join(d.root,'.uploads'),{recursive:true,force:true})
+ const watched=new Map<number,number>()
+ const owner=(e:IpcMainInvokeEvent)=>{if(e.sender!==d.window()?.webContents)throw new Error('Audio uploads belong to the main window');return e.sender.id}
+ ipcMain.handle('audio-upload:pick',async e=>{
+ const id=owner(e);await cleaned
+ if(!watched.has(id)){
+ watched.set(id,0)
+ const cancel=()=>{if(d.exiting())return;watched.set(id,(watched.get(id)??0)+1);for(const token of uploads.tokens(id))void uploads.cancel(id,token).catch(error=>console.error('Audio upload cleanup failed',error))}
+ e.sender.on('render-process-gone',cancel);e.sender.once('destroyed',()=>{cancel();watched.delete(id)})
+ e.sender.on('did-start-navigation',(_event,_url,inPlace,mainFrame)=>{if(mainFrame&&!inPlace)cancel()})
+ }
+ const generation=watched.get(id)
+ const result=await dialog.showOpenDialog(d.window()!,{properties:['openFile'],filters:[{name:t('Audio'),extensions:['mp3','m4a','wav']}]})
+ return watched.get(id)!==generation||result.canceled||!result.filePaths[0]?null:uploads.select(id,result.filePaths[0])
+ })
+ ipcMain.handle('audio-upload:info',(e,token)=>uploads.info(owner(e),token))
+ ipcMain.handle('audio-upload:start',(e,token,title,at)=>uploads.start(owner(e),token,title,at))
+ ipcMain.handle('audio-upload:read',(e,token,offset,length)=>uploads.read(owner(e),token,offset,length))
+ ipcMain.handle('audio-upload:write',(e,token,samples,fraction)=>uploads.write(owner(e),token,samples,fraction))
+ ipcMain.handle('audio-upload:finish',(e,token)=>uploads.finish(owner(e),token))
+ ipcMain.handle('audio-upload:failed',(e,token,error)=>uploads.failed(owner(e),token,error))
+ ipcMain.handle('audio-upload:cancel',(e,token)=>uploads.cancel(owner(e),token))
+ return uploads
+}
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index 33afd10a..22e5c081 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -1,3 +1,7 @@
+import { createSavedTranscriptions } from './savedTranscription'
+import { transcriptionBusy } from '../shared/transcription'
+import { hookAudioUploads } from './audioUploadIpc'
+import { uploadedAudio } from './audioUpload'
import { hookRendererErrors } from './rendererErrors'
import { matchSearchPeople, searchPersonKey } from '../shared/searchPeople'
import { resolvePeople } from './people'
@@ -564,6 +568,11 @@ app.whenReady().then(() => {
ui: () => localeOf(loadSettings(join(userDataDir(), 'settings.json')), systemLocale()), last: () => store.lastLanguage(),
...(isFake() ? { locales: async () => ({ available: true, supported: ['en-US', 'es-ES'], installed: ['en-US'] }), install: async () => true } : {}),
} })
+ ipcMain.handle('transcript:draft',(e,id:unknown)=>{
+ if(e.sender!==win?.webContents||!isId(id)||!store.meeting(id)?.transcriptionAgain)return []
+ const order=store.speakerOrder(id)
+ return store.transcriptionDraft(id).map((s,i)=>({...s,id:-i-1,speakerColor:speakerColor(s.track,s.speaker,order)}))
+ })
ipcMain.handle('transcript:get', (_e, id: unknown, o: unknown) => {
if (!isId(id)) return []
const order = store.speakerOrder(id)
@@ -641,13 +650,52 @@ app.whenReady().then(() => {
// the notes are written: the meeting goes into the library for chat across meetings
changed: () => { win?.webContents.send('meetings:changed'); void indexer.schedule() },
})
+ let finishing = false, discardUnsaved = false
+ const savedTranscriptions = createSavedTranscriptions({
+ store, ready: () => !!setup.installed()?.asr, recording: () => !!activeMeeting() || !!resumingId || finishing,
+ tracks: async id => {
+ await recordingSettled(id)
+ const tracks: Partial<Record<'me'|'them',AsyncIterable<Float32Array>>> = {}
+ for(const track of ['me','them'] as const) {
+ const file=trackFile(meetingDir(id),track,audioKinds)
+ if(file?.endsWith('.wav'))tracks[track]=uploadedAudio(file)
+ else if(file)tracks[track]=helperDecode(audioHelperPath(),file)
+ }
+ return tracks
+ },
+ transcribe: (id,tracks,options) => transcribeRecorded(id,tracks,undefined,options),
+ draft:id=>win?.webContents.send('transcript:draft',id),
+ changed: (id,replaced) => {win?.webContents.send('meetings:changed');if(replaced){win?.webContents.send('transcript:replaced',id);void indexer.schedule()}},
+ summarize: id => {void notes.writeAgain(id)},
+ })
+ const uploads = hookAudioUploads({
+ root: join(userDataDir(), 'meetings'), store, window: () => win, exiting: () => allowQuit,
+ recording: () => !!activeMeeting() || !!resumingId || finishing,
+ prepared: id => {void savedTranscriptions.start(id)}, changed: () => win?.webContents.send('meetings:changed'),
+ })
+ setup.onState(() => {uploads.resume();savedTranscriptions.resume()})
+ onMeetingStart(m => {store.clearTranscriptionState(m.id);savedTranscriptions.pause()})
+ onMeetingStopSaved(() => {uploads.resume();savedTranscriptions.resume()})
+ ipcMain.handle('transcript:run', (e,id:unknown,again:unknown) => {
+ if(e.sender!==win?.webContents||!isId(id)||typeof again!=='boolean')return false
+ const meeting=store.meeting(id)
+ if(!meeting||stopSavePending(id)||transcriptionBusy(meeting.transcriptionState))return false
+ return savedTranscriptions.start(id,again)
+ })
+ ipcMain.handle('transcript:stop', async (e,id:unknown) => {
+ if(e.sender!==win?.webContents||!isId(id))return
+ const preparing=uploads.preparing(id)
+ if(preparing){await uploads.cancel(preparing.owner,preparing.file.token);return}
+ savedTranscriptions.stop(id)
+ })
ipcMain.handle('meetings:resume', async (_e, id: unknown): Promise<StartResult> => {
if (!isId(id)) return { error: 'gone' }
const current = activeMeeting()
if (current) { goTo(`/note/${current.id}`); return { id: current.id } }
const existing = store.meeting(id)
- if (!existing || existing.trashedAt != null || (existing.state !== 'stopped' && existing.state !== 'done')) return { error: 'gone' }
- if (resumingId || stopSavePending(id) || finishing || !notes.retryDrafts(id)) return { error: 'failed' }
+ // shortcut: imports keep one WAV; add a safe native-recording merge before offering Resume.
+ if (!existing || existing.source === 'audio-file' || uploads.owns(id) || existing.trashedAt != null || (existing.state !== 'stopped' && existing.state !== 'done')) return { error: 'gone' }
+ if (transcriptionBusy(existing.transcriptionState) || resumingId || stopSavePending(id) || finishing || !notes.retryDrafts(id)) return { error: 'failed' }
resumingId = id
const analysis = notes.suspendForResume(id)
let started = false, timer: NodeJS.Timeout | undefined
@@ -767,7 +815,7 @@ app.whenReady().then(() => {
ipcMain.handle('notes:stop', (_e, id: unknown) => { if (known(id)) return notes.stop(id) })
ipcMain.handle('notes:write-again', (_e, id: unknown, note: unknown) => {
const instruction = rewriteNote(note)
- if (known(id) && instruction !== undefined) void notes.writeAgain(id, instruction)
+ if (known(id) && instruction !== undefined && !transcriptionBusy(store.meeting(id)?.transcriptionState)) void notes.writeAgain(id, instruction, true)
})
app.on('will-quit', () => engine.dispose())
// an earlier quit or crash may have left parts unjoined: try again now
@@ -783,31 +831,7 @@ app.whenReady().then(() => {
setup.onState(catchUp)
// meetings recorded before the speech model was in (#30): transcribed from their saved recording once it is, one at
// a time and never while recording (a new recording pauses it; it carries on after)
- const ownAudio = isFake() ? '.wav' : process.platform === 'darwin' ? '.m4a' : '.ogg'
- let backfilling = false
- const transcribeWaiting = async () => {
- if (backfilling || !setup.installed()?.asr || activeMeeting()) return
- backfilling = true
- try {
- await rejoined.catch(() => {})
- for (const m of store.untranscribedMeetings()) {
- if (activeMeeting()) break
- // the recorder may still be closing its files (the model came in during this very meeting)
- await recordingSettled(m.id)
- const tracks: Partial<Record<'me' | 'them', AsyncIterable<Float32Array>>> = {}
- for (const t of ['me', 'them'] as const) {
- const file = trackFile(meetingDir(m.id), t, audioKinds)
- if (file?.endsWith(ownAudio)) tracks[t] = isFake() ? wavDecode(file) : helperDecode(audioHelperPath(), file)
- }
- if (!Object.keys(tracks).length) continue
- console.info('ASR', `transcribing ${m.id} from its recording: it has no transcript yet`)
- const done = await transcribeRecorded(m.id, tracks, () => !!activeMeeting())
- win?.webContents.send('meetings:changed'); win?.webContents.send('transcript:speakers', m.id)
- // notes that came out empty (no transcript then) are written now
- if (done && !store.notes(m.id).enhanced?.trim()) void notes.writeAgain(m.id)
- }
- } catch (e) { console.error('transcribing waiting meetings failed', e) } finally { backfilling = false }
- }
+ const transcribeWaiting = async () => {await rejoined.catch(()=>{});await savedTranscriptions.pump()}
setup.onState(() => void transcribeWaiting())
// at launch too, when the model is already in and setup has nothing new to say
void transcribeWaiting()
@@ -833,9 +857,9 @@ app.whenReady().then(() => {
})
}
// Flush the last keystroke and retained drafts before the existing recording/transcription shutdown.
- let finishing = false, discardUnsaved = false
const resumeEditing = () => {
finishing = false; allowQuit = false; discardUnsaved = false
+ uploads.resume(); savedTranscriptions.resume()
win?.webContents.send('notes:flush-request', null)
}
app.on('browser-window-created', (_e, window) => {
@@ -851,6 +875,7 @@ app.whenReady().then(() => {
e.preventDefault()
if (finishing) return
finishing = true
+ savedTranscriptions.shutdown()
void (async () => {
const flushed = await flushRenderer()
const saved = notes.retryDrafts()
@@ -996,7 +1021,7 @@ app.whenReady().then(() => {
const events = (await eventsOn(at)).map((event) => {
const meeting = eventIds(event).map((id) => store.meetingForEvent(id)).find(Boolean)
const note = meeting && withStopState(meeting)
- return { ...event, attendees: resolvePeople(store.db, event.attendees), ...(note ? { note: { id: note.id, state: note.state } } : {}) }
+ return { ...event, attendees: resolvePeople(store.db, event.attendees), ...(note ? { note: { id: note.id, state: note.state, ...(note.source ? { source: note.source } : {}) } } : {}) }
})
return { status: calendarStatus(), events }
})
diff --git a/app/src/main/library/chunks.ts b/app/src/main/library/chunks.ts
index 9afb6f75..74f65869 100644
--- a/app/src/main/library/chunks.ts
+++ b/app/src/main/library/chunks.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from '../../shared/audioUpload'
import type { Segment } from '../store'
import { transcriptText } from '../notes/enhance'
@@ -10,7 +11,7 @@ export const CHUNK_WORDS = 300
export type Chunk = { startMs: number; endMs: number; text: string; speakers: string[] }
-const who = (s: Segment) => (s.track === 'me' ? 'You' : s.speaker || 'Them')
+const who = (s: Segment) => (s.speaker === AUDIO_SPEAKER ? 'Audio' : s.track === 'me' ? 'You' : s.speaker || 'Them')
const count = (s: string) => s.split(/\s+/).filter(Boolean).length
/** segments: the meeting's visible lines, in order (hidden echo lines are left out by the store) */
@@ -30,6 +31,6 @@ export function chunkTranscript(segments: Segment[]): Chunk[] {
if (last && size + n <= CHUNK_WORDS) { last.push(...u); size += n } else { chunks.push([...u]); size = n }
}
return chunks.map((c) => ({
- startMs: c[0].startMs, endMs: Math.max(...c.map((s) => s.endMs)), text: transcriptText(c), speakers: [...new Set(c.map(who))],
+ startMs: c[0].startMs, endMs: Math.max(...c.map((s) => s.endMs)), text: transcriptText(c), speakers: [...new Set(c.filter(s => s.speaker !== AUDIO_SPEAKER).map(who))],
}))
}
diff --git a/app/src/main/mcp/server.ts b/app/src/main/mcp/server.ts
index f3ca34e1..85f8b278 100644
--- a/app/src/main/mcp/server.ts
+++ b/app/src/main/mcp/server.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from '../../shared/audioUpload'
import type { Meeting, Store } from '../store'
/**
@@ -66,7 +67,7 @@ export function createMcp(d: McpDeps): Mcp {
if (!m || m.trashedAt != null) throw new Refusal(`No meeting with id ${JSON.stringify(v ?? null)}. list_meetings or search gives the ids.`)
return m
}
- const who = (speaker: string | null, track: Track) => (track === 'me' || speaker === 'me' ? d.me() || 'You' : speaker || 'Them')
+ const who = (speaker: string | null, track: Track) => (speaker === AUDIO_SPEAKER ? 'Audio' : track === 'me' || speaker === 'me' ? d.me() || 'You' : speaker || 'Them')
const tools: Record<string, (a: Record<string, unknown>) => Promise<string>> = {
async list_meetings(a) {
diff --git a/app/src/main/notes/enhance.ts b/app/src/main/notes/enhance.ts
index 4b76e56d..9b24f24b 100644
--- a/app/src/main/notes/enhance.ts
+++ b/app/src/main/notes/enhance.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from '../../shared/audioUpload'
import { REWRITE_NOTE_MAX } from '../../shared/rewriteNote'
import type { Person, Segment } from '../store'
import { LOCALES } from '../../shared/i18n'
@@ -43,7 +44,7 @@ export function languageName(code: string | null | undefined): string {
/** "You: …" for the mic, "<Name>: …" for the other side when the call app showed who talked, "Them: …" otherwise */
export function transcriptText(segments: Segment[]): string {
- const who = (s: Segment) => (s.track === 'me' ? 'You' : s.speaker || 'Them')
+ const who = (s: Segment) => (s.speaker === AUDIO_SPEAKER ? 'Audio' : s.track === 'me' ? 'You' : s.speaker || 'Them')
const turns: Array<{ who: string; text: string }> = []
for (const s of segments) {
const w = who(s)
@@ -74,10 +75,10 @@ type PromptInput = {
* after it. The model reads this during the meeting (readAhead.ts), so after it only the rest is new: never change it
* for one meeting, and put anything new after the transcript.
*/
-export const transcriptHead = 'Here is the transcript of a meeting. Each line starts with who said it: "You" is the person who recorded it, a name is someone on the call, and "Them" is the other side of the call when no name is known. What to do with it comes after it.\n<transcript>\n'
+export const transcriptHead = 'Here is the transcript of a meeting. Each line starts with who said it: "You" is the person who recorded it, a name is someone on the call, and "Them" is the other side of the call when no name is known. \"Audio\" is an uploaded recording with no identified speakers. What to do with it comes after it.\n<transcript>\n'
/** the rule about people, for the notes and for answers about a meeting */
-export const peopleRule = '- People: use their names when known, and "You" for the person these notes are for. "Them" is not a name: write who they are in plain words ("the client", "the other person"), or leave out who said it. Never make up a name.'
+export const peopleRule = '- People: use their names when known, and "You" for the person these notes are for. "Them" is not a name: write who they are in plain words ("the client", "the other person"), or leave out who said it. \"Audio\" labels an unidentified recording, not a person. Never make up a name.'
/** the one other person invited, when there is exactly one: "Them" is then that person */
function onlyOther(attendees: Person[], me = ''): string | undefined {
diff --git a/app/src/main/notes/index.ts b/app/src/main/notes/index.ts
index 8cf84d69..3329f8ed 100644
--- a/app/src/main/notes/index.ts
+++ b/app/src/main/notes/index.ts
@@ -222,7 +222,9 @@ export function hookNotes(p: {
p.send(view(m.id))
}
- const queueWrite = (id: string, note?: string) => {
+ const queueWrite = (id: string, note?: string, allowPartial = false) => {
+ const meeting = p.store.meeting(id)
+ if (meeting?.transcriptionPending && (meeting.transcriptionState || meeting.source==='audio-file') && !allowPartial) return Promise.resolve()
console.info('NOTES', `queued the notes of ${id}`)
stopped.delete(id)
set(id, 'waiting')
@@ -319,14 +321,14 @@ export function hookNotes(p: {
pendingDraftId: () => [...edits].find(([, sides]) => Object.values(sides).some((v) => v.text !== undefined))?.[0],
forgetDrafts: (id: string) => { edits.delete(id) },
/** "Write again": the same job, now (after anything already waiting) */
- async writeAgain(id: string, note?: string) {
+ async writeAgain(id: string, note?: string, allowPartial = false) {
const pending = stopping.get(id)
if (pending) await pending
if (resuming.has(id) || p.store.meeting(id)?.state === 'recording') return Promise.resolve()
if (!retryDrafts(id)) return Promise.resolve()
const s = live.get(id)?.status
if (s === 'waiting' || s === 'writing') return Promise.resolve()
- return queueWrite(id, note)
+ return queueWrite(id, note, allowPartial)
},
/** at launch: meetings a quit or crash left without notes get them now, one at a time */
recover() {
diff --git a/app/src/main/savedTranscription.ts b/app/src/main/savedTranscription.ts
new file mode 100644
index 00000000..0b0e3a8e
--- /dev/null
+++ b/app/src/main/savedTranscription.ts
@@ -0,0 +1,72 @@
+import type { Store } from './store'
+import type { Track } from './capture'
+import type { RecordedOptions } from './asr'
+import type { TranscriptionState } from '../shared/transcription'
+
+/** One queue for uploaded audio and saved recordings. Stopping never deletes either. */
+export function createSavedTranscriptions(d: {
+ store: Store; ready: () => boolean; recording: () => boolean
+ tracks: (id: string) => Promise<Partial<Record<Track,AsyncIterable<Float32Array>>>>
+ transcribe: (id: string, tracks: Partial<Record<Track,AsyncIterable<Float32Array>>>, options: RecordedOptions) => Promise<boolean>
+ draft?: (id:string) => void
+ changed: (id: string,replaced?:boolean) => void; summarize: (id: string) => void
+}) {
+ let running: { id:string; abort:AbortController; stopped:boolean } | undefined
+ let draining=false, quitting=false
+ const set=(id:string,state:TranscriptionState)=>{if(d.store.meeting(id)){d.store.updateMeeting(id,{transcriptionState:state});d.changed(id)}}
+ const stopped=(id:string)=>{if(d.store.meeting(id)?.transcriptionAgain){d.store.cancelTranscriptionReplacement(id);d.draft?.(id);d.changed(id)}else set(id,'stopped')}
+ const pump=async()=>{
+ if(draining||quitting)return
+ draining=true
+ try {
+ for(const meeting of d.store.untranscribedMeetings()) {
+ if(quitting)break
+ const id=meeting.id
+ const current=d.store.meeting(id)
+ if(!current||current.trashedAt!=null||['stopped','error','preparing','done'].includes(current.transcriptionState??''))continue
+ if(d.recording()){set(id,'waiting-recording');continue}
+ if(!d.ready()){set(id,'waiting-model');continue}
+ const job={id,abort:new AbortController(),stopped:false};running=job;set(id,'transcribing')
+ try {
+ const tracks=await d.tracks(id)
+ if(!Object.keys(tracks).length)throw new Error('No saved audio')
+ const segments=meeting.transcriptionAgain?d.store.transcriptionDraft(id):d.store.segments(id,{hidden:true})
+ const fromMs:Partial<Record<Track,number>>={}
+ for(const segment of segments)fromMs[segment.track]=Math.max(fromMs[segment.track]??0,segment.endMs)
+ const complete=await d.transcribe(id,tracks,{signal:job.abort.signal,fromMs,...(meeting.transcriptionAgain?{save:segs=>{d.store.addTranscriptionDraft(id,segs);d.draft?.(id)}}:{})})
+ if(!d.store.meeting(id)||d.store.meeting(id)?.trashedAt!=null)continue
+ if(job.abort.signal.aborted){if(job.stopped)stopped(id);else set(id,d.recording()?'waiting-recording':'queued');continue}
+ if(!complete)throw new Error('Saved transcription incomplete')
+ if(meeting.transcriptionAgain&&!d.store.transcriptionDraft(id).some(line=>!line.hidden&&line.text.trim())){d.store.cancelTranscriptionReplacement(id);d.changed(id);continue}
+ if(meeting.transcriptionAgain)d.store.commitTranscriptionDraft(id)
+ else d.store.updateMeeting(id,{transcriptionPending:false,transcriptionState:'done'})
+ d.changed(id,!!meeting.transcriptionAgain)
+ // Replacing a transcript must not overwrite an existing or edited summary.
+ if(!d.store.notes(id).enhanced?.trim())d.summarize(id)
+ } catch(error) {
+ if(d.store.meeting(id)){if(job.stopped)stopped(id);else set(id,job.abort.signal.aborted?'queued':'error')}
+ if(!job.abort.signal.aborted)console.error('Saved transcription failed',id,error)
+ } finally { if(running===job)running=undefined }
+ }
+ } finally {draining=false;if(!quitting&&!d.recording()&&d.ready()&&d.store.untranscribedMeetings().some(m=>m.transcriptionState==='queued'))queueMicrotask(()=>void pump())}
+ }
+ return {
+ async start(id:string,again=false) {
+ const meeting=d.store.meeting(id)
+ if(!meeting||meeting.trashedAt!=null||meeting.state==='recording'||running?.id===id)return false
+ if(again)d.store.beginTranscriptionReplacement(id)
+ d.store.updateMeeting(id,{transcriptionPending:true,transcriptionState:'queued'});d.changed(id);void pump();return true
+ },
+ stop(id:string) {
+ const meeting=d.store.meeting(id)
+ if(!meeting||!meeting.transcriptionPending||meeting.state==='recording')return
+ if(running?.id===id){running.stopped=true;running.abort.abort();return}
+ stopped(id)
+ },
+ pause(){running?.abort.abort()},
+ shutdown(){quitting=true;running?.abort.abort()},
+ resume(){quitting=false;void pump()},
+ pump,
+ owns:(id:string)=>running?.id===id,
+ }
+}
diff --git a/app/src/main/store.ts b/app/src/main/store.ts
index 7e638a2b..253bb5a3 100644
--- a/app/src/main/store.ts
+++ b/app/src/main/store.ts
@@ -1,3 +1,4 @@
+import type { TranscriptionState } from '../shared/transcription'
import { eventIds, type CalEvent } from './calendar'
import { matchSearchPeople, searchPersonKey, uniqueSearchPeople } from '../shared/searchPeople'
import { oneEdit, parseSearchQuery, type SearchOptions } from '../shared/searchQuery'
@@ -38,6 +39,8 @@ export type Meeting = {
durationMs?: number
/** Some recorded audio still needs a saved transcript, including earlier sessions. */
transcriptionPending?: boolean
+ transcriptionState?: TranscriptionState
+ transcriptionAgain?: boolean
/** when it was moved to the Trash; there it is out of every list, search and chat until restored */
trashedAt?: number
}
@@ -52,6 +55,8 @@ export type Segment = { id: number; meetingId: string; track: 'me' | 'them'; sta
export type Notes = { mine: string; enhanced: string | null; edited: boolean }
const toMeeting = (r: Row): Meeting => ({
+ ...(r.transcription_state ? { transcriptionState: r.transcription_state as TranscriptionState } : {}),
+ ...(r.transcription_again ? { transcriptionAgain: true } : {}),
...(r.transcription_pending ? { transcriptionPending: true } : {}),
id: String(r.id), title: String(r.title), startedAt: Number(r.started_at), endedAt: r.ended_at == null ? null : Number(r.ended_at),
eventId: r.event_id == null ? null : String(r.event_id), app: r.app == null ? null : String(r.app),
@@ -214,6 +219,10 @@ export class Store {
if (!meetingCols.includes(name)) this.db.exec(`ALTER TABLE meetings ADD COLUMN ${name} ${type}`)
}
if (!meetingCols.includes('event_started_at')) this.db.exec('ALTER TABLE meetings ADD COLUMN event_started_at INTEGER')
+ if (!meetingCols.includes('transcription_state')) this.db.exec('ALTER TABLE meetings ADD COLUMN transcription_state TEXT')
+ if (!meetingCols.includes('transcription_was_pending')) this.db.exec('ALTER TABLE meetings ADD COLUMN transcription_was_pending INTEGER NOT NULL DEFAULT 0')
+ if (!meetingCols.includes('transcription_again')) this.db.exec('ALTER TABLE meetings ADD COLUMN transcription_again INTEGER NOT NULL DEFAULT 0')
+ this.db.exec('CREATE TABLE IF NOT EXISTS transcription_drafts (meeting_id TEXT NOT NULL REFERENCES meetings(id) ON DELETE CASCADE, payload TEXT NOT NULL)')
if (!meetingCols.includes('transcription_pending')) this.db.exec('ALTER TABLE meetings ADD COLUMN transcription_pending INTEGER NOT NULL DEFAULT 0')
if (!meetingCols.includes('duration_ms')) this.db.exec('ALTER TABLE meetings ADD COLUMN duration_ms INTEGER')
if (!meetingCols.includes('language')) this.db.exec('ALTER TABLE meetings ADD COLUMN language TEXT')
@@ -302,24 +311,23 @@ export class Store {
}
close() { this.db.close() }
- createMeeting(m: Omit<Meeting, 'id' | 'language' | 'titleSource'> & { language?: string | null; titleSource?: TitleSource }): Meeting {
- const id = randomUUID()
+ createMeeting(m: Omit<Meeting, 'id' | 'language' | 'titleSource'> & { language?: string | null; titleSource?: TitleSource }, id: string = randomUUID()): Meeting {
const language = m.language ?? null
const ownEmail = m.eventId ? ownAddress(m.ownEmail) : null
this.rememberOwnEmail(ownEmail)
const titleSource = m.titleSource ?? sourceOf(m.title, m.eventId)
- this.db.prepare('INSERT INTO meetings (id, title, started_at, ended_at, event_id, app, attendees, state, language, title_source, duration_ms, event_started_at, event_ended_at, event_title, event_calendar_name, event_calendar_source, own_email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
- .run(id, m.title, m.startedAt, m.endedAt, m.eventId, m.app, JSON.stringify(m.attendees), m.state, language, titleSource, m.durationMs ?? null, m.eventStartedAt ?? null, m.eventEndedAt ?? null, m.eventTitle ?? null, m.eventCalendarName ?? null, m.eventCalendarSource ?? null, ownEmail)
+ this.db.prepare('INSERT INTO meetings (id, title, started_at, ended_at, event_id, app, attendees, state, language, title_source, duration_ms, event_started_at, event_ended_at, event_title, event_calendar_name, event_calendar_source, source, transcription_pending, own_email) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)')
+ .run(id, m.title, m.startedAt, m.endedAt, m.eventId, m.app, JSON.stringify(m.attendees), m.state, language, titleSource, m.durationMs ?? null, m.eventStartedAt ?? null, m.eventEndedAt ?? null, m.eventTitle ?? null, m.eventCalendarName ?? null, m.eventCalendarSource ?? null, m.source ?? null, Number(!!m.transcriptionPending), ownEmail)
rememberPeople(this.db, m.attendees)
return this.meeting(id)!
}
updateMeeting(id: string, patch: Partial<Omit<Meeting, 'id'>>) {
if (patch.ownEmail) this.rememberOwnEmail(patch.ownEmail)
if (patch.attendees) rememberPeople(this.db, patch.attendees)
- const col: Record<string, string> = { title: 'title', startedAt: 'started_at', endedAt: 'ended_at', eventId: 'event_id', eventStartedAt: 'event_started_at', eventEndedAt: 'event_ended_at', eventTitle: 'event_title', eventCalendarName: 'event_calendar_name', eventCalendarSource: 'event_calendar_source', ownEmail: 'own_email', app: 'app', attendees: 'attendees', state: 'state', language: 'language', titleSource: 'title_source', durationMs: 'duration_ms', transcriptionPending: 'transcription_pending' }
+ const col: Record<string, string> = { title: 'title', startedAt: 'started_at', endedAt: 'ended_at', eventId: 'event_id', eventStartedAt: 'event_started_at', eventEndedAt: 'event_ended_at', eventTitle: 'event_title', eventCalendarName: 'event_calendar_name', eventCalendarSource: 'event_calendar_source', ownEmail: 'own_email', app: 'app', attendees: 'attendees', state: 'state', language: 'language', titleSource: 'title_source', durationMs: 'duration_ms', transcriptionPending: 'transcription_pending', transcriptionState: 'transcription_state', transcriptionAgain: 'transcription_again' }
const keys = Object.keys(patch).filter((k) => k in col && (patch as Row)[k] !== undefined)
if (!keys.length) return
- const vals = keys.map((k) => (k === 'attendees' ? JSON.stringify(patch.attendees) : k === 'transcriptionPending' ? Number(patch.transcriptionPending) : (patch as Row)[k]) as string | number | null)
+ const vals = keys.map((k) => (k === 'attendees' ? JSON.stringify(patch.attendees) : (k === 'transcriptionPending' || k === 'transcriptionAgain') ? Number(k === 'transcriptionPending' ? patch.transcriptionPending : patch.transcriptionAgain) : (patch as Row)[k]) as string | number | null)
this.db.prepare(`UPDATE meetings SET ${keys.map((k) => `${col[k]} = ?`).join(', ')} WHERE id = ?`).run(...vals, id)
}
/** Refresh every note still linked to this occurrence, including alternate calendar IDs. */
@@ -385,6 +393,46 @@ export class Store {
return (rows as Row[]).map(r => this.readMeeting(r))
}
+ clearTranscriptionState(id:string) { this.db.prepare('UPDATE meetings SET transcription_state=NULL,transcription_again=0 WHERE id=?').run(id);this.clearTranscriptionDraft(id) }
+ interruptAudioPreparations() {
+ this.db.prepare("UPDATE meetings SET transcription_state='error',transcription_pending=0 WHERE source='audio-file' AND transcription_state='preparing'").run()
+ }
+ beginTranscriptionReplacement(id:string) {
+ this.clearTranscriptionDraft(id)
+ this.db.prepare('UPDATE meetings SET transcription_was_pending=CASE WHEN transcription_again=1 THEN transcription_was_pending ELSE transcription_pending END, transcription_again=1 WHERE id=?').run(id)
+ }
+ cancelTranscriptionReplacement(id:string) {
+ this.db.exec('BEGIN')
+ try {
+ this.clearTranscriptionDraft(id)
+ this.db.prepare("UPDATE meetings SET transcription_pending=transcription_was_pending,transcription_state=CASE WHEN transcription_was_pending=1 THEN 'stopped' ELSE 'done' END,transcription_again=0,transcription_was_pending=0 WHERE id=?").run(id)
+ this.db.exec('COMMIT')
+ } catch(error) {this.db.exec('ROLLBACK');throw error}
+ }
+ transcriptionDraft(id: string): Omit<Segment,'id'>[] {
+ return this.db.prepare('SELECT payload FROM transcription_drafts WHERE meeting_id = ? ORDER BY rowid').all(id).flatMap(row => JSON.parse(String(row.payload)))
+ }
+ addTranscriptionDraft(id: string, segments: Omit<Segment,'id'>[]) {
+ this.db.prepare('INSERT INTO transcription_drafts (meeting_id,payload) VALUES (?,?)').run(id,JSON.stringify(segments))
+ }
+ clearTranscriptionDraft(id: string) { this.db.prepare('DELETE FROM transcription_drafts WHERE meeting_id = ?').run(id) }
+ commitTranscriptionDraft(id: string) {
+ const segments = this.transcriptionDraft(id)
+ this.db.exec('BEGIN')
+ try {
+ this.db.prepare('DELETE FROM segments WHERE meeting_id = ?').run(id)
+ const insert = this.db.prepare('INSERT INTO segments (meeting_id,track,start_ms,end_ms,text,speaker,hidden,echo_confident) VALUES (?,?,?,?,?,?,?,?)')
+ for (const s of segments) {
+ const result=insert.run(id,s.track,s.startMs,s.endMs,s.text,s.speaker,s.hidden?1:0,s.echoConfident?1:0)
+ if(s.hidden)this.db.prepare("INSERT INTO segments_fts(segments_fts,rowid,text) VALUES ('delete',?,?)").run(result.lastInsertRowid,s.text)
+ }
+ this.clearTranscriptionDraft(id)
+ // A replacement can keep the same line count, text length and timestamps.
+ this.db.prepare("UPDATE library_sources SET signature='' WHERE meeting_id=?").run(id)
+ this.updateMeeting(id,{transcriptionAgain:false,transcriptionPending:false,transcriptionState:'done'})
+ this.db.exec('COMMIT')
+ } catch(error) { this.db.exec('ROLLBACK'); throw error }
+ }
addSegments(segs: Omit<Segment, 'id'>[]) {
const ins = this.db.prepare('INSERT INTO segments (meeting_id, track, start_ms, end_ms, text, speaker, hidden, echo_confident) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')
this.db.exec('BEGIN')
@@ -498,13 +546,10 @@ export class Store {
this.db.prepare('UPDATE notes SET written_with = ? WHERE meeting_id = ?').run(people, meetingId)
}
- /**
- * Finished meetings (stopped, or done once their notes were written) still waiting for their transcript with not one line of it: recorded before the speech model was in
- * (#30), oldest first. One with some lines (whisper fell over partway) is left alone, so no line is transcribed twice.
- */
+ /** Resume managed jobs; legacy partial recordings wait for an explicit Continue. */
untranscribedMeetings(): Meeting[] {
return (this.db.prepare(`SELECT * FROM meetings m WHERE state IN ('stopped', 'done') AND trashed_at IS NULL AND transcription_pending = 1
- AND NOT EXISTS (SELECT 1 FROM segments s WHERE s.meeting_id = m.id) ORDER BY started_at`).all() as Row[]).map(r => this.readMeeting(r))
+ AND (transcription_state IS NULL OR transcription_state NOT IN ('stopped','error','preparing')) AND (transcription_state IS NOT NULL OR source='audio-file' OR NOT EXISTS (SELECT 1 FROM segments s WHERE s.meeting_id=m.id)) ORDER BY started_at`).all() as Row[]).map(r => this.readMeeting(r))
}
/** Stopped meetings with no enhanced notes: a quit or crash came before they were written */
diff --git a/app/src/preload/audioUpload/decode.ts b/app/src/preload/audioUpload/decode.ts
new file mode 100644
index 00000000..11c879ce
--- /dev/null
+++ b/app/src/preload/audioUpload/decode.ts
@@ -0,0 +1,93 @@
+import { AudioReader, AudioFileError, fail, text, view, type AudioSource } from './read'
+import { AudioResampler } from './resample'
+import { mp3 } from './mp3'
+import { m4a } from './m4a'
+export type AudioSink = (samples: Float32Array, fraction: number) => Promise<void>
+export async function wavInfo(reader: AudioReader) {
+ let at=12,format:Uint8Array|undefined,dataAt=0,size=0
+ while(at+8<=reader.source.size){
+ const h=await reader.read(at,8),n=view(h).getUint32(4,true),kind=text(h,0,4)
+ if(at+8+n>reader.source.size)fail()
+ if(kind==='fmt '){if(n<16||n>128)fail('format');format=(await reader.read(at+8,n)).slice()}
+ if(kind==='data'){if(dataAt)fail('format');dataAt=at+8;size=n}
+ at+=8+n+(n%2)
+ }
+ if(!format||!dataAt||!size)fail()
+ const f=view(format),channels=f.getUint16(2,true),rate=f.getUint32(4,true),align=f.getUint16(12,true),bits=f.getUint16(14,true)
+ let kind=f.getUint16(0,true)
+ if(kind===65534){
+ const guidTail=[0,0,0,0,16,0,128,0,0,170,0,56,155,113]
+ if(format.length<40||f.getUint16(16,true)<22||f.getUint16(18,true)!==bits||guidTail.some((byte,i)=>format![26+i]!==byte))fail('format')
+ kind=f.getUint16(24,true)
+ }
+ if(![1,3].includes(kind)||channels<1||channels>8||![8,16,24,32].includes(bits)||(kind===3&&bits!==32)||align!==channels*bits/8||size%align)fail('format')
+ if(rate<8000||rate>192000)fail('format')
+ return {channels,rate,align,bits,kind,dataAt,size}
+}
+async function wav(reader: AudioReader, sink: AudioSink) {
+ const {channels,rate,align,bits,kind,dataAt,size}=await wavInfo(reader)
+ const resampler=new AudioResampler(rate),bytes=bits/8
+ for(let offset=0;offset<size;){
+ const length=Math.min(size-offset,align*8192),b=await reader.read(dataAt+offset,length),v=view(b),mono=new Float32Array(length/align)
+ for(let i=0;i<mono.length;i++)for(let channel=0;channel<channels;channel++){
+ const j=i*align+channel*bytes
+ const sample=kind===3?v.getFloat32(j,true):bits===8?(b[j]-128)/128:bits===16?v.getInt16(j,true)/32768:bits===24?((b[j]|b[j+1]<<8|b[j+2]<<16)<<8>>8)/8388608:v.getInt32(j,true)/2147483648
+ if(!Number.isFinite(sample))fail()
+ mono[i]+=sample/channels
+ }
+ offset+=length
+ const out=resampler.push(mono)
+ if(out.length)await sink(out,offset/size)
+ }
+ await sink(resampler.push(new Float32Array(0),true),1)
+}
+/** Decode one bounded packet batch at a time using Chromium's built-in codecs. */
+export async function decodeAudioUpload(source: AudioSource, sink: AudioSink, signal: AbortSignal): Promise<void> {
+ const reader=new AudioReader(source,signal),head=await reader.read(0,Math.min(12,source.size))
+ if(text(head,0,4)==='RIFF'&&text(head,8,4)==='WAVE')return wav(reader,sink)
+ const encoded=text(head,4,4)==='ftyp'?await m4a(reader):await mp3(reader)
+ if(typeof AudioDecoder==='undefined'||!(await AudioDecoder.isConfigSupported(encoded.config)).supported)fail('format')
+ let frames:AudioData[]=[],failure:Error|undefined,resampler:AudioResampler|undefined,rate=0,written=false
+ const decoder=new AudioDecoder({output:frame=>frames.push(frame),error:error=>{failure=error}})
+ const abort=()=>{if(decoder.state!=='closed')decoder.close()}
+ signal.addEventListener('abort',abort,{once:true})
+ const flush=async(fraction:number)=>{
+ signal.throwIfAborted();await decoder.flush();if(failure)throw failure
+ // Send bounded PCM batches, not one IPC round trip for each compressed frame.
+ let batch=new Float32Array(65536),used=0
+ const send=async()=>{if(used){await sink(batch.subarray(0,used),fraction);batch=new Float32Array(65536);used=0}}
+ for(const frame of frames){
+ signal.throwIfAborted()
+ if(!resampler){rate=frame.sampleRate;resampler=new AudioResampler(rate)}
+ if(frame.sampleRate!==rate||frame.numberOfChannels<1||frame.numberOfChannels>8||frame.numberOfFrames>16384)fail('format')
+ const start=Math.max(0,Math.ceil(((encoded.trimSeconds??0)-frame.timestamp/1e6)*rate)),endSeconds='endSeconds' in encoded?encoded.endSeconds as number|undefined:undefined
+ const end=Math.min(frame.numberOfFrames,endSeconds==null?frame.numberOfFrames:Math.floor((endSeconds-frame.timestamp/1e6)*rate))
+ if(end>start){
+ const mono=new Float32Array(end-start),plane=new Float32Array(frame.numberOfFrames)
+ for(let channel=0;channel<frame.numberOfChannels;channel++){
+ frame.copyTo(plane,{planeIndex:channel,format:'f32-planar'})
+ for(let i=start;i<end;i++){if(!Number.isFinite(plane[i]))fail();mono[i-start]+=plane[i]/frame.numberOfChannels}
+ }
+ const out=resampler.push(mono)
+ for(let at=0;at<out.length;){const n=Math.min(out.length-at,batch.length-used);batch.set(out.subarray(at,at+n),used);used+=n;at+=n;if(used===batch.length)await send()}
+ if(out.length)written=true
+ }
+ frame.close()
+ }
+ frames=[];await send()
+ }
+ try{
+ decoder.configure(encoded.config)
+ let batch=0,fraction=0
+ for await(const packet of encoded.packets){
+ signal.throwIfAborted();if(failure)throw failure
+ decoder.decode(new EncodedAudioChunk({type:'key',timestamp:packet.timestamp,data:packet.data}))
+ fraction=packet.fraction
+ if(++batch===64){await flush(fraction);batch=0}
+ }
+ await flush(1)
+ if(!written||!resampler)fail()
+ await sink(resampler.push(new Float32Array(0),true),1)
+ }catch(error){signal.throwIfAborted();throw error instanceof AudioFileError?error:new AudioFileError('read')}
+ finally{signal.removeEventListener('abort',abort);abort();for(const frame of frames)frame.close()}
+}
diff --git a/app/src/preload/audioUpload/index.ts b/app/src/preload/audioUpload/index.ts
new file mode 100644
index 00000000..dd777baa
--- /dev/null
+++ b/app/src/preload/audioUpload/index.ts
@@ -0,0 +1,37 @@
+import { ipcRenderer } from 'electron'
+import type { YogurtApi } from '../../shared/types'
+import type { AudioUploadStatus } from '../../shared/audioUpload'
+import { inspectAudioUpload } from './inspect'
+import { decodeAudioUpload } from './decode'
+import { AudioFileError } from './read'
+const inspections=new Map<string,{abort:AbortController;promise:Promise<number>}>()
+const decoding=new Map<string,AbortController>()
+export const audioUpload:YogurtApi['audioUpload']={
+ pick:()=>ipcRenderer.invoke('audio-upload:pick'),
+ inspect(token){
+ let task=inspections.get(token)
+ if(!task){
+ const abort=new AbortController()
+ const promise=ipcRenderer.invoke('audio-upload:info',token).then(file=>inspectAudioUpload({size:file.size,read:async(offset,length)=>new Uint8Array(await ipcRenderer.invoke('audio-upload:read',token,offset,length))},abort.signal))
+ task={abort,promise};inspections.set(token,task)
+ void promise.catch(()=>{if(inspections.get(token)===task)inspections.delete(token)})
+ }
+ return task.promise
+ },
+ async start(token,title,at){
+ if(decoding.has(token))return
+ const abort=new AbortController();decoding.set(token,abort)
+ try{
+ const start=await ipcRenderer.invoke('audio-upload:start',token,title,at)
+ if(!start.decode)return
+ await decodeAudioUpload({size:start.size,read:async(offset,length)=>new Uint8Array(await ipcRenderer.invoke('audio-upload:read',token,offset,length))},async(samples,fraction)=>{
+ abort.signal.throwIfAborted()
+ if(samples.length)await ipcRenderer.invoke('audio-upload:write',token,samples,fraction)
+ },abort.signal)
+ abort.signal.throwIfAborted();await ipcRenderer.invoke('audio-upload:finish',token)
+ }catch(error){if(!abort.signal.aborted)await ipcRenderer.invoke('audio-upload:failed',token,error instanceof AudioFileError?error.kind:'read')}
+ finally{decoding.delete(token);inspections.delete(token)}
+ },
+ async cancel(token){inspections.get(token)?.abort.abort();inspections.delete(token);decoding.get(token)?.abort();await ipcRenderer.invoke('audio-upload:cancel',token)},
+ onStatus(cb){const listener=(_event:unknown,token:string,status:AudioUploadStatus)=>cb(token,status);ipcRenderer.on('audio-upload:status',listener);return()=>ipcRenderer.removeListener('audio-upload:status',listener)},
+}
diff --git a/app/src/preload/audioUpload/inspect.ts b/app/src/preload/audioUpload/inspect.ts
new file mode 100644
index 00000000..0be68866
--- /dev/null
+++ b/app/src/preload/audioUpload/inspect.ts
@@ -0,0 +1,17 @@
+import { AudioReader, fail, text, type AudioSource } from './read'
+import { wavInfo } from './decode'
+import { m4a } from './m4a'
+import { mp3Duration } from './mp3'
+
+/** Read duration from container metadata or compressed frame headers, never decoded audio. */
+export async function inspectAudioUpload(source: AudioSource, signal: AbortSignal): Promise<number> {
+ const reader=new AudioReader(source,signal),head=await reader.read(0,Math.min(12,source.size))
+ let duration:number
+ if(text(head,0,4)==='RIFF'&&text(head,8,4)==='WAVE'){
+ const info=await wavInfo(reader);duration=info.size/info.align/info.rate*1000
+ }else if(text(head,4,4)==='ftyp')duration=(await m4a(reader)).durationMs
+ else duration=await mp3Duration(reader)
+ signal.throwIfAborted()
+ if(!Number.isFinite(duration)||duration<=0||duration>24*60*60*1000)fail('format')
+ return duration
+}
diff --git a/app/src/preload/audioUpload/m4a.ts b/app/src/preload/audioUpload/m4a.ts
new file mode 100644
index 00000000..786ff69a
--- /dev/null
+++ b/app/src/preload/audioUpload/m4a.ts
@@ -0,0 +1,115 @@
+import { AudioReader, fail, text, u32, u64, view } from './read'
+import type { EncodedAudio } from './mp3'
+type Box = { type: string; data: number; end: number }
+function boxes(b: Uint8Array, start = 0, end = b.length): Box[] {
+ const found: Box[] = []
+ while (start < end) {
+ if (end - start < 8) fail()
+ let size = u32(b,start), header = 8
+ if (size === 1) { if (end - start < 16) fail(); size = u64(b,start+8); header = 16 }
+ if (!size) size = end - start
+ if (size < header || start + size > end) fail()
+ found.push({ type: text(b,start+4,4), data:start+header, end:start+size }); start += size
+ }
+ return found
+}
+function child(b: Uint8Array, parent: Box, type: string): Box { return boxes(b,parent.data,parent.end).find(x=>x.type===type) ?? fail('format') }
+function table(b: Uint8Array, box: Box, width: number) {
+ const count = u32(b,box.data+4)
+ if (box.data+8+count*width !== box.end) fail()
+ return { count, at:box.data+8 }
+}
+function descriptor(b: Uint8Array, at: number, end: number): { tag: number; at: number; end: number } {
+ const tag = b[at++]; let size = 0, complete = false
+ for (let i=0;i<4&&at<end;i++) { const n=b[at++]; size=size*128+(n&127); if (!(n&128)) {complete=true;break} }
+ if (!complete || at+size>end) fail()
+ return { tag, at, end:at+size }
+}
+function audioConfig(b: Uint8Array, box: Box): Uint8Array {
+ const es = descriptor(b,box.data+4,box.end)
+ if (es.tag!==3 || es.at+3>es.end) fail('format')
+ let at=es.at+3; const flags=b[es.at+2]
+ if (flags&128) at+=2
+ if (flags&64) at+=1+b[at]
+ if (flags&32) at+=2
+ const decoder=descriptor(b,at,es.end)
+ if (decoder.tag!==4 || decoder.at+13>decoder.end) fail('format')
+ const specific=descriptor(b,decoder.at+13,decoder.end)
+ if (specific.tag!==5 || specific.end-specific.at<2 || specific.end-specific.at>64) fail('format')
+ return b.slice(specific.at,specific.end)
+}
+// shortcut: one non-fragmented AAC track; add container variants when a supported recording app needs them.
+export async function m4a(reader: AudioReader): Promise<EncodedAudio & { endSeconds?: number; durationMs: number }> {
+ let at=0, moov:Uint8Array|undefined
+ while(at<reader.source.size) {
+ const h=await reader.read(at,Math.min(16,reader.source.size-at))
+ let size=u32(h,0);const type=text(h,4,4), header=size===1?16:8
+ if(size===1)size=u64(h,8)
+ if(!size)size=reader.source.size-at
+ if(size<header||at+size>reader.source.size)fail()
+ if(type==='moof')fail('format')
+ if(type==='moov'){if(moov)fail('format');moov=(await reader.read(at,size)).slice()}
+ at+=size
+ }
+ const b=moov??fail('format'), root=boxes(b)[0], tracks=boxes(b,root.data,root.end).filter(x=>x.type==='trak')
+ const audio=tracks.filter(track=>{const mdia=child(b,track,'mdia'), handler=child(b,mdia,'hdlr'), kind=text(b,handler.data+8,4);if(kind==='vide')fail('format');return kind==='soun'})
+ if(audio.length!==1)fail('format')
+ const track=audio[0],mdia=child(b,track,'mdia'),mdhd=child(b,mdia,'mdhd'),stbl=child(b,child(b,mdia,'minf'),'stbl')
+ const timescale=u32(b,mdhd.data+(b[mdhd.data]===1?20:12))
+ if(!timescale)fail()
+ const stsd=child(b,stbl,'stsd')
+ if(u32(b,stsd.data+4)!==1)fail('format')
+ const entry=boxes(b,stsd.data+8,stsd.end)[0]
+ if(entry.type!=='mp4a'||entry.data+28>entry.end)fail('format')
+ const version=view(b).getUint16(entry.data+8)
+ if(version>1)fail('format')
+ const esds=boxes(b,entry.data+28+(version===1?16:0),entry.end).find(x=>x.type==='esds')??fail('format')
+ const description=audioConfig(b,esds),object=description[0]>>3
+ if(![2,5,29].includes(object))fail('format')
+ const sampleRate=u32(b,entry.data+24)>>>16,numberOfChannels=view(b).getUint16(entry.data+16)
+ if(sampleRate<8000||sampleRate>192000||numberOfChannels<1||numberOfChannels>8)fail('format')
+ const sz=child(b,stbl,'stsz'),fixed=u32(b,sz.data+4),count=u32(b,sz.data+8)
+ if(!count||count>4_000_000||sz.data+12+(fixed?0:count*4)!==sz.end)fail()
+ const offsets=boxes(b,stbl.data,stbl.end).find(x=>x.type==='stco'||x.type==='co64')??fail('format'),wide=offsets.type==='co64',chunks=table(b,offsets,wide?8:4)
+ const sc=table(b,child(b,stbl,'stsc'),12),ts=table(b,child(b,stbl,'stts'),8)
+ if(!chunks.count||!sc.count||!ts.count||u32(b,sc.at)!==1)fail()
+ for(let i=0;i<sc.count;i++) {
+ const first=u32(b,sc.at+i*12)
+ if(first>chunks.count||(i>0&&first<=u32(b,sc.at+(i-1)*12)))fail()
+ }
+ let trimSeconds=0,endSeconds:number|undefined
+ const edts=boxes(b,track.data,track.end).find(x=>x.type==='edts')
+ if(edts) {
+ const elst=child(b,edts,'elst'),v=b[elst.data],n=u32(b,elst.data+4),start=elst.data+8
+ if(n!==1||v>1)fail('format')
+ const duration=v?u64(b,start):u32(b,start),media=v?Number(view(b).getBigInt64(start+8)):view(b).getInt32(start+4),rate=start+(v?16:8)
+ if(media<0||view(b).getInt16(rate)!==1||view(b).getInt16(rate+2)!==0)fail('format')
+ const mvhd=child(b,root,'mvhd'),movieScale=u32(b,mvhd.data+(b[mvhd.data]===1?20:12))
+ if(!movieScale)fail()
+ trimSeconds=media/timescale;endSeconds=trimSeconds+duration/movieScale
+ }
+ let ticks=0,samples=0
+ for(let i=0;i<ts.count;i++){const n=u32(b,ts.at+i*8),delta=u32(b,ts.at+i*8+4);if(!n||!delta)fail();samples+=n;ticks+=n*delta}
+ if(samples!==count||!Number.isSafeInteger(ticks))fail()
+ const durationMs=((endSeconds??ticks/timescale)-trimSeconds)*1000
+ if(durationMs<=0)fail()
+ return {durationMs,config:{codec:`mp4a.40.${object}`,sampleRate,numberOfChannels,description},trimSeconds,endSeconds,packets:(async function*(){
+ let index=0,run=0,timeRun=0,remaining=u32(b,ts.at),clock=0
+ for(let chunk=1;chunk<=chunks.count;chunk++) {
+ if(run+1<sc.count&&chunk===u32(b,sc.at+(run+1)*12))run++
+ const entries=u32(b,sc.at+run*12+4),descriptionIndex=u32(b,sc.at+run*12+8)
+ if(!entries||descriptionIndex!==1)fail('format')
+ let offset=wide?u64(b,chunks.at+(chunk-1)*8):u32(b,chunks.at+(chunk-1)*4)
+ for(let i=0;i<entries;i++) {
+ if(index>=count)fail()
+ while(!remaining){if(++timeRun>=ts.count)fail();remaining=u32(b,ts.at+timeRun*8)}
+ const delta=u32(b,ts.at+timeRun*8+4),size=fixed||u32(b,sz.data+12+index*4)
+ if(!delta||!size||size>1024**2)fail()
+ const data=(await reader.read(offset,size)).slice()
+ yield {data,timestamp:Math.round(clock*1e6/timescale),fraction:(index+1)/count}
+ offset+=size;clock+=delta;index++;remaining--
+ }
+ }
+ if(index!==count||remaining||timeRun!==ts.count-1)fail()
+ })()}
+}
diff --git a/app/src/preload/audioUpload/mp3.ts b/app/src/preload/audioUpload/mp3.ts
new file mode 100644
index 00000000..4b81bb5d
--- /dev/null
+++ b/app/src/preload/audioUpload/mp3.ts
@@ -0,0 +1,65 @@
+import { AudioReader, fail, text, u32 } from './read'
+export type AudioPacket = { data: Uint8Array; timestamp: number; fraction: number }
+export type EncodedAudio = { config: AudioDecoderConfig; packets: AsyncIterable<AudioPacket>; trimSeconds?: number }
+const rates = [44100, 48000, 32000]
+const high = [0,32,40,48,56,64,80,96,112,128,160,192,224,256,320]
+const low = [0,8,16,24,32,40,48,56,64,80,96,112,128,144,160]
+export function mp3Header(b: Uint8Array) {
+ if (b.length < 4 || b[0] !== 255 || (b[1] & 224) !== 224 || ((b[1] >> 1) & 3) !== 1) return fail('format')
+ const version = (b[1] >> 3) & 3, rateIndex = (b[2] >> 2) & 3, bitrateIndex = b[2] >> 4
+ if (version === 1 || rateIndex === 3 || !bitrateIndex || bitrateIndex === 15) return fail('format')
+ const sampleRate = rates[rateIndex] / (version === 3 ? 1 : version === 2 ? 2 : 4)
+ const length = Math.floor((version === 3 ? 144000 : 72000) * (version === 3 ? high : low)[bitrateIndex] / sampleRate) + ((b[2] >> 1) & 1)
+ return { sampleRate, numberOfChannels: (b[3] >> 6) === 3 ? 1 : 2, length, samples: version === 3 ? 1152 : 576 }
+}
+async function firstFrame(reader: AudioReader) {
+ let at = 0
+ const first = await reader.read(0, 10)
+ if (text(first, 0, 3) === 'ID3') {
+ if (first.slice(6,10).some(x => x > 127)) fail()
+ at = 10 + first.slice(6,10).reduce((n,x) => n * 128 + x, 0) + ((first[5] & 16) ? 10 : 0)
+ }
+ const header = mp3Header(await reader.read(at, 4))
+ return {at,header}
+}
+export async function mp3(reader: AudioReader): Promise<EncodedAudio> {
+ let {at,header}=await firstFrame(reader)
+ return { config: { codec: 'mp3', sampleRate: header.sampleRate, numberOfChannels: header.numberOfChannels }, packets: (async function* () {
+ let samples = 0
+ while (at < reader.source.size) {
+ const left = reader.source.size - at
+ const b = await reader.read(at, Math.min(8, left))
+ if ((left === 128 && text(b,0,3) === 'TAG') || text(b,0,8) === 'APETAGEX') break
+ const h = mp3Header(b)
+ if (h.sampleRate !== header.sampleRate || h.numberOfChannels !== header.numberOfChannels) fail('format')
+ const data = (await reader.read(at, h.length)).slice()
+ at += h.length
+ yield { data, timestamp: Math.round(samples * 1e6 / h.sampleRate), fraction: at / reader.source.size }
+ samples += h.samples
+ }
+ })() }
+}
+
+/** Prefer frame counts in Xing/VBRI; otherwise count frame headers without decoding samples. */
+export async function mp3Duration(reader: AudioReader): Promise<number> {
+ let {at,header}=await firstFrame(reader)
+ const first=await reader.read(at,header.length),version=(first[1]>>3)&3
+ const side=version===3?(header.numberOfChannels===1?17:32):(header.numberOfChannels===1?9:17)
+ const xing=4+((first[1]&1)?0:2)+side
+ let frames=0
+ if(first.length>=xing+12&&['Xing','Info'].includes(text(first,xing,4))&&(u32(first,xing+4)&1))frames=u32(first,xing+8)
+ else if(first.length>=54&&text(first,36,4)==='VBRI')frames=u32(first,50)
+ if(frames>0){
+ const minimum=Math.floor((version===3?144000*32:72000*8)/header.sampleRate)
+ if(frames*minimum>reader.source.size-at)fail()
+ return frames*header.samples/header.sampleRate*1000
+ }
+ while(at<reader.source.size){
+ const left=reader.source.size-at,b=await reader.read(at,Math.min(8,left))
+ if((left===128&&text(b,0,3)==='TAG')||text(b,0,8)==='APETAGEX')break
+ const h=mp3Header(b)
+ if(h.sampleRate!==header.sampleRate||h.numberOfChannels!==header.numberOfChannels||at+h.length>reader.source.size)fail()
+ at+=h.length;frames++
+ }
+ return frames*header.samples/header.sampleRate*1000
+}
diff --git a/app/src/preload/audioUpload/read.ts b/app/src/preload/audioUpload/read.ts
new file mode 100644
index 00000000..ebfbcb1a
--- /dev/null
+++ b/app/src/preload/audioUpload/read.ts
@@ -0,0 +1,28 @@
+export type AudioSource = { size: number; read: (offset: number, length: number) => Promise<Uint8Array> }
+export class AudioFileError extends Error { constructor(readonly kind: 'format' | 'read' = 'read') { super(`Audio ${kind} error`) } }
+export function fail(kind: 'format' | 'read' = 'read'): never { throw new AudioFileError(kind) }
+export const text = (b: Uint8Array, at: number, n: number) => String.fromCharCode(...b.subarray(at, at + n))
+export const view = (b: Uint8Array) => new DataView(b.buffer, b.byteOffset, b.byteLength)
+export const u32 = (b: Uint8Array, at: number) => view(b).getUint32(at)
+export function u64(b: Uint8Array, at: number): number { const n = Number(view(b).getBigUint64(at)); if (!Number.isSafeInteger(n)) fail(); return n }
+/** One read-ahead window, so a long compressed recording does not need one IPC call per frame. */
+export class AudioReader {
+ private buffer = new Uint8Array(0)
+ private offset = 0
+ constructor(readonly source: AudioSource, readonly signal: AbortSignal) {}
+ async read(at: number, n: number): Promise<Uint8Array> {
+ this.signal.throwIfAborted()
+ if (!Number.isSafeInteger(at) || !Number.isSafeInteger(n) || at < 0 || n < 0 || n > 32 * 1024 ** 2 || at + n > this.source.size) fail()
+ if (at < this.offset || at + n > this.offset + this.buffer.length) {
+ const length = Math.min(this.source.size - at, Math.max(n, 1024 ** 2))
+ this.buffer = new Uint8Array(length); this.offset = at
+ for (let i = 0; i < length; i += 1024 ** 2) {
+ this.signal.throwIfAborted()
+ const bytes = await this.source.read(at + i, Math.min(1024 ** 2, length - i))
+ if (bytes.length !== Math.min(1024 ** 2, length - i)) fail()
+ this.buffer.set(bytes, i)
+ }
+ }
+ return this.buffer.subarray(at - this.offset, at - this.offset + n)
+ }
+}
diff --git a/app/src/preload/audioUpload/resample.ts b/app/src/preload/audioUpload/resample.ts
new file mode 100644
index 00000000..4df98fa1
--- /dev/null
+++ b/app/src/preload/audioUpload/resample.ts
@@ -0,0 +1,38 @@
+/** Streaming mono resampling with a low-pass filter; history stays bounded across file chunks. */
+export class AudioResampler {
+ private data = new Float32Array(0)
+ private base = 0
+ private frames = 0
+ private output = 0
+ private readonly table: Float32Array[]
+ constructor(private readonly rate: number) {
+ if (!Number.isFinite(rate) || rate < 8000 || rate > 192000) throw new Error('Unsupported sample rate')
+ const cutoff = Math.min(1, 16000 / rate) * .94
+ this.table = Array.from({ length: 256 }, (_, phase) => {
+ const taps = new Float32Array(32)
+ let sum = 0
+ for (let k = 0; k < 32; k++) {
+ const x = k - 15 - phase / 256
+ const sinc = x === 0 ? cutoff : Math.sin(Math.PI * cutoff * x) / (Math.PI * x)
+ taps[k] = sinc * (.42 - .5 * Math.cos(2 * Math.PI * k / 31) + .08 * Math.cos(4 * Math.PI * k / 31)); sum += taps[k]
+ }
+ return taps.map(x => x / sum)
+ })
+ }
+ push(samples: Float32Array, end = false): Float32Array {
+ const data = new Float32Array(this.data.length + samples.length)
+ data.set(this.data); data.set(samples, this.data.length)
+ this.data = data; this.frames += samples.length
+ const count = Math.max(this.output, Math.floor((end ? this.frames : Math.max(0, this.frames - 17)) * 16000 / this.rate))
+ const out = new Float32Array(count - this.output)
+ for (let i = 0; this.output < count; this.output++, i++) {
+ const at = this.output * this.rate / 16000, first = Math.floor(at), taps = this.table[Math.min(255, Math.floor((at - first) * 256))]
+ let value = 0
+ for (let k = 0; k < 32; k++) value += (data[first - 15 + k - this.base] ?? 0) * taps[k]
+ out[i] = Math.max(-1, Math.min(1, value))
+ }
+ const keep = Math.max(this.base, Math.floor(this.output * this.rate / 16000) - 16)
+ this.data = data.slice(keep - this.base); this.base = keep
+ return out
+ }
+}
diff --git a/app/src/preload/index.ts b/app/src/preload/index.ts
index 4922f418..95bb1120 100644
--- a/app/src/preload/index.ts
+++ b/app/src/preload/index.ts
@@ -1,3 +1,4 @@
+import { audioUpload } from './audioUpload'
import type { WidgetLayout } from '../shared/widgetMorph'
import { contextBridge, ipcRenderer } from 'electron'
import { capabilities, platformOf } from '../shared/platform'
@@ -87,6 +88,11 @@ const api: YogurtApi = {
},
},
transcript: {
+ draft:id=>ipcRenderer.invoke('transcript:draft',id),
+ onDraft:cb=>{const listener=(_e:unknown,id:string)=>cb(id);ipcRenderer.on('transcript:draft',listener);return()=>ipcRenderer.removeListener('transcript:draft',listener)},
+ onReplaced: cb => {const listener=(_e:unknown,id:string)=>cb(id);ipcRenderer.on('transcript:replaced',listener);return()=>ipcRenderer.removeListener('transcript:replaced',listener)},
+ run: (id,again) => ipcRenderer.invoke('transcript:run',id,again),
+ stop: id => ipcRenderer.invoke('transcript:stop',id),
get: (id, o) => ipcRenderer.invoke('transcript:get', id, o),
restore: (id, ids) => ipcRenderer.invoke('transcript:restore', id, ids),
onSegment: (cb) => {
@@ -131,6 +137,7 @@ const api: YogurtApi = {
copy: (id, what, side) => ipcRenderer.invoke('share:copy', id, what, side),
save: (id, side) => ipcRenderer.invoke('share:save', id, side),
},
+ audioUpload,
audio: {
delete: (id) => ipcRenderer.invoke('audio:delete', id),
onDeleted: (cb) => {
diff --git a/app/src/renderer/src/components/AnswerText.tsx b/app/src/renderer/src/components/AnswerText.tsx
index 17f1969d..a6769c13 100644
--- a/app/src/renderer/src/components/AnswerText.tsx
+++ b/app/src/renderer/src/components/AnswerText.tsx
@@ -68,7 +68,7 @@ export function AnswerText({ md, live, sources, onSource }: {
setOpen(next)
}}>{({ payload }) => { ctx.at.n = 0; return <>
{(doc.content ?? []).map(n => render(n, ctx))}
- {payload && <SourceCitationCard key={triggerId} source={payload.source} sentence={payload.sentence} triggerId={triggerId} animate onOpen={match => { setPinned(null); setOpen(false); onSource(payload.source, match) }} />}
+ {payload && <SourceCitationCard key={triggerId} source={payload.source} sentence={payload.sentence} triggerId={triggerId} animate onOpen={(match, atMs) => { setPinned(null); setOpen(false); onSource(atMs == null ? payload.source : { ...payload.source, atMs }, match) }} />}
</> }}</Popover.Root>
}
diff --git a/app/src/renderer/src/components/AudioUpload.tsx b/app/src/renderer/src/components/AudioUpload.tsx
new file mode 100644
index 00000000..89bfef83
--- /dev/null
+++ b/app/src/renderer/src/components/AudioUpload.tsx
@@ -0,0 +1,75 @@
+import { AudioUploadWhen } from './AudioUploadWhen'
+import { useEffect, useLayoutEffect, useRef, useState } from 'react'
+import { FileAudio } from 'lucide-react'
+import { t } from '../../../shared/i18n'
+import { type AudioUploadFile, type AudioUploadStatus } from '../../../shared/audioUpload'
+import { motion } from '../motion'
+import { Loader } from './Icons'
+import { Modal } from './Modal'
+import { toasts } from './TrashToast'
+
+export function AudioUploadDialog({ file, durationMs, status, closing, onStart, onInspect, onCancel }: {
+ file: AudioUploadFile; closing?:boolean; durationMs?: number; status?: AudioUploadStatus; onInspect?: () => void
+ onStart: (title: string, at: number) => void; onCancel: () => void
+}) {
+ const inferred=Math.min(Date.now(),file.modifiedAt-(durationMs??0))
+ const [at,setAt]=useState(inferred)
+ useLayoutEffect(()=>setAt(inferred),[file.token,durationMs])
+ const busy=!!status&&status.phase!=='error',reading=status?.phase==='reading'
+ const heading=reading?t('Reading the file…'):t('Upload a file')
+ return <Modal closing={closing} title={heading} onCancel={onCancel} busy={busy} testId="audio-upload">
+ <form onSubmit={e=>{e.preventDefault();if(!busy){if(durationMs==null)onInspect?.();else onStart(file.title,at)}}}>
+ <div className="audio-upload-fields">
+ <p className="audio-upload-file">{reading?<Loader size={16} aria-hidden="true"/>:<FileAudio size={16} aria-hidden="true"/>}<span title={file.name}>{file.name}</span></p>
+ {durationMs!=null&&<AudioUploadWhen disabled={busy} at={at} durationMs={durationMs} onChange={setAt}/>}
+ {status?.phase==='error'&&<p className="text-xs text-danger" role="alert">{status.error==='busy'?t('Finish recording before uploading a file.'):status.error==='format'?t('This audio format is not supported.'):t("Yogurt couldn't read this audio file.")}</p>}
+ </div>
+ <div className="modal-actions audio-upload-actions"><button type="button" className="ghost-btn" data-dialog-cancel disabled={!!closing||status?.phase==='done'||status?.phase==='cancelling'} onClick={onCancel}>{t('Cancel')}</button>{!reading&&<button type="submit" disabled={busy} aria-busy={busy} className="workspace-button primary audio-upload-submit"><span className="audio-upload-submit-label">{status?.phase==='error'?t('Try again'):t('Transcribe')}</span>{busy&&<span className="audio-upload-submit-icon" aria-hidden="true"><Loader size={14}/></span>}</button>}</div>
+ </form>
+ </Modal>
+}
+
+export function AudioUpload({ file, onClose, onCreated }: { file: AudioUploadFile; onClose: () => void; onCreated?: (id: string) => void }) {
+ const [status, setStatus] = useState<AudioUploadStatus | undefined>({ phase: 'reading' })
+ const [durationMs, setDuration] = useState<number>()
+ const [attempt, setAttempt] = useState(0)
+ const opening=useRef<string|undefined>(undefined)
+ const [closing,setClosing]=useState(false)
+ useEffect(()=>{const ready=(event:Event)=>{if((event as CustomEvent).detail===opening.current)setClosing(true)};document.addEventListener('audio-upload-note-ready',ready);return()=>document.removeEventListener('audio-upload-note-ready',ready)},[])
+ useEffect(() => {
+ let active = true
+ setStatus({ phase: 'reading' })
+ void Promise.all([window.yogurt.audioUpload.inspect(file.token), new Promise(resolve => setTimeout(resolve, motion.surface))]).then(([duration]) => {
+ if (active) { setDuration(duration); setStatus(previous => previous?.phase === 'cancelling' ? previous : undefined) }
+ }, () => { if (active) setStatus(previous => previous?.phase === 'cancelling' ? previous : { phase: 'error', error: 'read' }) })
+ return () => { active = false }
+ }, [file.token, attempt])
+ useEffect(() => {
+ return window.yogurt.audioUpload.onStatus((token, next) => {
+ if (token !== file.token) return
+ setStatus(next)
+ if ((next.phase==='preparing'||next.phase==='done')&&next.meetingId&&!opening.current) { opening.current=next.meetingId;onCreated?.(next.meetingId);window.yogurt.nav.go(`/note/${next.meetingId}`) }
+ })
+ }, [file, onClose, onCreated])
+ return <AudioUploadDialog closing={closing} file={file} durationMs={durationMs} status={status} onInspect={() => setAttempt(n => n + 1)} onStart={(title, at) => {
+ setStatus({ phase: 'preparing' })
+ void window.yogurt.audioUpload.start(file.token, title, at).catch(() => setStatus({ phase: 'error', error: 'read' }))
+ }} onCancel={() => {if(opening.current){onClose();return} setStatus({ phase: 'cancelling' }); void window.yogurt.audioUpload.cancel(file.token).then(onClose, () => setStatus({ phase: 'error', error: 'read' })) }} />
+}
+
+/** The upload survives route changes when a call starts or another note opens. */
+export async function openAudioUpload(onCreated?: (id: string) => void) {
+ try {
+ const file = await window.yogurt.audioUpload.pick()
+ if (file) document.dispatchEvent(new CustomEvent('audio-upload-open', { detail: { file, onCreated } }))
+ } catch { toasts.add({ title: t("Yogurt couldn't read this audio file.") }) }
+}
+export function AudioUploadHost() {
+ const [request, setRequest] = useState<{ file: AudioUploadFile; onCreated?: (id: string) => void }>()
+ useEffect(() => {
+ const open = (event: Event) => setRequest((event as CustomEvent).detail)
+ document.addEventListener('audio-upload-open', open)
+ return () => document.removeEventListener('audio-upload-open', open)
+ }, [])
+ return request ? <AudioUpload file={request.file} onClose={() => setRequest(undefined)} onCreated={request.onCreated} /> : null
+}
diff --git a/app/src/renderer/src/components/AudioUploadWhen.tsx b/app/src/renderer/src/components/AudioUploadWhen.tsx
new file mode 100644
index 00000000..52d5feaf
--- /dev/null
+++ b/app/src/renderer/src/components/AudioUploadWhen.tsx
@@ -0,0 +1,50 @@
+import {useEffect,useRef,useState} from 'react'
+import {Popover} from '@base-ui/react/popover'
+import {CalendarDays,ChevronLeft,ChevronRight} from 'lucide-react'
+import {language,t} from '../../../shared/i18n'
+import {noteDateLabel,timeOf} from '../../../shared/dates'
+import {uploadClock,stepUploadClock,uploadDayAllowed} from '../../../shared/audioUpload'
+import {weekDates,shiftDay} from '../agenda'
+
+export function AudioUploadWhen({at,durationMs,onChange,disabled=false}:{at:number;durationMs:number;onChange:(at:number)=>void;disabled?:boolean}) {
+ const [open,setOpen]=useState(false),row=useRef<HTMLDivElement>(null)
+ const [month,setMonth]=useState(()=>new Date(at).setDate(1))
+ const date=new Date(at),shown=new Date(month),today=new Date()
+ const first=new Date(shown.getFullYear(),shown.getMonth(),1)
+ const start=weekDates(+first)[0]
+ const days=Array.from({length:42},(_,i)=>shiftDay(start,i))
+ const nextMonth=(step:number)=>+new Date(shown.getFullYear(),shown.getMonth()+step,1)
+ const monthName=(value:number)=>new Date(value).toLocaleDateString(language(),{month:'long',year:'numeric'})
+ const choose=(day:number)=>{const next=new Date(at),picked=new Date(day);next.setFullYear(picked.getFullYear(),picked.getMonth(),picked.getDate());if(uploadDayAllowed(+next)){onChange(+next);setOpen(false)}}
+ return <Popover.Root open={open&&!disabled} onOpenChange={value=>{setOpen(value);if(value)setMonth(new Date(at).setDate(1))}}>
+ <div ref={row} className="audio-upload-date-row"><Popover.Trigger type="button" disabled={disabled} data-dialog-focus className="note-chip audio-upload-date" data-testid="audio-upload-date"><CalendarDays size={14}/><span>{noteDateLabel(at)}</span></Popover.Trigger><Clock at={at} onChange={onChange} disabled={disabled}/><small>{t('{count} min',{count:Math.ceil(durationMs/60000)})}</small></div>
+ <Popover.Portal>
+ <Popover.Positioner anchor={row} side="bottom" align="start" sideOffset={8} collisionPadding={12} collisionAvoidance={{side:'shift',align:'shift',fallbackAxisSide:'none'}} positionMethod="fixed" className="audio-upload-date-positioner">
+ <Popover.Popup className="people-card menu-entry audio-upload-date-picker" data-testid="audio-upload-picker" aria-label={t('Date')} initialFocus={()=>document.querySelector<HTMLElement>('[data-upload-day][aria-pressed=true]')}>
+ <div className="agenda-navigation"><span className="agenda-month" aria-live="polite">{monthName(month)}</span>
+ <button type="button" className="ghost-btn workspace-icon" aria-label={monthName(nextMonth(-1))} disabled={shown.getFullYear()===1900&&shown.getMonth()===0} onClick={()=>setMonth(nextMonth(-1))}><ChevronLeft size={15} className="rtl:-scale-x-100"/></button>
+ <button type="button" className="ghost-btn workspace-icon" aria-label={monthName(nextMonth(1))} disabled={nextMonth(1)>+today} onClick={()=>setMonth(nextMonth(1))}><ChevronRight size={15} className="rtl:-scale-x-100"/></button>
+ </div>
+ <div className="agenda-week audio-upload-month" aria-label={t('Date')}>
+ {days.slice(0,7).map(day=><span key={day}>{new Date(day).toLocaleDateString(language(),{weekday:'narrow'})}</span>)}
+ {days.map(day=>{const d=new Date(day);return <button key={day} type="button" data-upload-day={day} data-outside={d.getMonth()!==shown.getMonth()||undefined} disabled={!uploadDayAllowed(day)} aria-pressed={d.toDateString()===date.toDateString()} aria-label={d.toLocaleDateString(language(),{weekday:'long',month:'long',day:'numeric',year:'numeric'})} onClick={()=>choose(day)}><b>{d.toLocaleDateString(language(),{day:'numeric'})}</b></button>})}
+ </div>
+ </Popover.Popup>
+ </Popover.Positioner>
+ </Popover.Portal>
+ </Popover.Root>
+}
+function Clock({at,onChange,disabled}:{at:number;onChange:(at:number)=>void;disabled:boolean}) {
+ const original=timeOf(at),[value,setValue]=useState(original)
+ useEffect(()=>setValue(original),[original])
+ const commit=()=>{const next=uploadClock(value,at,language());setValue(next==null?original:timeOf(next));if(next!=null)onChange(next)}
+ return <input className="audio-upload-time" disabled={disabled} type="text" aria-label={t('Start time')} aria-keyshortcuts="ArrowUp ArrowDown Shift+ArrowUp Shift+ArrowDown" value={value} onChange={e=>setValue(e.target.value)} onFocus={e=>e.target.select()} onBlur={commit} onKeyDown={e=>{
+ if(e.key==='Enter'){e.preventDefault();commit()}
+ else if(e.key==='Escape'){e.preventDefault();e.stopPropagation();setValue(original);e.currentTarget.select()}
+ else if(e.key==='ArrowUp'||e.key==='ArrowDown'){
+ e.preventDefault()
+ const next=stepUploadClock(uploadClock(value,at,language())??at,(e.key==='ArrowUp'?1:-1)*(e.shiftKey?60:1))
+ setValue(timeOf(next));onChange(next)
+ }
+ }}/>
+}
diff --git a/app/src/renderer/src/components/Modal.tsx b/app/src/renderer/src/components/Modal.tsx
index 6bab96aa..23b4d90b 100644
--- a/app/src/renderer/src/components/Modal.tsx
+++ b/app/src/renderer/src/components/Modal.tsx
@@ -6,13 +6,14 @@ import { motion, useReducedMotion } from '../motion'
export const ModalClose = Dialog.Close
/** Shared accessible dialog with restrained motion and safe initial focus. */
-export function Modal({ title, description, children, onCancel, busy = false, role = 'dialog', testId, container }: {
+export function Modal({ title, description, children, onCancel, busy = false, closing=false, role = 'dialog', testId, container }: {
title: string; description?: string; children: ReactNode
- onCancel: () => void; busy?: boolean; role?: 'dialog' | 'alertdialog'; testId?: string
+ onCancel: () => void; busy?: boolean; closing?:boolean; role?: 'dialog' | 'alertdialog'; testId?: string
container?: HTMLElement | null
}) {
const [open, setOpen] = useState(true)
const reduce = useReducedMotion()
+ useEffect(()=>{if(closing)setOpen(false)},[closing])
const dialog = useRef<HTMLDivElement>(null)
const opener = useRef(document.activeElement instanceof HTMLElement ? document.activeElement : null)
const cancel = useRef(onCancel)
diff --git a/app/src/renderer/src/components/NoteMenu.tsx b/app/src/renderer/src/components/NoteMenu.tsx
index d606ff24..0da8dd61 100644
--- a/app/src/renderer/src/components/NoteMenu.tsx
+++ b/app/src/renderer/src/components/NoteMenu.tsx
@@ -1,7 +1,7 @@
import { Tooltip } from '@base-ui/react/tooltip'
import { usePopoverPresence } from '../motion'
import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'
-import { ChevronRight, Ellipsis, FolderIcon, Pencil, RotateCcw, Trash2 } from 'lucide-react'
+import { AudioLines, ChevronRight, Ellipsis, FolderIcon, Pencil, RotateCcw, Trash2 } from 'lucide-react'
import { RegenerateForm } from './RegenerateForm'
import { t } from '../../../shared/i18n'
@@ -17,7 +17,8 @@ export function summaryAction({ hasSummary, hasContent, recording, busy, downloa
}
/** The note's actions share one menu and one anchor for folders and generation. */
-export function NoteMenu({ recording, savePending, onRename, onDelete, folders, trashed, generation, hasSummary, edited, rewriteOpen, setRewriteOpen, onWriteAgain }: {
+export function NoteMenu({ transcription, recording, savePending, onRename, onDelete, folders, trashed, generation, hasSummary, edited, rewriteOpen, setRewriteOpen, onWriteAgain }: {
+ transcription?: {reason?:string;run:()=>void}
recording: boolean; savePending?: boolean; onRename: () => void; onDelete: () => void; folders?: (close: () => void) => ReactNode
/** in the Trash already: Delete is for good */
trashed?: boolean
@@ -77,6 +78,7 @@ export function NoteMenu({ recording, savePending, onRename, onDelete, folders,
}} className={row}>
<FolderIcon size={15} aria-hidden="true" className="text-muted" /><span className="flex-1">{t('Add to folder')}</span><ChevronRight size={14} aria-hidden="true" className="text-muted rtl:-scale-x-100" />
</button>}
+ {transcription&&<Tooltip.Root disabled={!transcription.reason}><Tooltip.Trigger delay={180} closeOnClick={false} role="menuitem" data-testid="note-transcribe-again" aria-disabled={!!transcription.reason} aria-description={transcription.reason} onClick={()=>{if(!transcription.reason)run(transcription.run)}} className={`${row} whitespace-nowrap aria-disabled:opacity-50 aria-disabled:hover:bg-transparent`}><AudioLines size={15} className="text-muted" aria-hidden="true"/>{t('Transcribe again')}</Tooltip.Trigger><Tooltip.Portal><Tooltip.Positioner side="left" sideOffset={6} className="z-[80]"><Tooltip.Popup role="tooltip" className="rounded-md border border-line bg-float px-2 py-1 text-xs text-ink shadow-[var(--shadow)]">{transcription.reason}</Tooltip.Popup></Tooltip.Positioner></Tooltip.Portal></Tooltip.Root>}
{generation && <Tooltip.Root disabled={!generation.reason}><Tooltip.Trigger delay={180} closeOnClick={false} role="menuitem" data-testid="note-write-again" aria-disabled={!!generation.reason}
aria-description={generation.reason}
onClick={() => { if (generation.reason) return; setOpen(false); setRewriteOpen(true) }}
diff --git a/app/src/renderer/src/components/SourceCitation.tsx b/app/src/renderer/src/components/SourceCitation.tsx
index e0e15846..8162c823 100644
--- a/app/src/renderer/src/components/SourceCitation.tsx
+++ b/app/src/renderer/src/components/SourceCitation.tsx
@@ -8,7 +8,7 @@ import { citationCardPassage } from '../../../shared/citationCard'
/** Only the decorative mass is filtered. The excerpt is the retrieved text, never generated by the answer. */
export function SourceCitationCard({ source, sentence, triggerId, animate, onOpen }: {
- source: LibrarySource; sentence: string; triggerId: string | null; animate: boolean; onOpen: (match: string) => void
+ source: LibrarySource; sentence: string; triggerId: string | null; animate: boolean; onOpen: (match: string, atMs?: number) => void
}) {
const filterId = useId().replace(/:/g, ''), popup = useRef<HTMLDivElement>(null)
const preview = citationCardPassage(source, sentence)
@@ -49,7 +49,7 @@ export function SourceCitationCard({ source, sentence, triggerId, animate, onOpe
</div>
{preview.match.text && <blockquote className="citation-quote" data-testid="citation-excerpt" dir="auto"><q>{preview.before.text && <span className="citation-context">{preview.before.text} </span>}<span className="citation-match">{preview.match.text}</span>{preview.after.text && <span className="citation-context"> {preview.after.text}</span>}</q></blockquote>}
<div className="citation-footer">
- <button className="ghost-btn" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(preview.match.text)}>{t('Open')}<ArrowUpRight size={12} aria-hidden="true" /></button>
+ <button className="ghost-btn" data-testid="citation-open" aria-label={t('Open {source}', { source: title })} onClick={() => onOpen(preview.match.text, preview.match.atMs)}>{t('Open')}<ArrowUpRight size={12} aria-hidden="true" /></button>
</div>
</div>
</Popover.Popup>
diff --git a/app/src/renderer/src/components/StartRecording.tsx b/app/src/renderer/src/components/StartRecording.tsx
index 4edbd5c0..907fa8d8 100644
--- a/app/src/renderer/src/components/StartRecording.tsx
+++ b/app/src/renderer/src/components/StartRecording.tsx
@@ -1,7 +1,8 @@
+import { openAudioUpload } from './AudioUpload'
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { Menu } from '@base-ui/react/menu'
-import { ChevronDown } from 'lucide-react'
+import { ChevronDown, Upload } from 'lucide-react'
import { Mic } from './Icons'
import { toasts } from './TrashToast'
import { t } from '../../../shared/i18n'
@@ -72,37 +73,38 @@ export function StartRecording({ onStarted, onGone, testId = 'start-recording' }
} finally { setStarting(false) }
}
const choices = recordingChoices(events, now)
- useEffect(() => { if (recording !== false || !choices.length) setOpen(false) }, [recording, choices.length])
+ useEffect(() => { if (recording !== false) setOpen(false) }, [recording])
if (recording !== false || !actions) return null
const live = choices.filter(event => eventPhase(event, now) === 'live')
const title = live[0]?.title || t('Meeting')
const resuming = live.length === 1 && resumesNote(live[0].note)
- const label = live.length === 1 ? resuming ? t('Resume notes · {title}', { title }) : t('Take notes · {title}', { title })
+ const label = live.length === 1 ? live[0].note?.source === 'audio-file' ? t('Open {title}', { title }) : resuming ? t('Resume notes · {title}', { title }) : t('Take notes · {title}', { title })
: live.length > 1 ? t('Take notes · {count} now', { count: live.length }) : t('Start recording')
const content = <><Mic size={14} aria-hidden="true" /><span className="recording-label">{label}</span></>
const button = { 'data-testid': testId, disabled: starting, title: label, className: 'workspace-button primary recording-main no-drag' }
- return createPortal(<Menu.Root modal={false} open={open && choices.length > 0} onOpenChange={setOpen}>
- <div ref={root} className="recording-split no-drag" data-split={choices.length > 0}>
+ return createPortal(<Menu.Root modal={false} open={open} onOpenChange={setOpen}>
+ <div ref={root} className="recording-split no-drag" data-split={true}>
{live.length > 1 ? <Menu.Trigger {...button}>{content}</Menu.Trigger>
: <button {...button} onClick={() => void start(live[0]?.id ?? null)}>{content}</button>}
- {choices.length > 0 && <Menu.Trigger data-testid="recording-choices" disabled={starting} className="workspace-button primary recording-chevron no-drag" aria-label={t('More for “{name}”', { name: t('Start recording') })} title={t('More')}><ChevronDown size={13} aria-hidden="true" /></Menu.Trigger>}
+ <Menu.Trigger data-testid="recording-choices" disabled={starting} className="workspace-button primary recording-chevron no-drag" aria-label={t('More for “{name}”', { name: t('Start recording') })} title={t('More')}><ChevronDown size={13} aria-hidden="true" /></Menu.Trigger>
</div>
- {choices.length > 0 && <Menu.Portal>
+ <Menu.Portal>
<Menu.Positioner anchor={root} side="bottom" align="end" sideOffset={8} className="ask-menu-positioner">
<Menu.Popup className="menu-entry ask-actions-menu recording-menu" aria-label={t('Start recording')} onKeyDown={e => { if (e.key === 'Escape') e.stopPropagation() }}>
{choices.map(event => {
const resume = resumesNote(event.note), title = event.title || t('Meeting')
- const label = resume ? t('Resume notes · {title}', { title }) : title
+ const label = event.note?.source === 'audio-file' ? t('Open {title}', { title }) : resume ? t('Resume notes · {title}', { title }) : title
return <Menu.Item key={event.id} data-testid="recording-meeting" label={title} disabled={starting} onClick={() => void start(event.id)}>
<Mic size={14} aria-hidden="true" />
<span className="recording-meeting-copy"><span title={label}>{label}</span>{event.attendees.length > 0 && <small>{event.attendees.map(person => personName(person.name)).join(', ')}</small>}</span>
<span className="recording-timing">{eventPhase(event, now) === 'live' ? t('Now') : t('in {count} min', { count: Math.ceil((event.start - now) / 60_000) })}</span>
</Menu.Item>
})}
- <Menu.Separator className="recording-menu-separator" />
+ {choices.length > 0 && <Menu.Separator className="recording-menu-separator" />}
<Menu.Item data-testid="recording-unattached" disabled={starting} onClick={() => void start(null)}><Mic size={14} aria-hidden="true" />{t('New recording')}</Menu.Item>
+ <Menu.Item data-testid="recording-upload" disabled={starting} onClick={() => { setOpen(false); void openAudioUpload(onStarted) }}><Upload size={14} aria-hidden="true" />{t('Upload a file')}</Menu.Item>
</Menu.Popup>
</Menu.Positioner>
- </Menu.Portal>}
+ </Menu.Portal>
</Menu.Root>, actions)
}
diff --git a/app/src/renderer/src/components/Transcript.tsx b/app/src/renderer/src/components/Transcript.tsx
index b734f4d5..60b20a70 100644
--- a/app/src/renderer/src/components/Transcript.tsx
+++ b/app/src/renderer/src/components/Transcript.tsx
@@ -1,14 +1,15 @@
+import {transcriptReplacement} from '../../../shared/transcriptReplacement'
import { citationTargetIndex } from '../../../shared/citations'
import { SPEAKER_COLORS } from '../../../shared/speakerColors'
import { ScrollFade } from './ScrollFade'
import { Loading } from './Loading'
import { useLoadingState } from '../useLoadingState'
-import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent } from 'react'
+import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode, type CSSProperties, type KeyboardEvent, type MouseEvent } from 'react'
import { AudioLines, ArrowDown } from 'lucide-react'
import type { Segment, TranscriptPartial } from '../../../shared/types'
import { t } from '../../../shared/i18n'
import { useLanguage } from '../i18n'
-import { bubbles, clock, echoRuns, lineAt, recentRuns, stableKeys, turns, withLive, type LiveSaid } from '../../../shared/transcript'
+import { transcriptSpeaker, bubbles, clock, echoRuns, lineAt, recentRuns, stableKeys, turns, withLive, type LiveSaid } from '../../../shared/transcript'
import { TranscriptFind } from './TranscriptFind'
import { Player, type PlayerHandle } from './Player'
import { attachPlayerVisibility } from '../playerVisibility'
@@ -17,7 +18,7 @@ import { followGlide, scrollBehavior } from '../motion'
import { followTarget, inView } from '../../../shared/follow'
import { afterFinal, joinWords } from '../../../shared/liveWords'
-type Line = Omit<Segment, 'id'> & { id?: number }
+type Line = Omit<Segment, 'id'> & { id?: number; previous?:boolean }
const key = (l: { track: string; startMs: number }) => `${l.track}:${l.startMs}`
/** this close to the bottom still counts as reading the latest lines */
const STICK_PX = 24
@@ -25,15 +26,30 @@ const STICK_PX = 24
const HANDS_OFF_MS = 400
/** You on the mic; on the other side the name the call app showed talking, Them when it showed none */
-const who = (l: { track: string; speaker?: string | null }): string => (l.track === 'me' ? t('You') : l.speaker || t('Them'))
+const who = transcriptSpeaker
/** The lines of a meeting, live while it records; `live` holds the lines that arrived while watching */
-function useLines(id: string) {
+function useLines(id: string,replacing:boolean) {
+ const [draft,setDraft]=useState<Line[]>([])
+ const draftRef=useRef<Line[]>([])
+ draftRef.current=draft
+ useEffect(()=>{
+ let active=true,revision=0
+ setDraft([])
+ if(!replacing)return
+ const load=()=>{const request=++revision;void window.yogurt.transcript.draft(id).then(lines=>{
+ if(!active||request!==revision)return
+ for(const line of lines)live.current.add(key(line))
+ setDraft(lines)
+ }).catch(console.error)}
+ const off=window.yogurt.transcript.onDraft(changed=>{if(changed===id)load()})
+ load();return()=>{active=false;off()}
+ },[id,replacing])
const [lines, setLines] = useState<Line[]>([])
const [loaded, setLoaded] = useState(false)
const live = useRef(new Set<string>())
useEffect(() => {
- let active = true
+ let active = true,epoch=0
setLoaded(false); setLines([]); live.current = new Set()
const add = (more: Line[], arriving: boolean) => setLines((cur) => {
const seen = new Set(cur.map(key))
@@ -42,19 +58,22 @@ function useLines(id: string) {
return fresh.length ? [...cur, ...fresh].sort((a, b) => a.startMs - b.startMs) : cur
})
const off = window.yogurt.transcript.onSegment((l) => add([l], true))
- void window.yogurt.transcript.get(id, { hidden: true }).then((saved) => { if (active) { add(saved, false); setLoaded(true) } })
+ void window.yogurt.transcript.get(id, { hidden: true }).then((saved) => { if (active&&epoch===0) { add(saved, false); setLoaded(true) } })
// names settled after the meeting, or lines hidden or shown again: the saved lines replace the ones shown
const offSpeakers = window.yogurt.transcript.onSpeakers((m) => {
if (m !== id) return
+ const requestEpoch=epoch
void window.yogurt.transcript.get(id, { hidden: true }).then((saved) => setLines((cur) => {
+ if(!active||requestEpoch!==epoch)return cur
const fresh = new Map(saved.map((l) => [key(l), l]))
const have = new Set(cur.map(key))
return [...cur.map((l) => fresh.get(key(l)) ?? l), ...saved.filter((l) => !have.has(key(l)))].sort((a, b) => a.startMs - b.startMs)
}))
})
- return () => { active = false; off(); offSpeakers() }
+ const offReplaced=window.yogurt.transcript.onReplaced?.(changed=>{if(changed===id){epoch++;setLoaded(true);if(draftRef.current.length)setLines(draftRef.current);void window.yogurt.transcript.get(id,{hidden:true}).then(saved=>{if(active)setLines(saved)})}})
+ return () => { active = false; off(); offSpeakers();offReplaced?.() }
}, [id])
- return { lines, live, loaded }
+ return { lines, draft, live, loaded }
}
/**
@@ -135,7 +154,7 @@ const Row = memo(function Row({ line: l, focused, name, playing, playable, focus
role={playable ? 'button' : undefined} aria-label={playable ? t('Play from {time}, {name}: {text}', { time, name, text: l.text }) : undefined}
tabIndex={playable ? (focusable ? 0 : -1) : undefined} onFocus={(e) => { if (e.target === e.currentTarget) onFocusLine(k) }}
onClick={(e) => onPlay(l, e)} title={time}
- data-hidden={l.hidden || undefined} data-focused={focused || undefined}
+ data-previous={l.previous||undefined} data-hidden={l.hidden || undefined} data-focused={focused || undefined}
className={`line ${arrived === 'fade' ? 'line-in' : arrived === 'settle' ? 'line-settle' : ''} ${playable ? 'line-playable cursor-pointer' : ''}`}>
<span data-testid="transcript-text">
{l.text}
@@ -149,12 +168,13 @@ const Row = memo(function Row({ line: l, focused, name, playing, playable, focus
* The meeting's transcript: each turn carries who said it, following new lines
* while it records; after the meeting a line plays from that moment, and the player sits at the bottom. The header searches it.
*/
-export function Transcript({ id, recording, inline = false, active = true, onClose, focus, toolbar }: {
- id: string; recording: boolean; inline?: boolean; active?: boolean; toolbar?: HTMLElement | null; onClose?: () => void
+export function Transcript({ id, notice, processing=false, replacing=false, recording, inline = false, active = true, onClose, focus, toolbar }: {
+ id: string; notice?:ReactNode; processing?:boolean; replacing?:boolean; recording: boolean; inline?: boolean; active?: boolean; toolbar?: HTMLElement | null; onClose?: () => void
/** a line to show and mark (an answer's source): ms into the meeting; seq: each time it is asked for */
focus?: { ms: number; match?: string; seq: number }
}) {
- const { lines: allLines, live, loaded } = useLines(id)
+ const { lines:savedLines, draft, live, loaded } = useLines(id,replacing)
+ const allLines=useMemo(()=>replacing?transcriptReplacement(savedLines,draft):savedLines,[savedLines,draft,replacing])
const loadingPhase = useLoadingState(!loaded)
const { live: liveSaid, previewed } = useLive(id, recording)
// the mic's copy of the call (hidden as an echo) never shows
@@ -169,7 +189,7 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
const [tracks, setTracks] = useState<Array<'me' | 'them'>>([])
useEffect(() => {
setTracks([])
- if (recording) return
+ if (recording || processing) return
let on = true
let deleted = false
const off = window.yogurt.audio.onDeleted(changed => {
@@ -179,11 +199,12 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
}
deleted = true; setTracks([]); setAudioOn(false); onTime(null)
})
- void window.yogurt.audio.tracks(id).then((t) => { if (on && !deleted) setTracks(t) })
- return () => { on = false; off() }
- }, [id, recording])
+ const load=()=>void window.yogurt.audio.tracks(id).then(t=>{if(on&&!deleted)setTracks(t)}).catch(console.error)
+ load();const offMeeting=window.yogurt.meetings.onChange(load)
+ return () => { on = false; off(); offMeeting() }
+ }, [id, recording, processing])
const player = useRef<PlayerHandle>(null)
- const playable = tracks.length > 0
+ const playable = !processing && tracks.length > 0
const playbackDock = useRef<HTMLDivElement>(null)
const [playbackInset, setPlaybackInset] = useState(0)
const visibility = useRef<ReturnType<typeof attachPlayerVisibility> | null>(null)
@@ -221,6 +242,14 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
visibility.current = controls
return () => { controls.dispose(); visibility.current = null }
}, [id, active, playable])
+ const replacementFollow=useRef(true)
+ useLayoutEffect(()=>{if(replacing){replacementFollow.current=true;if(list.current)list.current.scrollTop=0}},[id,replacing])
+ useLayoutEffect(()=>{
+ if(!replacing||!processing||!active||finding||!replacementFollow.current||!draft.length)return
+ const line=[...draft].sort((a,b)=>a.startMs-b.startMs).at(-1)!
+ const row=list.current?.querySelector<HTMLElement>(`[data-key="${CSS.escape(key(line))}"]`)
+ row?.scrollIntoView({block:'nearest'})
+ },[draft,replacing,processing,active,finding])
const stick = useRef(rememberedScroll(scrollKey) === undefined)
const [behind, setBehind] = useState(false)
const onScroll = () => {
@@ -292,6 +321,7 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
}
// a wheel, a key, a touch or a press (the scroll bar too): a glide of Yogurt's still moving is stopped, so it can't carry them back
const theirs = () => {
+ replacementFollow.current=false
handsOn.current = performance.now()
ours.current?.stop()
ours.current = null
@@ -319,7 +349,7 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
focusDone.current = focus.seq
stick.current = false
setShowAll(true)
- setFocusedKey(key(l)); setFocusKey(key(l))
+ setFocusedKey(focus.match&&!match?undefined:key(l)); setFocusKey(key(l))
requestAnimationFrame(() => { visibility.current?.programmatic(); rowOf(key(l))?.scrollIntoView({ block: 'center' }) })
}, [focus?.seq, lines, active])
useEffect(() => {
@@ -356,9 +386,11 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
className={inline ? 'transcript-inline' : 'chat-in pointer-events-auto absolute inset-x-0 bottom-1 z-20 mx-auto flex h-[min(44vh,480px)] w-[min(720px,calc(100%-48px))] flex-col rounded-xl border border-line bg-float shadow-[var(--shadow)]'}>
<TranscriptFind key={id} lines={lines} list={list} active={active} playbackInset={playbackInset} beforeScroll={() => visibility.current?.programmatic()} onFinding={find} toolbar={toolbar} onClose={!inline ? onClose : undefined} />
<div className="transcript-scroll-wrap relative flex min-h-0 flex-1 flex-col">
- <ScrollFade enabled={active && loaded}><ol data-loaded={loaded} data-loading-phase={loadingPhase} data-testid="transcript" ref={list} onScroll={onScroll} onWheel={theirs} onTouchStart={theirs} onPointerDown={theirs} onKeyDownCapture={theirs} onKeyDown={onKeyDown} className="loading-content transcript-loading-content flex flex-1 flex-col gap-2 overflow-y-auto px-4 pb-4 pt-2 text-sm leading-[1.55]">
- {loadingPhase !== 'ready' && <li className="loading-placeholder"><Loading layout="transcript" /></li>}
- {loaded && allLines.length === 0 && liveSaid.length === 0 && <li data-testid="transcript-empty" className="note-empty empty-state"><div className="empty-state-content"><div className="empty-tile"><AudioLines size={28} strokeWidth={1.5} aria-hidden="true" /></div>{t('Nothing heard yet.')}</div></li>}
+ <ScrollFade enabled={active && loaded}><ol data-loaded={loaded} data-loading-phase={loadingPhase} data-testid="transcript" data-replacing={replacing&&processing} ref={list} onScroll={onScroll} onWheel={theirs} onTouchStart={theirs} onPointerDown={theirs} onKeyDownCapture={theirs} onKeyDown={onKeyDown} className="loading-content transcript-loading-content flex flex-1 flex-col gap-2 overflow-y-auto px-4 pb-4 pt-2 text-sm leading-[1.55]">
+ {notice&&<li className="transcription-notice-slot">{notice}</li>}
+ {processing&&!replacing&&timeline.length===0&&<li className="transcription-placeholder" aria-hidden="true"><p className="turn-head"><span className="loading-bar" style={{width:42}}/></p><p className="bubble bubble-them"><span className="loading-bar" style={{width:180}}/></p></li>}
+ {loadingPhase !== 'ready' && timeline.length===0 && <li className="loading-placeholder"><Loading layout="transcript" /></li>}
+ {loaded && !processing && allLines.length === 0 && liveSaid.length === 0 && <li data-testid="transcript-empty" className="note-empty empty-state"><div className="empty-state-content"><div className="empty-tile"><AudioLines size={28} strokeWidth={1.5} aria-hidden="true" /></div>{t('Nothing heard yet.')}</div></li>}
{drawn.earlier > 0 && <li className="flex justify-center"><button data-testid="transcript-earlier" onClick={() => { visibility.current?.programmatic(); stick.current = false; setShowAll(true) }} className="ghost-btn">{t('Show earlier lines')}</button></li>}
{drawn.runs.map(run => <Fragment key={run.k}>
{turns(run.lines).map((turn) => {
@@ -381,7 +413,7 @@ export function Transcript({ id, recording, inline = false, active = true, onClo
return (
<Fragment key={k}>{i > 0 && ' '}
<Row line={x} focused={k === focusedKey} name={who(x)}
- playing={k === shownKey} playable={playable} focusable={k === tabKey} arrived={live.current.has(k) ? (previewed(x) ? 'settle' : 'fade') : null} onPlay={onPlay} onFocusLine={setFocusKey} />
+ playing={k === shownKey} playable={playable} focusable={k === tabKey} arrived={!x.previous&&live.current.has(k) ? (previewed(x) ? 'settle' : 'fade') : null} onPlay={onPlay} onFocusLine={setFocusKey} />
</Fragment>
)
})}
diff --git a/app/src/renderer/src/components/Transcription.tsx b/app/src/renderer/src/components/Transcription.tsx
new file mode 100644
index 00000000..54509f7e
--- /dev/null
+++ b/app/src/renderer/src/components/Transcription.tsx
@@ -0,0 +1,23 @@
+import { AudioLines } from 'lucide-react'
+import { t } from '../../../shared/i18n'
+import { transcriptionLabel, type TranscriptionState } from '../../../shared/transcription'
+import { Loader } from './Icons'
+import { Swap, SwapText } from './Swap'
+
+export function TranscriptionControl({state,onStop}:{state:TranscriptionState;onStop:()=>void}) {
+ const title=state==='preparing'?t('Cancel'):t('Stop transcription')
+ return <button className="workspace-button note-resume-action" data-processing="true" aria-busy="true" data-testid="transcription-stop" aria-label={title} title={title} onClick={onStop}>
+ <Swap show="busy" options={{busy:<span className="summary-stop-icon"><Loader size={14}/><span className="summary-stop-square"/></span>}}/>
+ <SwapText text={state==='preparing'?t('Preparing audio…'):t('Transcribing…')}/>
+ </button>
+}
+export function TranscriptionNotice({state,hasLines,onContinue,disabled}:{state?:TranscriptionState;hasLines:boolean;onContinue:()=>void;disabled?:boolean}) {
+ if(state==='waiting-model'||state==='waiting-recording')return <p className="transcription-notice text-xs text-muted" role="status">{transcriptionLabel(state)}</p>
+ if(state&& !['stopped','error'].includes(state))return null
+ return <div className="summary-stopped transcription-notice" data-testid="transcription-notice">
+ {state&&<p role="status">{transcriptionLabel(state)}</p>}
+ <button className="summary-generate flex items-center gap-2.5 rounded-xl px-3 py-2 text-start text-sm whitespace-nowrap text-ink hover:bg-[var(--line)] focus-visible:bg-[var(--line)] disabled:opacity-50" data-testid="transcription-continue" disabled={disabled} onClick={onContinue}>
+ <AudioLines size={15} className="text-muted" aria-hidden="true"/>{hasLines?t('Continue transcription'):t('Transcribe')}
+ </button>
+ </div>
+}
diff --git a/app/src/renderer/src/components/Workspace.tsx b/app/src/renderer/src/components/Workspace.tsx
index 043de774..5082dd0f 100644
--- a/app/src/renderer/src/components/Workspace.tsx
+++ b/app/src/renderer/src/components/Workspace.tsx
@@ -1,3 +1,4 @@
+import { AudioUploadHost } from './AudioUpload'
import { toasts } from './TrashToast'
import { askDestination } from '../../../shared/askContext'
import * as Sidebar from '@animate-ui/react/primitives/sidebar'
@@ -115,6 +116,7 @@ export function Workspace({ route, meeting, folders, go, back, forward, search,
<div id="workspace-actions" className="workspace-toolbar-actions" />
</header>
{children}
+ <AudioUploadHost />
</div>
</div>
diff --git a/app/src/renderer/src/screens/Home.tsx b/app/src/renderer/src/screens/Home.tsx
index 205841f4..c075acd2 100644
--- a/app/src/renderer/src/screens/Home.tsx
+++ b/app/src/renderer/src/screens/Home.tsx
@@ -1,3 +1,4 @@
+import { transcriptionLabel } from '../../../shared/transcription'
import { LoadingContent } from '../components/LoadingContent'
import { StartRecording } from '../components/StartRecording'
import { Mic } from '../components/Icons'
@@ -209,7 +210,7 @@ export function PastCard({ c, onOpen, openFolder, openFolders, more, when, fixed
<button data-meeting-id={c.id} disabled={loading} onClick={() => onOpen(c.id)} aria-pressed={selected} className="native-meeting-link">
<span className="meeting-content">
<span className={`meeting-identity ${recording ? 'recording' : ''}`} aria-hidden="true">{loading ? null : recording ? <Mic size={16} /> : c.attendees.length > 1 ? <Users size={16} /> : initials || <FileText size={16} />}</span>
- <span className="meeting-description"><strong>{loading ? <span className="loading-bar" style={{ width: c.title.length * 6, maxWidth: '85%' }} /> : c.title}</strong><span data-testid={loading ? undefined : "past-note-attendees"} title={c.attendees.map((p) => p.name).join(', ') || undefined}>{loading ? <span className="loading-bar" style={{ width: 110 }} /> : c.attendees.length ? peopleSummary(c.attendees, me) : t('Personal notes')}</span>
+ <span className="meeting-description"><strong>{loading ? <span className="loading-bar" style={{ width: c.title.length * 6, maxWidth: '85%' }} /> : c.title}</strong><span data-testid={loading ? undefined : "past-note-attendees"} title={c.attendees.map((p) => p.name).join(', ') || undefined}>{loading ? <span className="loading-bar" style={{ width: 110 }} /> : transcriptionLabel(c.transcriptionState) || (c.attendees.length ? peopleSummary(c.attendees, me) : t('Personal notes'))}</span>
</span>
</span>
<span className="meeting-meta row-swap-meta">{recording ? <span className="meeting-live"><Circle size={6} fill="currentColor" />{c.paused ? t('Paused') : t('Recording')}</span> : <><time>{loading ? <span className="loading-bar" style={{ width: 45 }} /> : when ?? timeOf(c.startedAt)}</time>{minutes != null && <small data-testid="past-note-duration">{loading ? <span className="loading-bar" style={{ width: 26 }} /> : t('{count} min', { count: minutes })}</small>}</>}</span>
diff --git a/app/src/renderer/src/screens/Note.tsx b/app/src/renderer/src/screens/Note.tsx
index 461bb3d0..f0c5c742 100644
--- a/app/src/renderer/src/screens/Note.tsx
+++ b/app/src/renderer/src/screens/Note.tsx
@@ -1,3 +1,5 @@
+import { TranscriptionControl, TranscriptionNotice } from '../components/Transcription'
+import { transcriptionBusy } from '../../../shared/transcription'
import { citationTargetIndex } from '../../../shared/citations'
import { NoteReadingPane } from '../components/NoteReadingPane'
import type { LibrarySource } from '../../../shared/types'
@@ -24,7 +26,8 @@ import { Mic, Pause, Play, Sparkles, Loader } from '../components/Icons'
import { ShareMenu } from '../components/ShareMenu'
import { NoteMenu, summaryAction } from '../components/NoteMenu'
import { DeleteNote } from '../components/DeleteNote'
-import { moveToTrash } from '../components/TrashToast'
+import { openAudioUpload } from '../components/AudioUpload'
+import { moveToTrash, toasts } from '../components/TrashToast'
import { useSummaryPresentation } from '../summaryPresentation'
import { useSmoothText } from '../useSmoothText'
import { NoteAutosave, registerAutosave } from '../noteAutosave'
@@ -95,8 +98,9 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
}
const off = window.yogurt.transcript.onSegment(line => { if (line.meetingId === id && line.text.trim()) { revision++; setHasTranscript(true) } })
const changed = window.yogurt.transcript.onSpeakers(meetingId => { if (meetingId === id) load() })
+ const replaced=window.yogurt.transcript.onReplaced?.(meetingId=>{if(meetingId===id)load()})
load()
- return () => { active = false; off(); changed() }
+ return () => { active = false; off(); changed();replaced?.() }
}, [id])
useEffect(() => {
let active = true, received = false
@@ -245,6 +249,10 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
if (m.trashedAt == null && !m.stopSavePending && (m.state === 'stopped' || m.state === 'done')) void resumeRecording()
}, [onResumeRequested, m, notes, summarizing, starting])
+ const [hasAudio,setHasAudio]=useState(false)
+ useEffect(()=>{let active=true;const load=()=>void window.yogurt.audio.tracks(id).then(tracks=>{if(active)setHasAudio(!!tracks.length)});load();const off=window.yogurt.meetings.onChange(load);return()=>{active=false;off()}},[id])
+ const openedTranscription=useRef<string | undefined>(undefined)
+ useLayoutEffect(()=>{if(m&&openedTranscription.current!==id){openedTranscription.current=id;if(transcriptionBusy(m.transcriptionState))setPrimary('transcript')}},[m,id])
if (!m || !notes) return <LoadingContent pending skeleton={<Loading layout="note" />} className="loading-note-frame" />
const recording = m.state === 'recording'
/** in the Trash: it can be read and restored, not recorded into */
@@ -321,7 +329,11 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
void window.yogurt.notes.writeAgain(id, note)
}
const hasSummary = !!notes.enhanced?.trim()
+ const transcribing=transcriptionBusy(m.transcriptionState)
+ const runTranscript=async(again=false)=>{if(!await saveAll())return;try{const started=await window.yogurt.transcript.run(id,again);if(started)setPrimary('transcript')}catch{toasts.add({title:t("Yogurt couldn't transcribe this file.")})}}
+ const transcriptReason=recording||m.stopSavePending?t('Available after recording'):transcribing?t('Transcribing…'):summarizing?t('Summarizing…'):!hasAudio?t('Audio is unavailable.'):undefined
const generation = summaryAction({ hasSummary, hasContent: hasTranscript || !!notes.mine.trim(), recording, busy: summarizing, downloading: !!(setup?.notesDownloading || setup?.notesError), trashed })
+ if(generation&&transcribing)generation.reason=t('Transcribing…')
const requestRewrite = () => {
if (!generation || generation.reason) return
if (hasSummary) setRewriteOpen(true)
@@ -329,7 +341,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
}
return (
- <LoadingContent pending={false} skeleton={<Loading layout="note" />} className="loading-note-frame"><div data-testid="note" className="document-main relative flex h-full bg-bg">
+ <LoadingContent onReady={()=>document.dispatchEvent(new CustomEvent('audio-upload-note-ready',{detail:id}))} pending={false} skeleton={<Loading layout="note" />} className="loading-note-frame"><div data-testid="note" className="document-main relative flex h-full bg-bg">
{resumeConfirm && <Modal testId="resume-confirm" role="alertdialog" title={t('Record more in this note?')}
description={t('Your notes, transcript, and previous audio are kept. Your edited summary will be replaced when you finish recording.')}
onCancel={() => setResumeConfirm(false)}>
@@ -339,7 +351,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
</div>
</Modal>}
<div data-testid="note-topbar" className="note-topbar no-drag fixed end-4 top-[10px] z-[60]">
- <NoteMenu key={id} generation={generation} hasSummary={hasSummary} edited={notes.edited || editedHere} rewriteOpen={rewriteOpen} setRewriteOpen={setRewriteOpen}
+ <NoteMenu key={id} transcription={{reason:transcriptReason,run:()=>void runTranscript(true)}} generation={generation} hasSummary={hasSummary} edited={notes.edited || editedHere} rewriteOpen={rewriteOpen} setRewriteOpen={setRewriteOpen}
onWriteAgain={(note) => { if (!generation || generation.reason) return; pickPrimary('notes'); pick('enhanced'); void writeAgain(note) }} recording={recording} savePending={m.stopSavePending} trashed={trashed} onRename={() => setRenaming(true)} onDelete={() => { void saveAll().then((saved) => { if (!saved) return; if (trashed) setDeleting(true); else void moveToTrash(id, `/note/${id}`) }) }}
folders={(close) => <FolderPicker testId="note-menu-folders" meetingId={id} onNew={() => { close(); setNamingFolder(true) }} />} />
</div>
@@ -368,7 +380,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
</button>
</>}
{finishing && <span data-testid="note-finishing" role="status" className="note-finishing">{t('Finishing…')}</span>}
- {!finishing && (m.state === 'stopped' || m.state === 'done') && !m.stopSavePending && !trashed && <button data-testid="note-resume" disabled={starting} aria-busy={summarizing} data-processing={summarizing} onClick={() => { if (summarizing) void window.yogurt.notes.stop(id).catch(console.error); else void resumeRecording() }}
+ {!transcribing && !finishing && (m.source !== 'audio-file' || summarizing) && (m.state === 'stopped' || m.state === 'done') && !m.stopSavePending && !trashed && <button data-testid="note-resume" disabled={starting} aria-busy={summarizing} data-processing={summarizing} onClick={() => { if (summarizing) void window.yogurt.notes.stop(id).catch(console.error); else void resumeRecording() }}
aria-label={summarizing ? t('Stop summary') : t('Resume recording')} className="workspace-button note-resume-action" title={summarizing ? t('Stop summary') : t('Resume recording in this note')}>
<Swap show={summarizing ? 'busy' : 'mic'} options={{ mic: <Mic size={14} />, busy: <span className="summary-stop-icon"><Loader size={14} /><span className="summary-stop-square" /></span> }} />
<SwapText text={summarizing ? t('Summarizing…') : starting ? t('Preparing…') : t('Resume recording')} />
@@ -377,6 +389,7 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
<Mic size={14} strokeWidth={1.75} aria-hidden="true" />{starting ? t('Starting…') : t('Start recording')}
</button>}
</div>
+ {transcribing&&<TranscriptionControl state={m.transcriptionState!} onStop={()=>void window.yogurt.transcript.stop(id).catch(()=>toasts.add({title:t("Yogurt couldn't transcribe this file.")}))}/>}
<ShareMenu id={id} shown={shown} status={notes.status} hasEnhanced={notes.enhanced != null} beforeUse={saveAll} />
</div>
</div>
@@ -419,7 +432,8 @@ export function Note({ id, onTitleChange, at, folderSuggestion, onSource, onResu
/> : <Enhanced key={id} presentation={summaryState} focus={primary === 'notes' && at?.ms === null ? at : undefined} notes={notes} disabled={starting} onChange={(md) => { setEditedHere(true); const next = { ...current.current!, enhanced: md }; current.current = next; setNotes(next); enhancedSave.change(md) }} onBlur={enhancedSave.flush} onRetry={requestRewrite} />}
</NoteReadingPane>
{(primary === 'transcript' || transcriptVisited) && <section hidden={primary !== 'transcript'} id="note-transcript-panel" role="tabpanel" aria-labelledby="note-transcript-tab" className="note-content note-transcript-pane">
- <Transcript id={id} recording={recording} active={primary === 'transcript'} inline toolbar={transcriptToolbar} focus={at?.ms != null ? { ...at, ms: at.ms } : undefined} />
+ <Transcript notice={<>{(hasAudio&&(m.transcriptionPending||!hasTranscript)||m.transcriptionState==='waiting-model'||m.transcriptionState==='waiting-recording')&&<TranscriptionNotice state={m.transcriptionState} hasLines={hasTranscript} onContinue={()=>void runTranscript()} disabled={recording||!!m.stopSavePending}/>}
+ {!hasAudio&&m.transcriptionState==='error'&&<InlineError testId="upload-preparation-failed"><span>{t("Yogurt couldn't read this audio file.")}</span><button className="text-action" onClick={()=>void openAudioUpload()}>{t('Upload a file')}</button></InlineError>}</>} id={id} processing={transcribing} replacing={!!m.transcriptionAgain} recording={recording} active={primary === 'transcript'} inline toolbar={transcriptToolbar} focus={at?.ms != null ? { ...at, ms: at.ms } : undefined} />
</section>}
</div>
</div>
diff --git a/app/src/renderer/src/styles.css b/app/src/renderer/src/styles.css
index b4c10e48..abc2f724 100644
--- a/app/src/renderer/src/styles.css
+++ b/app/src/renderer/src/styles.css
@@ -915,8 +915,8 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
.summary-stop-icon { display:inline-grid;place-items:center;width:14px;height:14px; }
.summary-stop-icon>* { grid-area:1/1;transition:opacity var(--dur-base) var(--ease-out); }
.summary-stop-square { width:10px;height:10px;border-radius:2px;background:currentColor;opacity:0; }
-.note-resume-action[data-processing=true] { cursor:pointer; }
-.note-resume-action[data-processing=true]:hover { background:var(--float); }
+.note-resume-action[data-processing=true] { cursor:pointer;box-shadow:0 1px 2px #0000000A; }
+.note-resume-action[data-processing=true]:hover { background:var(--control-hover); }
.note-resume-action:is(:hover,:focus-visible) .summary-stop-icon>svg { opacity:0; }
.note-resume-action:is(:hover,:focus-visible) .summary-stop-square { opacity:1; }
.summary-stopped { display:flex;flex-direction:column;align-items:flex-start;gap:8px;color:var(--muted);font-size:13px; }
@@ -950,3 +950,47 @@ html:not(.widget) button:focus-visible, html:not(.widget) input:focus-visible {
.workspace-icon { width:28px;height:28px;padding:0; }
.modal-actions>.workspace-button { width:100%; }
.widget-preview { --float:var(--pill);--ink:var(--pill-ink);--line:var(--widget-line);--control-hover:#FFFFFF14;--control-pressed:#FFFFFF20;--focus:var(--pill-accent); }
+
+.audio-upload-fields { display:flex;flex-direction:column;gap:14px;padding:0 20px 20px; }
+.audio-upload-file { display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);min-width:0; }
+.audio-upload-file>span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.audio-upload-file>svg { flex:none; }
+.audio-upload-fields label { display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted); }
+.audio-upload-fields input { min-width:0;width:100%;height:34px;padding:6px 9px;border:1px solid var(--line);border-radius:6px;background:var(--card);font-size:13px;color:var(--ink); }
+.audio-upload-progress { display:flex;align-items:center;gap:10px;min-height:20px;font-size:12px;color:var(--muted); }
+.audio-upload-progress progress { flex:1;min-width:0;height:4px;border:0;border-radius:2px;overflow:hidden;appearance:none; }
+.audio-upload-progress progress::-webkit-progress-bar { background:var(--line); }
+.audio-upload-progress progress::-webkit-progress-value { background:var(--accent); }
+
+
+.transcription-notice { padding:0 0 12px; }
+.transcription-placeholder { order:1;display:flex;flex-direction:column;align-items:flex-start;gap:5px; }
+.line[data-previous=true] { opacity:.45; }
+
+.app-modal[data-testid=audio-upload] { width:min(380px,calc(100vw - 40px)); }
+.audio-upload-actions { flex-direction:row;align-items:center;justify-content:flex-end;gap:16px;font-size:12px; }
+.audio-upload-actions>.workspace-button { width:auto; }
+.audio-upload-date-row { display:flex;align-items:center;gap:0;border:1px solid var(--line);border-radius:6px;padding:0;min-width:0;height:34px;color:var(--muted);font-size:12px; }
+.audio-upload-date { display:flex;align-items:center;gap:8px;min-width:0;color:var(--ink);font-size:12px;padding:0 10px;flex:1;border-start-start-radius:5px;border-end-start-radius:5px; }
+.audio-upload-date span { overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
+.audio-upload-date-row small { font-size:11px;white-space:nowrap;padding-inline:9px; }
+.audio-upload-date-positioner { z-index:110; }
+.audio-upload-date-picker { position:relative;border:1px solid var(--line);border-radius:9px;background:var(--float);color:var(--ink);box-shadow:var(--shadow);width:var(--anchor-width);max-width:calc(100vw - 24px);max-height:var(--available-height);overflow:auto;padding:10px; }
+.audio-upload-date-picker .agenda-navigation { margin:0 0 4px;display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:1px; }
+.audio-upload-date-picker .agenda-month { grid-column:span 5;margin:0;padding-inline:10px; }
+.audio-upload-date-picker .agenda-navigation button { justify-self:center; }
+.audio-upload-date-picker .audio-upload-month { padding:4px 0;margin-bottom:0;border-bottom:0;gap:3px 1px;text-align:center; }
+.audio-upload-month button { padding:0; }
+.audio-upload-month button:disabled { opacity:.25;cursor:default; }
+.audio-upload-month button[data-outside=true] { opacity:.45; }
+.audio-upload-month button:disabled:hover b { background:transparent; }
+.audio-upload-month button:focus-visible b { outline:2px solid var(--focus);outline-offset:1px; }
+.audio-upload-date-row .audio-upload-time { width:88px;min-width:0;height:32px;padding:0 8px;border:0;border-inline-start:1px solid var(--line);border-radius:0;background:transparent;flex:none;color:var(--ink);font-size:12px;font-variant-numeric:tabular-nums; }
+.audio-upload-date:focus-visible,.audio-upload-time:focus-visible { outline:2px solid var(--focus);outline-offset:-2px; }
+.audio-upload-time:hover:not(:disabled) { background:var(--control-hover); }
+.audio-upload-submit { position:relative; }
+.audio-upload-submit[aria-busy=true]:disabled { opacity:1;cursor:wait; }
+.audio-upload-submit[aria-busy=true] .audio-upload-submit-label { opacity:0; }
+.audio-upload-submit-icon { position:absolute;inset:0;display:flex;align-items:center;justify-content:center; }
+.audio-upload-date-picker .audio-upload-month button:focus-visible { outline:none; }
+.transcription-notice-slot:empty { display:none; }
diff --git a/app/src/renderer/src/windows/Widget.tsx b/app/src/renderer/src/windows/Widget.tsx
index 7f60d641..5b8a4bba 100644
--- a/app/src/renderer/src/windows/Widget.tsx
+++ b/app/src/renderer/src/windows/Widget.tsx
@@ -1,3 +1,4 @@
+import { transcriptSpeaker } from '../../../shared/transcript'
import { SPEAKER_COLORS } from '../../../shared/speakerColors'
import { widgetDragDelta, isWidgetClick, type WidgetPress } from '../../../shared/widgetGesture'
import { Loading } from '../components/Loading'
@@ -213,7 +214,7 @@ function Preview({ view, open }: { view: WidgetView; open: boolean }) {
{!loaded ? <Loading layout="transcript" testId="widget-preview-loading" /> : !grouped.length && <p className="widget-preview-empty">{failed ? t("Couldn't load the transcript. Open Yogurt to try again.") : t('Listening for speech…')}</p>}
{grouped.map(turn => {
const first = turn[0], me = first.track === 'me'
- const who = me ? t('You') : first.speaker || t('Them')
+ const who = transcriptSpeaker(first)
const color = me || !('speakerColor' in first) ? undefined : first.speakerColor
return <div key={`${first.track}:${first.startMs}`} className="widget-preview-turn" data-me={me}>
<span className="widget-preview-speaker" data-color={color} data-folder-color={color === undefined ? undefined : SPEAKER_COLORS[color]}>{who}</span>
diff --git a/app/src/shared/agendaNote.ts b/app/src/shared/agendaNote.ts
index 9165ff5f..cefcc5b3 100644
--- a/app/src/shared/agendaNote.ts
+++ b/app/src/shared/agendaNote.ts
@@ -1,6 +1,6 @@
import type { AgendaEvent, MeetingCard } from './types'
-export const resumesNote = (note: AgendaEvent['note']): boolean => note?.state === 'stopped' || note?.state === 'done'
+export const resumesNote = (note: AgendaEvent['note']): boolean => note?.source !== 'audio-file' && (note?.state === 'stopped' || note?.state === 'done')
export function agendaNoteAction(event: AgendaEvent, recording: MeetingCard | undefined, now: number): 'start' | 'open' | 'prepare' | null {
const note = recording?.eventId === event.id ? recording : event.note
diff --git a/app/src/shared/audioUpload.ts b/app/src/shared/audioUpload.ts
new file mode 100644
index 00000000..3e11c75c
--- /dev/null
+++ b/app/src/shared/audioUpload.ts
@@ -0,0 +1,63 @@
+/** A reserved marker, never a person's name or a me/them attribution. */
+export const AUDIO_SPEAKER = '\u001faudio'
+export type AudioUploadFile = { token: string; name: string; title: string; modifiedAt: number; size: number }
+export type AudioUploadStatus = {
+ phase: 'reading' | 'preparing' | 'transcribing' | 'waiting-model' | 'waiting-recording' | 'cancelling' | 'done' | 'error'
+ fraction?: number
+ meetingId?: string
+ error?: 'format' | 'read' | 'transcribe' | 'busy'
+}
+/** Date fields use local calendar days, not UTC's possibly adjacent day. */
+export function uploadDate(at: number): string {
+ const date = new Date(at)
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
+}
+export function uploadStartedAt(value: string, original: number): number | undefined {
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return
+ const [year, month, day] = value.split('-').map(Number), at = new Date(original)
+ at.setFullYear(year, month - 1, day)
+ if (year < 1900 || uploadDate(+at) !== value) return
+ return +at
+}
+
+export function uploadTime(at: number): string {
+ const d = new Date(at)
+ return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`
+}
+/** Changing the date keeps the displayed local time; a time edit uses the chosen minute. */
+export function uploadDateTime(date: string, time: string, original: number): number | undefined {
+ if (!/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(time)) return
+ const at = uploadStartedAt(date, original)
+ if (at == null) return
+ if (time === uploadTime(original)) return at
+ const [hours, minutes] = time.split(':').map(Number), value = new Date(at)
+ value.setHours(hours, minutes, 0, 0)
+ return +value
+}
+
+export function uploadDayAllowed(at:number,now=Date.now()) {
+ return Number.isFinite(at)&&new Date(at).getFullYear()>=1900&&new Date(at).setHours(0,0,0,0)<=new Date(now).setHours(0,0,0,0)
+}
+/** One clock field accepts the local day period and either local digits or ASCII. */
+export function uploadClock(value:string,at:number,locale:string):number|undefined {
+ let text=value.trim().toLocaleLowerCase(locale).replace(/[\u200e\u200f\u061c]/g,'').replace(/[٠-٩]/g,c=>String(c.charCodeAt(0)-0x660)).replace(/[۰-۹]/g,c=>String(c.charCodeAt(0)-0x6f0))
+ for(let n=0;n<10;n++)text=text.replaceAll(new Intl.NumberFormat(locale,{useGrouping:false}).format(n),String(n))
+ const periods=[0,12].map(hour=>new Intl.DateTimeFormat(locale,{hour:'numeric',hour12:true}).formatToParts(new Date(2026,0,1,hour)).find(p=>p.type==='dayPeriod')?.value.toLocaleLowerCase(locale))
+ let half:number|undefined
+ for(const [i,period] of periods.entries())if(period&&text.includes(period)){half=i; text=text.replace(period,'').trim();break}
+ const match=/^(\d{1,2})\s*[:.:]\s*(\d{2})$/.exec(text)
+ if(!match)return
+ let hour=Number(match[1]);const minute=Number(match[2])
+ if(minute>59||hour>23||half!=null&&(hour<1||hour>12))return
+ if(half!=null)hour=hour%12+half*12
+ const next=new Date(at);next.setHours(hour,minute,0,0)
+ if(next.getHours()!==hour||next.getMinutes()!==minute)return
+ return +next
+}
+
+/** Arrow edits wrap within the chosen day; a missing daylight-saving time stays unchanged. */
+export function stepUploadClock(at:number,minutes:number):number {
+ const date=new Date(at),total=(date.getHours()*60+date.getMinutes()+minutes+1440)%1440
+ date.setHours(Math.floor(total/60),total%60,0,0)
+ return date.getHours()*60+date.getMinutes()===total?+date:at
+}
diff --git a/app/src/shared/citationCard.ts b/app/src/shared/citationCard.ts
index 54e2289c..2154d63a 100644
--- a/app/src/shared/citationCard.ts
+++ b/app/src/shared/citationCard.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from './audioUpload'
import type { LibrarySource } from './types'
import { mdToDoc, type PMNode } from './markdown'
import { citationExcerptLines, citationExcerptText, citationPassage, citationTargetIndex } from './citations'
@@ -46,7 +47,7 @@ export function citationCardPassage(source: LibrarySource, answerSentence: strin
// Strip only prefixes verified against actual speech, never infer a name from an arbitrary colon.
excerpt = citationExcerptText(excerpt).split('\n').map(text => {
for (const line of lines) {
- const prefix = `${line.track === 'me' ? 'You' : line.speaker || 'Them'}: `
+ const prefix = `${line.speaker === AUDIO_SPEAKER ? 'Audio' : line.track === 'me' ? 'You' : line.speaker || 'Them'}: `
if (text.startsWith(prefix) && (text.slice(prefix.length).startsWith(citationExcerptText(line.text)) || citationExcerptText(line.text).startsWith(text.slice(prefix.length)))) return text.slice(prefix.length)
}
return text
diff --git a/app/src/shared/exportNotes.ts b/app/src/shared/exportNotes.ts
index ba601b46..c690cada 100644
--- a/app/src/shared/exportNotes.ts
+++ b/app/src/shared/exportNotes.ts
@@ -1,3 +1,4 @@
+import { transcriptSpeaker } from './transcript'
/**
* Notes out of Yogurt: plain text and simple HTML for the clipboard (Gmail, Docs and Slack paste them cleanly), and a
* Markdown file with the notes and the transcript. Built from the same document the editor uses (markdown.ts), so
@@ -102,7 +103,7 @@ export function transcriptClipboard(lines: Segment[]): { text: string; html: str
// ---------- transcript ----------
/** Who said a line: You on the mic; on the other side the name the call showed, Them when it showed none */
-export const whoSaid = (l: Pick<Segment, 'track' | 'speaker'>): string => (l.track === 'me' ? t('You') : l.speaker || t('Them'))
+export const whoSaid = transcriptSpeaker
const text = (s: string, bold = false): PMNode => (bold ? { type: 'text', text: s, marks: [{ type: 'bold' }] } : { type: 'text', text: s })
const para = (...content: PMNode[]): PMNode => (content.length ? { type: 'paragraph', content } : { type: 'paragraph' })
diff --git a/app/src/shared/locales/ar.json b/app/src/shared/locales/ar.json
index a0572839..01554593 100644
--- a/app/src/shared/locales/ar.json
+++ b/app/src/shared/locales/ar.json
@@ -775,5 +775,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "لم يتمكن Yogurt من الوصول إلى هذا العنوان. تحقق من اتصالك ومن العنوان.",
"{name} is connected. You can change this any time in Settings.": "تم ربط {name}. يمكنك تغيير ذلك في أي وقت من الإعدادات.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "ترى \"Public address in iCal format\" فقط؟ أوقفت مؤسستك العناوين السرية، لذا لا يمكن ربط هذا التقويم بهذه الطريقة.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "هذا هو العنوان العام، ولا يعمل إلا إذا كان تقويمك عامًا. انسخ \"Secret address in iCal format\" بدلًا منه."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "هذا هو العنوان العام، ولا يعمل إلا إذا كان تقويمك عامًا. انسخ \"Secret address in iCal format\" بدلًا منه.",
+ "Upload a file": "رفع ملف",
+ "Audio": "الصوت",
+ "Transcribe": "نسخ الصوت",
+ "Preparing audio…": "جارٍ تجهيز الصوت…",
+ "Transcribing…": "جارٍ نسخ الصوت…",
+ "Waiting for the speech model": "بانتظار نموذج الكلام",
+ "Waiting for recording to finish": "بانتظار انتهاء التسجيل",
+ "Finish recording before uploading a file.": "أنه التسجيل قبل رفع ملف.",
+ "This audio format is not supported.": "صيغة الصوت هذه غير مدعومة.",
+ "Yogurt couldn't read this audio file.": "تعذّر على Yogurt قراءة ملف الصوت هذا.",
+ "Yogurt couldn't transcribe this file.": "تعذّر على Yogurt نسخ هذا الملف.",
+ "Reading the file…": "جارٍ قراءة الملف…",
+ "Start time": "وقت البدء",
+ "Transcription stopped.": "توقف التفريغ النصي.",
+ "Continue transcription": "متابعة التفريغ النصي",
+ "Transcribe again": "التفريغ النصي مجددًا",
+ "Stop transcription": "إيقاف التفريغ النصي",
+ "Audio is unavailable.": "الصوت غير متاح."
}
diff --git a/app/src/shared/locales/bn.json b/app/src/shared/locales/bn.json
index 27bee590..3b6c1fa8 100644
--- a/app/src/shared/locales/bn.json
+++ b/app/src/shared/locales/bn.json
@@ -707,5 +707,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt ওই ঠিকানায় পৌঁছাতে পারেনি। আপনার সংযোগ ও ঠিকানাটি দেখুন।",
"{name} is connected. You can change this any time in Settings.": "{name} যুক্ত হয়েছে। সেটিংসে যেকোনো সময় এটি বদলাতে পারেন।",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "শুধু \"Public address in iCal format\" দেখছেন? আপনার প্রতিষ্ঠান গোপন ঠিকানা বন্ধ করে রেখেছে, তাই এই ক্যালেন্ডারটি এভাবে যুক্ত করা যাবে না।",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "এটি পাবলিক ঠিকানা, যা শুধু আপনার ক্যালেন্ডার পাবলিক হলে কাজ করে। এর বদলে \"Secret address in iCal format\" কপি করুন।"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "এটি পাবলিক ঠিকানা, যা শুধু আপনার ক্যালেন্ডার পাবলিক হলে কাজ করে। এর বদলে \"Secret address in iCal format\" কপি করুন।",
+ "Upload a file": "একটি ফাইল আপলোড করুন",
+ "Audio": "অডিও",
+ "Transcribe": "লিখিত রূপ দিন",
+ "Preparing audio…": "অডিও প্রস্তুত হচ্ছে…",
+ "Transcribing…": "লিখিত রূপ তৈরি হচ্ছে…",
+ "Waiting for the speech model": "স্পিচ মডেলের অপেক্ষায়",
+ "Waiting for recording to finish": "রেকর্ডিং শেষ হওয়ার অপেক্ষায়",
+ "Finish recording before uploading a file.": "ফাইল আপলোড করার আগে রেকর্ডিং শেষ করুন।",
+ "This audio format is not supported.": "এই অডিও ফরম্যাট সমর্থিত নয়।",
+ "Yogurt couldn't read this audio file.": "Yogurt এই অডিও ফাইলটি পড়তে পারেনি।",
+ "Yogurt couldn't transcribe this file.": "Yogurt এই ফাইলের লিখিত রূপ তৈরি করতে পারেনি।",
+ "Reading the file…": "ফাইল পড়া হচ্ছে…",
+ "Start time": "শুরুর সময়",
+ "Transcription stopped.": "প্রতিলিপি বন্ধ হয়েছে।",
+ "Continue transcription": "প্রতিলিপি চালিয়ে যান",
+ "Transcribe again": "আবার প্রতিলিপি করুন",
+ "Stop transcription": "প্রতিলিপি বন্ধ করুন",
+ "Audio is unavailable.": "অডিও উপলভ্য নেই।"
}
diff --git a/app/src/shared/locales/cs.json b/app/src/shared/locales/cs.json
index 16671506..9326568c 100644
--- a/app/src/shared/locales/cs.json
+++ b/app/src/shared/locales/cs.json
@@ -750,5 +750,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt se k té adrese nedostal. Zkontrolujte připojení a adresu.",
"{name} is connected. You can change this any time in Settings.": "{name} je připojený. Můžete to kdykoli změnit v Nastavení.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Vidíte jen „Public address in iCal format“? Vaše organizace vypnula tajné adresy, takže tento kalendář takto připojit nejde.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "To je veřejná adresa, která funguje jen u veřejného kalendáře. Zkopírujte místo ní „Secret address in iCal format“."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "To je veřejná adresa, která funguje jen u veřejného kalendáře. Zkopírujte místo ní „Secret address in iCal format“.",
+ "Upload a file": "Nahrát soubor",
+ "Audio": "Zvuk",
+ "Transcribe": "Přepsat",
+ "Preparing audio…": "Příprava zvuku…",
+ "Transcribing…": "Přepisování…",
+ "Waiting for the speech model": "Čekání na model řeči",
+ "Waiting for recording to finish": "Čekání na konec nahrávání",
+ "Finish recording before uploading a file.": "Před nahráním souboru ukončete nahrávání.",
+ "This audio format is not supported.": "Tento zvukový formát není podporován.",
+ "Yogurt couldn't read this audio file.": "Yogurt nemohl přečíst tento zvukový soubor.",
+ "Yogurt couldn't transcribe this file.": "Yogurt nemohl přepsat tento soubor.",
+ "Reading the file…": "Čtení souboru…",
+ "Start time": "Čas začátku",
+ "Transcription stopped.": "Přepis zastaven.",
+ "Continue transcription": "Pokračovat v přepisu",
+ "Transcribe again": "Přepsat znovu",
+ "Stop transcription": "Zastavit přepis",
+ "Audio is unavailable.": "Zvuk není k dispozici."
}
diff --git a/app/src/shared/locales/da.json b/app/src/shared/locales/da.json
index bd88ba85..4d0c3d11 100644
--- a/app/src/shared/locales/da.json
+++ b/app/src/shared/locales/da.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt kunne ikke nå den adresse. Tjek din forbindelse og adressen.",
"{name} is connected. You can change this any time in Settings.": "{name} er forbundet. Du kan ændre det når som helst i Indstillinger.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Ser du kun \"Public address in iCal format\"? Din organisation har slået hemmelige adresser fra, så kalenderen kan ikke forbindes på denne måde.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det er den offentlige adresse, som kun virker, hvis din kalender er offentlig. Kopiér \"Secret address in iCal format\" i stedet."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det er den offentlige adresse, som kun virker, hvis din kalender er offentlig. Kopiér \"Secret address in iCal format\" i stedet.",
+ "Upload a file": "Upload en fil",
+ "Audio": "Lyd",
+ "Transcribe": "Transskriber",
+ "Preparing audio…": "Forbereder lyd…",
+ "Transcribing…": "Transskriberer…",
+ "Waiting for the speech model": "Venter på talemodellen",
+ "Waiting for recording to finish": "Venter på at optagelsen slutter",
+ "Finish recording before uploading a file.": "Afslut optagelsen, før du uploader en fil.",
+ "This audio format is not supported.": "Dette lydformat understøttes ikke.",
+ "Yogurt couldn't read this audio file.": "Yogurt kunne ikke læse denne lydfil.",
+ "Yogurt couldn't transcribe this file.": "Yogurt kunne ikke transskribere denne fil.",
+ "Reading the file…": "Læser filen…",
+ "Start time": "Starttidspunkt",
+ "Transcription stopped.": "Transskriptionen er stoppet.",
+ "Continue transcription": "Fortsæt transskription",
+ "Transcribe again": "Transskriber igen",
+ "Stop transcription": "Stop transskription",
+ "Audio is unavailable.": "Lyden er ikke tilgængelig."
}
diff --git a/app/src/shared/locales/de.json b/app/src/shared/locales/de.json
index bdf5d46d..4f435c03 100644
--- a/app/src/shared/locales/de.json
+++ b/app/src/shared/locales/de.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt konnte diese Adresse nicht erreichen. Prüfe deine Verbindung und die Adresse.",
"{name} is connected. You can change this any time in Settings.": "{name} ist verbunden. Du kannst das jederzeit in den Einstellungen ändern.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Siehst du nur „Public address in iCal format“? Deine Organisation hat geheime Adressen abgeschaltet, daher lässt sich dieser Kalender so nicht verbinden.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Das ist die öffentliche Adresse, die nur bei einem öffentlichen Kalender funktioniert. Kopiere stattdessen „Secret address in iCal format“."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Das ist die öffentliche Adresse, die nur bei einem öffentlichen Kalender funktioniert. Kopiere stattdessen „Secret address in iCal format“.",
+ "Upload a file": "Datei hochladen",
+ "Audio": "Audio",
+ "Transcribe": "Transkribieren",
+ "Preparing audio…": "Audio wird vorbereitet…",
+ "Transcribing…": "Wird transkribiert…",
+ "Waiting for the speech model": "Warten auf das Sprachmodell",
+ "Waiting for recording to finish": "Warten auf das Aufnahmeende",
+ "Finish recording before uploading a file.": "Beende die Aufnahme, bevor du eine Datei hochlädst.",
+ "This audio format is not supported.": "Dieses Audioformat wird nicht unterstützt.",
+ "Yogurt couldn't read this audio file.": "Yogurt konnte diese Audiodatei nicht lesen.",
+ "Yogurt couldn't transcribe this file.": "Yogurt konnte diese Datei nicht transkribieren.",
+ "Reading the file…": "Datei wird gelesen…",
+ "Start time": "Startzeit",
+ "Transcription stopped.": "Transkription angehalten.",
+ "Continue transcription": "Transkription fortsetzen",
+ "Transcribe again": "Erneut transkribieren",
+ "Stop transcription": "Transkription anhalten",
+ "Audio is unavailable.": "Audio ist nicht verfügbar."
}
diff --git a/app/src/shared/locales/el.json b/app/src/shared/locales/el.json
index 0e77af3c..8b63b443 100644
--- a/app/src/shared/locales/el.json
+++ b/app/src/shared/locales/el.json
@@ -722,5 +722,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Το Yogurt δεν μπόρεσε να φτάσει σε αυτή τη διεύθυνση. Ελέγξτε τη σύνδεση και τη διεύθυνση.",
"{name} is connected. You can change this any time in Settings.": "Το {name} συνδέθηκε. Μπορείτε να το αλλάξετε όποτε θέλετε στις Ρυθμίσεις.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Βλέπετε μόνο το «Public address in iCal format»; Ο οργανισμός σας έχει απενεργοποιήσει τις μυστικές διευθύνσεις, οπότε αυτό το ημερολόγιο δεν μπορεί να συνδεθεί έτσι.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Αυτή είναι η δημόσια διεύθυνση, που λειτουργεί μόνο αν το ημερολόγιό σας είναι δημόσιο. Αντιγράψτε το «Secret address in iCal format»."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Αυτή είναι η δημόσια διεύθυνση, που λειτουργεί μόνο αν το ημερολόγιό σας είναι δημόσιο. Αντιγράψτε το «Secret address in iCal format».",
+ "Upload a file": "Μεταφόρτωση αρχείου",
+ "Audio": "Ήχος",
+ "Transcribe": "Απομαγνητοφώνηση",
+ "Preparing audio…": "Προετοιμασία ήχου…",
+ "Transcribing…": "Απομαγνητοφώνηση…",
+ "Waiting for the speech model": "Αναμονή για το μοντέλο ομιλίας",
+ "Waiting for recording to finish": "Αναμονή για το τέλος της εγγραφής",
+ "Finish recording before uploading a file.": "Ολοκλήρωσε την εγγραφή πριν μεταφορτώσεις αρχείο.",
+ "This audio format is not supported.": "Αυτή η μορφή ήχου δεν υποστηρίζεται.",
+ "Yogurt couldn't read this audio file.": "Το Yogurt δεν μπόρεσε να διαβάσει αυτό το αρχείο ήχου.",
+ "Yogurt couldn't transcribe this file.": "Το Yogurt δεν μπόρεσε να απομαγνητοφωνήσει αυτό το αρχείο.",
+ "Reading the file…": "Ανάγνωση αρχείου…",
+ "Start time": "Ώρα έναρξης",
+ "Transcription stopped.": "Η απομαγνητοφώνηση σταμάτησε.",
+ "Continue transcription": "Συνέχεια απομαγνητοφώνησης",
+ "Transcribe again": "Νέα απομαγνητοφώνηση",
+ "Stop transcription": "Διακοπή απομαγνητοφώνησης",
+ "Audio is unavailable.": "Ο ήχος δεν είναι διαθέσιμος."
}
diff --git a/app/src/shared/locales/en.json b/app/src/shared/locales/en.json
index c3818756..b5ed3d64 100644
--- a/app/src/shared/locales/en.json
+++ b/app/src/shared/locales/en.json
@@ -224,5 +224,23 @@
"Later": "Later",
"Restart": "Restart",
"Yogurt couldn't restart. Try again.": "Yogurt couldn't restart. Try again.",
- "Yogurt {version}": "Yogurt {version}"
+ "Yogurt {version}": "Yogurt {version}",
+ "Upload a file": "Upload a file",
+ "Audio": "Audio",
+ "Transcribe": "Transcribe",
+ "Preparing audio…": "Preparing audio…",
+ "Transcribing…": "Transcribing…",
+ "Waiting for the speech model": "Waiting for the speech model",
+ "Waiting for recording to finish": "Waiting for recording to finish",
+ "Finish recording before uploading a file.": "Finish recording before uploading a file.",
+ "This audio format is not supported.": "This audio format is not supported.",
+ "Yogurt couldn't read this audio file.": "Yogurt couldn't read this audio file.",
+ "Yogurt couldn't transcribe this file.": "Yogurt couldn't transcribe this file.",
+ "Reading the file…": "Reading the file…",
+ "Start time": "Start time",
+ "Transcription stopped.": "Transcription stopped.",
+ "Continue transcription": "Continue transcription",
+ "Transcribe again": "Transcribe again",
+ "Stop transcription": "Stop transcription",
+ "Audio is unavailable.": "Audio is unavailable."
}
diff --git a/app/src/shared/locales/es.json b/app/src/shared/locales/es.json
index c280dc35..a2c7b090 100644
--- a/app/src/shared/locales/es.json
+++ b/app/src/shared/locales/es.json
@@ -732,5 +732,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt no pudo acceder a esa dirección. Revisa tu conexión y la dirección.",
"{name} is connected. You can change this any time in Settings.": "{name} está conectado. Puedes cambiarlo cuando quieras en Ajustes.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "¿Solo ves \"Public address in iCal format\"? Tu organización desactivó las direcciones secretas, así que este calendario no se puede conectar así.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Esa es la dirección pública, que solo funciona si tu calendario es público. Copia \"Secret address in iCal format\" en su lugar."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Esa es la dirección pública, que solo funciona si tu calendario es público. Copia \"Secret address in iCal format\" en su lugar.",
+ "Upload a file": "Subir un archivo",
+ "Audio": "Audio",
+ "Transcribe": "Transcribir",
+ "Preparing audio…": "Preparando audio…",
+ "Transcribing…": "Transcribiendo…",
+ "Waiting for the speech model": "Esperando el modelo de voz",
+ "Waiting for recording to finish": "Esperando a que termine la grabación",
+ "Finish recording before uploading a file.": "Termina la grabación antes de subir un archivo.",
+ "This audio format is not supported.": "Este formato de audio no es compatible.",
+ "Yogurt couldn't read this audio file.": "Yogurt no pudo leer este archivo de audio.",
+ "Yogurt couldn't transcribe this file.": "Yogurt no pudo transcribir este archivo.",
+ "Reading the file…": "Leyendo el archivo…",
+ "Start time": "Hora de inicio",
+ "Transcription stopped.": "Transcripción detenida.",
+ "Continue transcription": "Continuar transcripción",
+ "Transcribe again": "Transcribir de nuevo",
+ "Stop transcription": "Detener transcripción",
+ "Audio is unavailable.": "El audio no está disponible."
}
diff --git a/app/src/shared/locales/fi.json b/app/src/shared/locales/fi.json
index 949c6efb..a4c56b47 100644
--- a/app/src/shared/locales/fi.json
+++ b/app/src/shared/locales/fi.json
@@ -725,5 +725,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt ei saanut yhteyttä osoitteeseen. Tarkista yhteys ja osoite.",
"{name} is connected. You can change this any time in Settings.": "{name} on yhdistetty. Voit muuttaa tätä milloin tahansa Asetuksissa.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Näkyykö vain \"Public address in iCal format\"? Organisaatiosi on poistanut salaiset osoitteet käytöstä, joten tätä kalenteria ei voi yhdistää näin.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Tuo on julkinen osoite, joka toimii vain julkiselle kalenterille. Kopioi sen sijaan \"Secret address in iCal format\"."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Tuo on julkinen osoite, joka toimii vain julkiselle kalenterille. Kopioi sen sijaan \"Secret address in iCal format\".",
+ "Upload a file": "Lataa tiedosto",
+ "Audio": "Ääni",
+ "Transcribe": "Litteroi",
+ "Preparing audio…": "Valmistellaan ääntä…",
+ "Transcribing…": "Litteroidaan…",
+ "Waiting for the speech model": "Odotetaan puhemallia",
+ "Waiting for recording to finish": "Odotetaan tallennuksen päättymistä",
+ "Finish recording before uploading a file.": "Lopeta tallennus ennen tiedoston lataamista.",
+ "This audio format is not supported.": "Tätä äänimuotoa ei tueta.",
+ "Yogurt couldn't read this audio file.": "Yogurt ei voinut lukea tätä äänitiedostoa.",
+ "Yogurt couldn't transcribe this file.": "Yogurt ei voinut litteroida tätä tiedostoa.",
+ "Reading the file…": "Luetaan tiedostoa…",
+ "Start time": "Aloitusaika",
+ "Transcription stopped.": "Litterointi pysäytetty.",
+ "Continue transcription": "Jatka litterointia",
+ "Transcribe again": "Litteroi uudelleen",
+ "Stop transcription": "Pysäytä litterointi",
+ "Audio is unavailable.": "Ääni ei ole saatavilla."
}
diff --git a/app/src/shared/locales/fil.json b/app/src/shared/locales/fil.json
index f6082d61..10096177 100644
--- a/app/src/shared/locales/fil.json
+++ b/app/src/shared/locales/fil.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Hindi maabot ng Yogurt ang address na iyan. Tingnan ang koneksyon mo at ang address.",
"{name} is connected. You can change this any time in Settings.": "Nakakonekta na ang {name}. Puwede mo itong baguhin anumang oras sa Settings.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "\"Public address in iCal format\" lang ang nakikita mo? In-off ng organisasyon mo ang mga secret address, kaya hindi maikokonekta ang calendar na ito sa ganitong paraan.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Iyan ang public address, na gumagana lang kung public ang calendar mo. Kopyahin na lang ang \"Secret address in iCal format\"."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Iyan ang public address, na gumagana lang kung public ang calendar mo. Kopyahin na lang ang \"Secret address in iCal format\".",
+ "Upload a file": "Mag-upload ng file",
+ "Audio": "Audio",
+ "Transcribe": "I-transcribe",
+ "Preparing audio…": "Inihahanda ang audio…",
+ "Transcribing…": "Tina-transcribe…",
+ "Waiting for the speech model": "Hinihintay ang speech model",
+ "Waiting for recording to finish": "Hinihintay matapos ang pag-record",
+ "Finish recording before uploading a file.": "Tapusin ang pag-record bago mag-upload ng file.",
+ "This audio format is not supported.": "Hindi suportado ang format ng audio na ito.",
+ "Yogurt couldn't read this audio file.": "Hindi mabasa ng Yogurt ang audio file na ito.",
+ "Yogurt couldn't transcribe this file.": "Hindi ma-transcribe ng Yogurt ang file na ito.",
+ "Reading the file…": "Binabasa ang file…",
+ "Start time": "Oras ng simula",
+ "Transcription stopped.": "Itinigil ang transkripsiyon.",
+ "Continue transcription": "Ipagpatuloy ang transkripsiyon",
+ "Transcribe again": "I-transcribe muli",
+ "Stop transcription": "Itigil ang transkripsiyon",
+ "Audio is unavailable.": "Hindi available ang audio."
}
diff --git a/app/src/shared/locales/fr.json b/app/src/shared/locales/fr.json
index 802f0ca6..b49a1eb2 100644
--- a/app/src/shared/locales/fr.json
+++ b/app/src/shared/locales/fr.json
@@ -735,5 +735,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt n’a pas pu joindre cette adresse. Vérifiez votre connexion et l’adresse.",
"{name} is connected. You can change this any time in Settings.": "{name} est connecté. Vous pouvez changer cela à tout moment dans les Réglages.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Vous ne voyez que « Public address in iCal format » ? Votre organisation a désactivé les adresses secrètes : ce calendrier ne peut pas être connecté de cette façon.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "C’est l’adresse publique, qui ne fonctionne que si votre calendrier est public. Copiez plutôt « Secret address in iCal format »."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "C’est l’adresse publique, qui ne fonctionne que si votre calendrier est public. Copiez plutôt « Secret address in iCal format ».",
+ "Upload a file": "Importer un fichier",
+ "Audio": "Audio",
+ "Transcribe": "Transcrire",
+ "Preparing audio…": "Préparation de l’audio…",
+ "Transcribing…": "Transcription…",
+ "Waiting for the speech model": "En attente du modèle vocal",
+ "Waiting for recording to finish": "En attente de la fin de l’enregistrement",
+ "Finish recording before uploading a file.": "Terminez l’enregistrement avant d’importer un fichier.",
+ "This audio format is not supported.": "Ce format audio n’est pas pris en charge.",
+ "Yogurt couldn't read this audio file.": "Yogurt n’a pas pu lire ce fichier audio.",
+ "Yogurt couldn't transcribe this file.": "Yogurt n’a pas pu transcrire ce fichier.",
+ "Reading the file…": "Lecture du fichier…",
+ "Start time": "Heure de début",
+ "Transcription stopped.": "Transcription arrêtée.",
+ "Continue transcription": "Continuer la transcription",
+ "Transcribe again": "Transcrire à nouveau",
+ "Stop transcription": "Arrêter la transcription",
+ "Audio is unavailable.": "L’audio n’est pas disponible."
}
diff --git a/app/src/shared/locales/he.json b/app/src/shared/locales/he.json
index 9ca930f9..cb7acc50 100644
--- a/app/src/shared/locales/he.json
+++ b/app/src/shared/locales/he.json
@@ -729,5 +729,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt לא הצליח להגיע לכתובת הזו. בדקו את החיבור ואת הכתובת.",
"{name} is connected. You can change this any time in Settings.": "{name} מחובר. אפשר לשנות זאת בכל עת בהגדרות.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "רואים רק את \"Public address in iCal format\"? הארגון שלכם כיבה כתובות סודיות, ולכן אי אפשר לחבר את היומן הזה כך.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "זו הכתובת הציבורית, והיא עובדת רק אם היומן שלכם ציבורי. העתיקו במקומה את \"Secret address in iCal format\"."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "זו הכתובת הציבורית, והיא עובדת רק אם היומן שלכם ציבורי. העתיקו במקומה את \"Secret address in iCal format\".",
+ "Upload a file": "העלאת קובץ",
+ "Audio": "שמע",
+ "Transcribe": "תמלול",
+ "Preparing audio…": "הכנת השמע…",
+ "Transcribing…": "מתמלל…",
+ "Waiting for the speech model": "ממתין למודל הדיבור",
+ "Waiting for recording to finish": "ממתין לסיום ההקלטה",
+ "Finish recording before uploading a file.": "יש לסיים את ההקלטה לפני העלאת קובץ.",
+ "This audio format is not supported.": "פורמט השמע הזה אינו נתמך.",
+ "Yogurt couldn't read this audio file.": "Yogurt לא הצליח לקרוא את קובץ השמע הזה.",
+ "Yogurt couldn't transcribe this file.": "Yogurt לא הצליח לתמלל את הקובץ הזה.",
+ "Reading the file…": "קורא את הקובץ…",
+ "Start time": "שעת התחלה",
+ "Transcription stopped.": "התמלול נעצר.",
+ "Continue transcription": "המשך תמלול",
+ "Transcribe again": "תמלול מחדש",
+ "Stop transcription": "עצירת תמלול",
+ "Audio is unavailable.": "האודיו אינו זמין."
}
diff --git a/app/src/shared/locales/hi.json b/app/src/shared/locales/hi.json
index bc36f0f8..bea56657 100644
--- a/app/src/shared/locales/hi.json
+++ b/app/src/shared/locales/hi.json
@@ -707,5 +707,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt उस पते तक नहीं पहुंच सका। अपना कनेक्शन और पता जांचें।",
"{name} is connected. You can change this any time in Settings.": "{name} कनेक्ट हो गया है। आप इसे कभी भी सेटिंग्स में बदल सकते हैं।",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "सिर्फ \"Public address in iCal format\" दिख रहा है? आपके संगठन ने सीक्रेट पते बंद कर रखे हैं, इसलिए इस कैलेंडर को इस तरह कनेक्ट नहीं किया जा सकता।",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "यह पब्लिक पता है, जो सिर्फ तभी काम करता है जब आपका कैलेंडर पब्लिक हो। इसकी जगह \"Secret address in iCal format\" कॉपी करें।"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "यह पब्लिक पता है, जो सिर्फ तभी काम करता है जब आपका कैलेंडर पब्लिक हो। इसकी जगह \"Secret address in iCal format\" कॉपी करें।",
+ "Upload a file": "फ़ाइल अपलोड करें",
+ "Audio": "ऑडियो",
+ "Transcribe": "लिप्यंतरण करें",
+ "Preparing audio…": "ऑडियो तैयार हो रहा है…",
+ "Transcribing…": "लिप्यंतरण हो रहा है…",
+ "Waiting for the speech model": "स्पीच मॉडल की प्रतीक्षा में",
+ "Waiting for recording to finish": "रिकॉर्डिंग पूरी होने की प्रतीक्षा में",
+ "Finish recording before uploading a file.": "फ़ाइल अपलोड करने से पहले रिकॉर्डिंग पूरी करें।",
+ "This audio format is not supported.": "यह ऑडियो फ़ॉर्मैट समर्थित नहीं है।",
+ "Yogurt couldn't read this audio file.": "Yogurt इस ऑडियो फ़ाइल को पढ़ नहीं सका।",
+ "Yogurt couldn't transcribe this file.": "Yogurt इस फ़ाइल का लिप्यंतरण नहीं कर सका।",
+ "Reading the file…": "फ़ाइल पढ़ी जा रही है…",
+ "Start time": "शुरू होने का समय",
+ "Transcription stopped.": "ट्रांसक्रिप्शन रोक दिया गया।",
+ "Continue transcription": "ट्रांसक्रिप्शन जारी रखें",
+ "Transcribe again": "फिर से ट्रांसक्राइब करें",
+ "Stop transcription": "ट्रांसक्रिप्शन रोकें",
+ "Audio is unavailable.": "ऑडियो उपलब्ध नहीं है।"
}
diff --git a/app/src/shared/locales/hu.json b/app/src/shared/locales/hu.json
index ed4bc4ad..74c9fc9f 100644
--- a/app/src/shared/locales/hu.json
+++ b/app/src/shared/locales/hu.json
@@ -707,5 +707,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "A Yogurt nem érte el ezt a címet. Ellenőrizd a kapcsolatot és a címet.",
"{name} is connected. You can change this any time in Settings.": "{name} csatlakoztatva. Bármikor módosíthatod a Beállításokban.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Csak a „Public address in iCal format” látszik? A szervezeted kikapcsolta a titkos címeket, így ez a naptár így nem csatlakoztatható.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Ez a nyilvános cím, ami csak nyilvános naptárnál működik. Másold ki helyette a „Secret address in iCal format” címet."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Ez a nyilvános cím, ami csak nyilvános naptárnál működik. Másold ki helyette a „Secret address in iCal format” címet.",
+ "Upload a file": "Fájl feltöltése",
+ "Audio": "Hang",
+ "Transcribe": "Átírás",
+ "Preparing audio…": "Hang előkészítése…",
+ "Transcribing…": "Átírás…",
+ "Waiting for the speech model": "Várakozás a beszédmodellre",
+ "Waiting for recording to finish": "Várakozás a felvétel végére",
+ "Finish recording before uploading a file.": "A fájl feltöltése előtt fejezd be a felvételt.",
+ "This audio format is not supported.": "Ez a hangformátum nem támogatott.",
+ "Yogurt couldn't read this audio file.": "A Yogurt nem tudta beolvasni ezt a hangfájlt.",
+ "Yogurt couldn't transcribe this file.": "A Yogurt nem tudta átírni ezt a fájlt.",
+ "Reading the file…": "Fájl olvasása…",
+ "Start time": "Kezdés ideje",
+ "Transcription stopped.": "Az átírás leállt.",
+ "Continue transcription": "Átírás folytatása",
+ "Transcribe again": "Újra átírás",
+ "Stop transcription": "Átírás leállítása",
+ "Audio is unavailable.": "A hang nem érhető el."
}
diff --git a/app/src/shared/locales/id.json b/app/src/shared/locales/id.json
index 436ce954..75380c55 100644
--- a/app/src/shared/locales/id.json
+++ b/app/src/shared/locales/id.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt tidak bisa menjangkau alamat itu. Periksa koneksi dan alamatnya.",
"{name} is connected. You can change this any time in Settings.": "{name} terhubung. Anda bisa mengubahnya kapan saja di Pengaturan.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Hanya melihat \"Public address in iCal format\"? Organisasi Anda menonaktifkan alamat rahasia, jadi kalender ini tidak bisa dihubungkan dengan cara ini.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Itu alamat publik, yang hanya berfungsi jika kalender Anda publik. Salin \"Secret address in iCal format\" sebagai gantinya."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Itu alamat publik, yang hanya berfungsi jika kalender Anda publik. Salin \"Secret address in iCal format\" sebagai gantinya.",
+ "Upload a file": "Unggah file",
+ "Audio": "Audio",
+ "Transcribe": "Transkripsikan",
+ "Preparing audio…": "Menyiapkan audio…",
+ "Transcribing…": "Mentranskripsikan…",
+ "Waiting for the speech model": "Menunggu model ucapan",
+ "Waiting for recording to finish": "Menunggu perekaman selesai",
+ "Finish recording before uploading a file.": "Selesaikan perekaman sebelum mengunggah file.",
+ "This audio format is not supported.": "Format audio ini tidak didukung.",
+ "Yogurt couldn't read this audio file.": "Yogurt tidak dapat membaca file audio ini.",
+ "Yogurt couldn't transcribe this file.": "Yogurt tidak dapat mentranskripsikan file ini.",
+ "Reading the file…": "Membaca file…",
+ "Start time": "Waktu mulai",
+ "Transcription stopped.": "Transkripsi dihentikan.",
+ "Continue transcription": "Lanjutkan transkripsi",
+ "Transcribe again": "Transkripsikan lagi",
+ "Stop transcription": "Hentikan transkripsi",
+ "Audio is unavailable.": "Audio tidak tersedia."
}
diff --git a/app/src/shared/locales/it.json b/app/src/shared/locales/it.json
index fd4ac360..0e0f7db3 100644
--- a/app/src/shared/locales/it.json
+++ b/app/src/shared/locales/it.json
@@ -738,5 +738,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt non è riuscito a raggiungere quell’indirizzo. Controlla la connessione e l’indirizzo.",
"{name} is connected. You can change this any time in Settings.": "{name} è collegato. Puoi cambiarlo quando vuoi in Impostazioni.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Vedi solo \"Public address in iCal format\"? La tua organizzazione ha disattivato gli indirizzi segreti, quindi questo calendario non si può collegare così.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Quello è l’indirizzo pubblico, che funziona solo se il calendario è pubblico. Copia invece \"Secret address in iCal format\"."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Quello è l’indirizzo pubblico, che funziona solo se il calendario è pubblico. Copia invece \"Secret address in iCal format\".",
+ "Upload a file": "Carica un file",
+ "Audio": "Audio",
+ "Transcribe": "Trascrivi",
+ "Preparing audio…": "Preparazione dell’audio…",
+ "Transcribing…": "Trascrizione…",
+ "Waiting for the speech model": "In attesa del modello vocale",
+ "Waiting for recording to finish": "In attesa della fine della registrazione",
+ "Finish recording before uploading a file.": "Termina la registrazione prima di caricare un file.",
+ "This audio format is not supported.": "Questo formato audio non è supportato.",
+ "Yogurt couldn't read this audio file.": "Yogurt non ha potuto leggere questo file audio.",
+ "Yogurt couldn't transcribe this file.": "Yogurt non ha potuto trascrivere questo file.",
+ "Reading the file…": "Lettura del file…",
+ "Start time": "Ora di inizio",
+ "Transcription stopped.": "Trascrizione interrotta.",
+ "Continue transcription": "Continua la trascrizione",
+ "Transcribe again": "Trascrivi di nuovo",
+ "Stop transcription": "Interrompi la trascrizione",
+ "Audio is unavailable.": "L’audio non è disponibile."
}
diff --git a/app/src/shared/locales/ja.json b/app/src/shared/locales/ja.json
index aee8a127..d7ea4362 100644
--- a/app/src/shared/locales/ja.json
+++ b/app/src/shared/locales/ja.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt はそのアドレスにアクセスできませんでした。接続とアドレスを確認してください。",
"{name} is connected. You can change this any time in Settings.": "{name}を接続しました。設定でいつでも変更できます。",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "「Public address in iCal format」しか表示されませんか?組織が非公開アドレスをオフにしているため、このカレンダーはこの方法では接続できません。",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "それは公開アドレスで、カレンダーが公開されている場合にしか使えません。代わりに「Secret address in iCal format」をコピーしてください。"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "それは公開アドレスで、カレンダーが公開されている場合にしか使えません。代わりに「Secret address in iCal format」をコピーしてください。",
+ "Upload a file": "ファイルをアップロード",
+ "Audio": "音声",
+ "Transcribe": "文字起こし",
+ "Preparing audio…": "音声を準備中…",
+ "Transcribing…": "文字起こし中…",
+ "Waiting for the speech model": "音声モデルを待機中",
+ "Waiting for recording to finish": "録音の終了を待機中",
+ "Finish recording before uploading a file.": "ファイルをアップロードする前に録音を終了してください。",
+ "This audio format is not supported.": "この音声形式はサポートされていません。",
+ "Yogurt couldn't read this audio file.": "Yogurtはこの音声ファイルを読み取れませんでした。",
+ "Yogurt couldn't transcribe this file.": "Yogurtはこのファイルを文字起こしできませんでした。",
+ "Reading the file…": "ファイルを読み込み中…",
+ "Start time": "開始時刻",
+ "Transcription stopped.": "文字起こしを停止しました。",
+ "Continue transcription": "文字起こしを続ける",
+ "Transcribe again": "再度文字起こし",
+ "Stop transcription": "文字起こしを停止",
+ "Audio is unavailable.": "音声を利用できません。"
}
diff --git a/app/src/shared/locales/ko.json b/app/src/shared/locales/ko.json
index 443654d8..6de2491d 100644
--- a/app/src/shared/locales/ko.json
+++ b/app/src/shared/locales/ko.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt가 그 주소에 연결하지 못했어요. 인터넷 연결과 주소를 확인하세요.",
"{name} is connected. You can change this any time in Settings.": "{name}이(가) 연결됐어요. 설정에서 언제든 바꿀 수 있어요.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "\"Public address in iCal format\"만 보이나요? 조직에서 비밀 주소를 꺼 두어서 이 캘린더는 이 방법으로 연결할 수 없어요.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "그건 공개 주소라서 캘린더가 공개일 때만 작동해요. 대신 \"Secret address in iCal format\"을 복사하세요."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "그건 공개 주소라서 캘린더가 공개일 때만 작동해요. 대신 \"Secret address in iCal format\"을 복사하세요.",
+ "Upload a file": "파일 업로드",
+ "Audio": "오디오",
+ "Transcribe": "전사하기",
+ "Preparing audio…": "오디오 준비 중…",
+ "Transcribing…": "전사 중…",
+ "Waiting for the speech model": "음성 모델 대기 중",
+ "Waiting for recording to finish": "녹음이 끝나기를 기다리는 중",
+ "Finish recording before uploading a file.": "파일을 업로드하기 전에 녹음을 끝내세요.",
+ "This audio format is not supported.": "지원하지 않는 오디오 형식입니다.",
+ "Yogurt couldn't read this audio file.": "Yogurt가 이 오디오 파일을 읽지 못했습니다.",
+ "Yogurt couldn't transcribe this file.": "Yogurt가 이 파일을 전사하지 못했습니다.",
+ "Reading the file…": "파일 읽는 중…",
+ "Start time": "시작 시간",
+ "Transcription stopped.": "전사가 중지되었습니다.",
+ "Continue transcription": "전사 계속",
+ "Transcribe again": "다시 전사",
+ "Stop transcription": "전사 중지",
+ "Audio is unavailable.": "오디오를 사용할 수 없습니다."
}
diff --git a/app/src/shared/locales/ms.json b/app/src/shared/locales/ms.json
index 9d550a09..09df7e95 100644
--- a/app/src/shared/locales/ms.json
+++ b/app/src/shared/locales/ms.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt tidak dapat mencapai alamat itu. Semak sambungan dan alamat anda.",
"{name} is connected. You can change this any time in Settings.": "{name} disambungkan. Anda boleh menukarnya bila-bila masa dalam Tetapan.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Hanya nampak \"Public address in iCal format\"? Organisasi anda telah mematikan alamat rahsia, jadi kalendar ini tidak boleh disambungkan dengan cara ini.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Itu alamat awam, yang hanya berfungsi jika kalendar anda awam. Salin \"Secret address in iCal format\" sebaliknya."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Itu alamat awam, yang hanya berfungsi jika kalendar anda awam. Salin \"Secret address in iCal format\" sebaliknya.",
+ "Upload a file": "Muat naik fail",
+ "Audio": "Audio",
+ "Transcribe": "Transkripsikan",
+ "Preparing audio…": "Menyediakan audio…",
+ "Transcribing…": "Mentranskripsikan…",
+ "Waiting for the speech model": "Menunggu model pertuturan",
+ "Waiting for recording to finish": "Menunggu rakaman selesai",
+ "Finish recording before uploading a file.": "Selesaikan rakaman sebelum memuat naik fail.",
+ "This audio format is not supported.": "Format audio ini tidak disokong.",
+ "Yogurt couldn't read this audio file.": "Yogurt tidak dapat membaca fail audio ini.",
+ "Yogurt couldn't transcribe this file.": "Yogurt tidak dapat mentranskripsikan fail ini.",
+ "Reading the file…": "Membaca fail…",
+ "Start time": "Masa mula",
+ "Transcription stopped.": "Transkripsi dihentikan.",
+ "Continue transcription": "Teruskan transkripsi",
+ "Transcribe again": "Transkripsi semula",
+ "Stop transcription": "Hentikan transkripsi",
+ "Audio is unavailable.": "Audio tidak tersedia."
}
diff --git a/app/src/shared/locales/nb.json b/app/src/shared/locales/nb.json
index 6c361143..17bc8b63 100644
--- a/app/src/shared/locales/nb.json
+++ b/app/src/shared/locales/nb.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt nådde ikke den adressen. Sjekk tilkoblingen og adressen.",
"{name} is connected. You can change this any time in Settings.": "{name} er koblet til. Du kan endre dette når som helst i Innstillinger.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Ser du bare «Public address in iCal format»? Organisasjonen din har slått av hemmelige adresser, så denne kalenderen kan ikke kobles til på denne måten.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det er den offentlige adressen, som bare fungerer hvis kalenderen er offentlig. Kopier «Secret address in iCal format» i stedet."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det er den offentlige adressen, som bare fungerer hvis kalenderen er offentlig. Kopier «Secret address in iCal format» i stedet.",
+ "Upload a file": "Last opp en fil",
+ "Audio": "Lyd",
+ "Transcribe": "Transkriber",
+ "Preparing audio…": "Klargjør lyd…",
+ "Transcribing…": "Transkriberer…",
+ "Waiting for the speech model": "Venter på talemodellen",
+ "Waiting for recording to finish": "Venter på at opptaket avsluttes",
+ "Finish recording before uploading a file.": "Avslutt opptaket før du laster opp en fil.",
+ "This audio format is not supported.": "Dette lydformatet støttes ikke.",
+ "Yogurt couldn't read this audio file.": "Yogurt kunne ikke lese denne lydfilen.",
+ "Yogurt couldn't transcribe this file.": "Yogurt kunne ikke transkribere denne filen.",
+ "Reading the file…": "Leser filen…",
+ "Start time": "Starttid",
+ "Transcription stopped.": "Transkripsjonen er stoppet.",
+ "Continue transcription": "Fortsett transkripsjon",
+ "Transcribe again": "Transkriber på nytt",
+ "Stop transcription": "Stopp transkripsjon",
+ "Audio is unavailable.": "Lyden er ikke tilgjengelig."
}
diff --git a/app/src/shared/locales/nl.json b/app/src/shared/locales/nl.json
index 42f8d12f..cb62d21e 100644
--- a/app/src/shared/locales/nl.json
+++ b/app/src/shared/locales/nl.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt kon dat adres niet bereiken. Controleer je verbinding en het adres.",
"{name} is connected. You can change this any time in Settings.": "{name} is gekoppeld. Je kunt dit altijd wijzigen in Instellingen.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Zie je alleen \"Public address in iCal format\"? Je organisatie heeft geheime adressen uitgezet, dus deze agenda kan niet op deze manier worden gekoppeld.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Dat is het openbare adres, dat alleen werkt als je agenda openbaar is. Kopieer in plaats daarvan \"Secret address in iCal format\"."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Dat is het openbare adres, dat alleen werkt als je agenda openbaar is. Kopieer in plaats daarvan \"Secret address in iCal format\".",
+ "Upload a file": "Een bestand uploaden",
+ "Audio": "Audio",
+ "Transcribe": "Transcriberen",
+ "Preparing audio…": "Audio voorbereiden…",
+ "Transcribing…": "Transcriberen…",
+ "Waiting for the speech model": "Wachten op het spraakmodel",
+ "Waiting for recording to finish": "Wachten tot de opname klaar is",
+ "Finish recording before uploading a file.": "Beëindig de opname voordat je een bestand uploadt.",
+ "This audio format is not supported.": "Dit audioformaat wordt niet ondersteund.",
+ "Yogurt couldn't read this audio file.": "Yogurt kon dit audiobestand niet lezen.",
+ "Yogurt couldn't transcribe this file.": "Yogurt kon dit bestand niet transcriberen.",
+ "Reading the file…": "Bestand lezen…",
+ "Start time": "Begintijd",
+ "Transcription stopped.": "Transcriptie gestopt.",
+ "Continue transcription": "Transcriptie hervatten",
+ "Transcribe again": "Opnieuw transcriberen",
+ "Stop transcription": "Transcriptie stoppen",
+ "Audio is unavailable.": "Audio is niet beschikbaar."
}
diff --git a/app/src/shared/locales/pl.json b/app/src/shared/locales/pl.json
index b37c9d5d..4ae16f69 100644
--- a/app/src/shared/locales/pl.json
+++ b/app/src/shared/locales/pl.json
@@ -755,5 +755,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt nie mógł połączyć się z tym adresem. Sprawdź połączenie i adres.",
"{name} is connected. You can change this any time in Settings.": "{name} jest połączony. Możesz to zmienić w dowolnej chwili w Ustawieniach.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Widzisz tylko „Public address in iCal format”? Twoja organizacja wyłączyła tajne adresy, więc tego kalendarza nie da się tak połączyć.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "To adres publiczny, który działa tylko dla publicznego kalendarza. Skopiuj zamiast niego „Secret address in iCal format”."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "To adres publiczny, który działa tylko dla publicznego kalendarza. Skopiuj zamiast niego „Secret address in iCal format”.",
+ "Upload a file": "Prześlij plik",
+ "Audio": "Dźwięk",
+ "Transcribe": "Transkrybuj",
+ "Preparing audio…": "Przygotowywanie dźwięku…",
+ "Transcribing…": "Transkrybowanie…",
+ "Waiting for the speech model": "Oczekiwanie na model mowy",
+ "Waiting for recording to finish": "Oczekiwanie na koniec nagrywania",
+ "Finish recording before uploading a file.": "Zakończ nagrywanie przed przesłaniem pliku.",
+ "This audio format is not supported.": "Ten format dźwięku nie jest obsługiwany.",
+ "Yogurt couldn't read this audio file.": "Yogurt nie mógł odczytać tego pliku audio.",
+ "Yogurt couldn't transcribe this file.": "Yogurt nie mógł transkrybować tego pliku.",
+ "Reading the file…": "Odczytywanie pliku…",
+ "Start time": "Godzina rozpoczęcia",
+ "Transcription stopped.": "Transkrypcja zatrzymana.",
+ "Continue transcription": "Kontynuuj transkrypcję",
+ "Transcribe again": "Transkrybuj ponownie",
+ "Stop transcription": "Zatrzymaj transkrypcję",
+ "Audio is unavailable.": "Dźwięk jest niedostępny."
}
diff --git a/app/src/shared/locales/pt-BR.json b/app/src/shared/locales/pt-BR.json
index cfc86912..f9e95578 100644
--- a/app/src/shared/locales/pt-BR.json
+++ b/app/src/shared/locales/pt-BR.json
@@ -735,5 +735,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "O Yogurt não conseguiu acessar esse endereço. Verifique sua conexão e o endereço.",
"{name} is connected. You can change this any time in Settings.": "{name} está conectado. Você pode mudar isso quando quiser nos Ajustes.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Só aparece \"Public address in iCal format\"? Sua organização desativou os endereços secretos, então este calendário não pode ser conectado assim.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Esse é o endereço público, que só funciona se o seu calendário for público. Copie \"Secret address in iCal format\" no lugar."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Esse é o endereço público, que só funciona se o seu calendário for público. Copie \"Secret address in iCal format\" no lugar.",
+ "Upload a file": "Enviar um arquivo",
+ "Audio": "Áudio",
+ "Transcribe": "Transcrever",
+ "Preparing audio…": "Preparando áudio…",
+ "Transcribing…": "Transcrevendo…",
+ "Waiting for the speech model": "Aguardando o modelo de voz",
+ "Waiting for recording to finish": "Aguardando o fim da gravação",
+ "Finish recording before uploading a file.": "Encerre a gravação antes de enviar um arquivo.",
+ "This audio format is not supported.": "Este formato de áudio não é compatível.",
+ "Yogurt couldn't read this audio file.": "O Yogurt não conseguiu ler este arquivo de áudio.",
+ "Yogurt couldn't transcribe this file.": "O Yogurt não conseguiu transcrever este arquivo.",
+ "Reading the file…": "Lendo o arquivo…",
+ "Start time": "Horário de início",
+ "Transcription stopped.": "Transcrição interrompida.",
+ "Continue transcription": "Continuar transcrição",
+ "Transcribe again": "Transcrever novamente",
+ "Stop transcription": "Parar transcrição",
+ "Audio is unavailable.": "O áudio não está disponível."
}
diff --git a/app/src/shared/locales/ro.json b/app/src/shared/locales/ro.json
index a0bf6a99..70c94d58 100644
--- a/app/src/shared/locales/ro.json
+++ b/app/src/shared/locales/ro.json
@@ -736,5 +736,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt nu a putut accesa această adresă. Verificați conexiunea și adresa.",
"{name} is connected. You can change this any time in Settings.": "{name} este conectat. Puteți schimba asta oricând din Setări.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Vedeți doar „Public address in iCal format”? Organizația dvs. a dezactivat adresele secrete, așa că acest calendar nu poate fi conectat astfel.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Aceasta este adresa publică, care funcționează doar dacă calendarul este public. Copiați în schimb „Secret address in iCal format”."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Aceasta este adresa publică, care funcționează doar dacă calendarul este public. Copiați în schimb „Secret address in iCal format”.",
+ "Upload a file": "Încarcă un fișier",
+ "Audio": "Audio",
+ "Transcribe": "Transcrie",
+ "Preparing audio…": "Se pregătește sunetul…",
+ "Transcribing…": "Se transcrie…",
+ "Waiting for the speech model": "Se așteaptă modelul vocal",
+ "Waiting for recording to finish": "Se așteaptă încheierea înregistrării",
+ "Finish recording before uploading a file.": "Încheie înregistrarea înainte de a încărca un fișier.",
+ "This audio format is not supported.": "Acest format audio nu este acceptat.",
+ "Yogurt couldn't read this audio file.": "Yogurt nu a putut citi acest fișier audio.",
+ "Yogurt couldn't transcribe this file.": "Yogurt nu a putut transcrie acest fișier.",
+ "Reading the file…": "Se citește fișierul…",
+ "Start time": "Ora de început",
+ "Transcription stopped.": "Transcriere oprită.",
+ "Continue transcription": "Continuă transcrierea",
+ "Transcribe again": "Transcrie din nou",
+ "Stop transcription": "Oprește transcrierea",
+ "Audio is unavailable.": "Fișierul audio nu este disponibil."
}
diff --git a/app/src/shared/locales/ru.json b/app/src/shared/locales/ru.json
index c0d3a5c8..26f9e8aa 100644
--- a/app/src/shared/locales/ru.json
+++ b/app/src/shared/locales/ru.json
@@ -747,5 +747,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt не удалось открыть этот адрес. Проверьте подключение и адрес.",
"{name} is connected. You can change this any time in Settings.": "{name}: подключено. Это можно изменить в любой момент в Настройках.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Видите только «Public address in iCal format»? Ваша организация отключила секретные адреса, поэтому этот календарь так подключить нельзя.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Это общедоступный адрес, он работает только для общедоступного календаря. Скопируйте вместо него «Secret address in iCal format»."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Это общедоступный адрес, он работает только для общедоступного календаря. Скопируйте вместо него «Secret address in iCal format».",
+ "Upload a file": "Загрузить файл",
+ "Audio": "Аудио",
+ "Transcribe": "Расшифровать",
+ "Preparing audio…": "Подготовка аудио…",
+ "Transcribing…": "Расшифровка…",
+ "Waiting for the speech model": "Ожидание речевой модели",
+ "Waiting for recording to finish": "Ожидание завершения записи",
+ "Finish recording before uploading a file.": "Завершите запись перед загрузкой файла.",
+ "This audio format is not supported.": "Этот аудиоформат не поддерживается.",
+ "Yogurt couldn't read this audio file.": "Yogurt не удалось прочитать этот аудиофайл.",
+ "Yogurt couldn't transcribe this file.": "Yogurt не удалось расшифровать этот файл.",
+ "Reading the file…": "Чтение файла…",
+ "Start time": "Время начала",
+ "Transcription stopped.": "Расшифровка остановлена.",
+ "Continue transcription": "Продолжить расшифровку",
+ "Transcribe again": "Расшифровать заново",
+ "Stop transcription": "Остановить расшифровку",
+ "Audio is unavailable.": "Аудио недоступно."
}
diff --git a/app/src/shared/locales/sv.json b/app/src/shared/locales/sv.json
index 961edadd..daed5221 100644
--- a/app/src/shared/locales/sv.json
+++ b/app/src/shared/locales/sv.json
@@ -719,5 +719,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt nådde inte den adressen. Kontrollera anslutningen och adressen.",
"{name} is connected. You can change this any time in Settings.": "{name} är ansluten. Du kan ändra det när som helst i Inställningar.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Ser du bara ”Public address in iCal format”? Din organisation har stängt av hemliga adresser, så den här kalendern kan inte anslutas på det här sättet.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det är den offentliga adressen, som bara fungerar om kalendern är offentlig. Kopiera ”Secret address in iCal format” i stället."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Det är den offentliga adressen, som bara fungerar om kalendern är offentlig. Kopiera ”Secret address in iCal format” i stället.",
+ "Upload a file": "Ladda upp en fil",
+ "Audio": "Ljud",
+ "Transcribe": "Transkribera",
+ "Preparing audio…": "Förbereder ljud…",
+ "Transcribing…": "Transkriberar…",
+ "Waiting for the speech model": "Väntar på talmodellen",
+ "Waiting for recording to finish": "Väntar på att inspelningen avslutas",
+ "Finish recording before uploading a file.": "Avsluta inspelningen innan du laddar upp en fil.",
+ "This audio format is not supported.": "Det här ljudformatet stöds inte.",
+ "Yogurt couldn't read this audio file.": "Yogurt kunde inte läsa den här ljudfilen.",
+ "Yogurt couldn't transcribe this file.": "Yogurt kunde inte transkribera den här filen.",
+ "Reading the file…": "Läser filen…",
+ "Start time": "Starttid",
+ "Transcription stopped.": "Transkriberingen stoppades.",
+ "Continue transcription": "Fortsätt transkribera",
+ "Transcribe again": "Transkribera igen",
+ "Stop transcription": "Stoppa transkribering",
+ "Audio is unavailable.": "Ljudet är inte tillgängligt."
}
diff --git a/app/src/shared/locales/th.json b/app/src/shared/locales/th.json
index ab5828f0..db40c83b 100644
--- a/app/src/shared/locales/th.json
+++ b/app/src/shared/locales/th.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt เข้าถึงที่อยู่นั้นไม่ได้ ตรวจสอบการเชื่อมต่อและที่อยู่",
"{name} is connected. You can change this any time in Settings.": "เชื่อมต่อ {name} แล้ว เปลี่ยนได้ทุกเมื่อในการตั้งค่า",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "เห็นแค่ \"Public address in iCal format\" ใช่ไหม องค์กรของคุณปิดที่อยู่ลับไว้ จึงเชื่อมต่อปฏิทินนี้ด้วยวิธีนี้ไม่ได้",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "นั่นคือที่อยู่สาธารณะ ซึ่งใช้ได้เฉพาะเมื่อปฏิทินเป็นแบบสาธารณะ ให้คัดลอก \"Secret address in iCal format\" แทน"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "นั่นคือที่อยู่สาธารณะ ซึ่งใช้ได้เฉพาะเมื่อปฏิทินเป็นแบบสาธารณะ ให้คัดลอก \"Secret address in iCal format\" แทน",
+ "Upload a file": "อัปโหลดไฟล์",
+ "Audio": "เสียง",
+ "Transcribe": "ถอดเสียง",
+ "Preparing audio…": "กำลังเตรียมเสียง…",
+ "Transcribing…": "กำลังถอดเสียง…",
+ "Waiting for the speech model": "กำลังรอโมเดลเสียงพูด",
+ "Waiting for recording to finish": "กำลังรอให้การบันทึกเสร็จสิ้น",
+ "Finish recording before uploading a file.": "สิ้นสุดการบันทึกก่อนอัปโหลดไฟล์",
+ "This audio format is not supported.": "ไม่รองรับรูปแบบเสียงนี้",
+ "Yogurt couldn't read this audio file.": "Yogurt ไม่สามารถอ่านไฟล์เสียงนี้ได้",
+ "Yogurt couldn't transcribe this file.": "Yogurt ไม่สามารถถอดเสียงไฟล์นี้ได้",
+ "Reading the file…": "กำลังอ่านไฟล์…",
+ "Start time": "เวลาเริ่มต้น",
+ "Transcription stopped.": "หยุดการถอดเสียงแล้ว",
+ "Continue transcription": "ถอดเสียงต่อ",
+ "Transcribe again": "ถอดเสียงอีกครั้ง",
+ "Stop transcription": "หยุดถอดเสียง",
+ "Audio is unavailable.": "ไม่มีเสียงให้ใช้งาน"
}
diff --git a/app/src/shared/locales/tr.json b/app/src/shared/locales/tr.json
index 61f8adf1..e9ac0115 100644
--- a/app/src/shared/locales/tr.json
+++ b/app/src/shared/locales/tr.json
@@ -707,5 +707,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt bu adrese ulaşamadı. Bağlantınızı ve adresi kontrol edin.",
"{name} is connected. You can change this any time in Settings.": "{name} bağlandı. Bunu istediğiniz zaman Ayarlar’dan değiştirebilirsiniz.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Yalnızca \"Public address in iCal format\" mı görünüyor? Kuruluşunuz gizli adresleri kapatmış, bu yüzden bu takvim bu yolla bağlanamaz.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Bu, yalnızca takviminiz herkese açıksa çalışan genel adres. Bunun yerine \"Secret address in iCal format\" adresini kopyalayın."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Bu, yalnızca takviminiz herkese açıksa çalışan genel adres. Bunun yerine \"Secret address in iCal format\" adresini kopyalayın.",
+ "Upload a file": "Dosya yükle",
+ "Audio": "Ses",
+ "Transcribe": "Yazıya dök",
+ "Preparing audio…": "Ses hazırlanıyor…",
+ "Transcribing…": "Yazıya dökülüyor…",
+ "Waiting for the speech model": "Konuşma modeli bekleniyor",
+ "Waiting for recording to finish": "Kaydın bitmesi bekleniyor",
+ "Finish recording before uploading a file.": "Dosya yüklemeden önce kaydı bitirin.",
+ "This audio format is not supported.": "Bu ses biçimi desteklenmiyor.",
+ "Yogurt couldn't read this audio file.": "Yogurt bu ses dosyasını okuyamadı.",
+ "Yogurt couldn't transcribe this file.": "Yogurt bu dosyayı yazıya dökemedi.",
+ "Reading the file…": "Dosya okunuyor…",
+ "Start time": "Başlangıç saati",
+ "Transcription stopped.": "Döküm durduruldu.",
+ "Continue transcription": "Döküme devam et",
+ "Transcribe again": "Yeniden döküm oluştur",
+ "Stop transcription": "Dökümü durdur",
+ "Audio is unavailable.": "Ses kullanılamıyor."
}
diff --git a/app/src/shared/locales/uk.json b/app/src/shared/locales/uk.json
index 0dc67047..3a78a5aa 100644
--- a/app/src/shared/locales/uk.json
+++ b/app/src/shared/locales/uk.json
@@ -747,5 +747,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt не зміг відкрити цю адресу. Перевірте з’єднання та адресу.",
"{name} is connected. You can change this any time in Settings.": "{name}: під’єднано. Це можна змінити будь-коли в Параметрах.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Бачите лише «Public address in iCal format»? Ваша організація вимкнула секретні адреси, тож цей календар так під’єднати не вийде.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Це загальнодоступна адреса, вона працює лише для загальнодоступного календаря. Скопіюйте натомість «Secret address in iCal format»."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Це загальнодоступна адреса, вона працює лише для загальнодоступного календаря. Скопіюйте натомість «Secret address in iCal format».",
+ "Upload a file": "Завантажити файл",
+ "Audio": "Аудіо",
+ "Transcribe": "Транскрибувати",
+ "Preparing audio…": "Підготовка аудіо…",
+ "Transcribing…": "Транскрибування…",
+ "Waiting for the speech model": "Очікування мовленнєвої моделі",
+ "Waiting for recording to finish": "Очікування завершення запису",
+ "Finish recording before uploading a file.": "Завершіть запис перед завантаженням файлу.",
+ "This audio format is not supported.": "Цей аудіоформат не підтримується.",
+ "Yogurt couldn't read this audio file.": "Yogurt не вдалося прочитати цей аудіофайл.",
+ "Yogurt couldn't transcribe this file.": "Yogurt не вдалося транскрибувати цей файл.",
+ "Reading the file…": "Читання файлу…",
+ "Start time": "Час початку",
+ "Transcription stopped.": "Транскрибування зупинено.",
+ "Continue transcription": "Продовжити транскрибування",
+ "Transcribe again": "Транскрибувати знову",
+ "Stop transcription": "Зупинити транскрибування",
+ "Audio is unavailable.": "Аудіо недоступне."
}
diff --git a/app/src/shared/locales/vi.json b/app/src/shared/locales/vi.json
index 2151a12f..b7a323b0 100644
--- a/app/src/shared/locales/vi.json
+++ b/app/src/shared/locales/vi.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt không truy cập được địa chỉ đó. Hãy kiểm tra kết nối và địa chỉ.",
"{name} is connected. You can change this any time in Settings.": "Đã kết nối {name}. Bạn có thể đổi bất cứ lúc nào trong Cài đặt.",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "Chỉ thấy \"Public address in iCal format\"? Tổ chức của bạn đã tắt địa chỉ bí mật, nên không thể kết nối lịch này theo cách này.",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Đó là địa chỉ công khai, chỉ dùng được khi lịch của bạn ở chế độ công khai. Hãy sao chép \"Secret address in iCal format\" thay vào đó."
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "Đó là địa chỉ công khai, chỉ dùng được khi lịch của bạn ở chế độ công khai. Hãy sao chép \"Secret address in iCal format\" thay vào đó.",
+ "Upload a file": "Tải tệp lên",
+ "Audio": "Âm thanh",
+ "Transcribe": "Chép lời",
+ "Preparing audio…": "Đang chuẩn bị âm thanh…",
+ "Transcribing…": "Đang chép lời…",
+ "Waiting for the speech model": "Đang chờ mô hình nhận dạng giọng nói",
+ "Waiting for recording to finish": "Đang chờ ghi âm kết thúc",
+ "Finish recording before uploading a file.": "Kết thúc ghi âm trước khi tải tệp lên.",
+ "This audio format is not supported.": "Định dạng âm thanh này không được hỗ trợ.",
+ "Yogurt couldn't read this audio file.": "Yogurt không thể đọc tệp âm thanh này.",
+ "Yogurt couldn't transcribe this file.": "Yogurt không thể chép lời tệp này.",
+ "Reading the file…": "Đang đọc tệp…",
+ "Start time": "Giờ bắt đầu",
+ "Transcription stopped.": "Đã dừng chép lời.",
+ "Continue transcription": "Tiếp tục chép lời",
+ "Transcribe again": "Chép lời lại",
+ "Stop transcription": "Dừng chép lời",
+ "Audio is unavailable.": "Âm thanh không khả dụng."
}
diff --git a/app/src/shared/locales/zh-CN.json b/app/src/shared/locales/zh-CN.json
index f7ff593d..0e5686de 100644
--- a/app/src/shared/locales/zh-CN.json
+++ b/app/src/shared/locales/zh-CN.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt 无法访问该地址。请检查网络连接和地址。",
"{name} is connected. You can change this any time in Settings.": "{name}已连接。你随时可以在设置中更改。",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "只看到“Public address in iCal format”?你的组织关闭了私密地址,因此无法通过这种方式连接此日历。",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "这是公开地址,只有日历公开时才能使用。请改为复制“Secret address in iCal format”。"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "这是公开地址,只有日历公开时才能使用。请改为复制“Secret address in iCal format”。",
+ "Upload a file": "上传文件",
+ "Audio": "音频",
+ "Transcribe": "转录",
+ "Preparing audio…": "正在准备音频…",
+ "Transcribing…": "正在转录…",
+ "Waiting for the speech model": "正在等待语音模型",
+ "Waiting for recording to finish": "正在等待录音结束",
+ "Finish recording before uploading a file.": "请先结束录音,再上传文件。",
+ "This audio format is not supported.": "不支持此音频格式。",
+ "Yogurt couldn't read this audio file.": "Yogurt 无法读取此音频文件。",
+ "Yogurt couldn't transcribe this file.": "Yogurt 无法转录此文件。",
+ "Reading the file…": "正在读取文件…",
+ "Start time": "开始时间",
+ "Transcription stopped.": "转写已停止。",
+ "Continue transcription": "继续转写",
+ "Transcribe again": "重新转写",
+ "Stop transcription": "停止转写",
+ "Audio is unavailable.": "音频不可用。"
}
diff --git a/app/src/shared/locales/zh-TW.json b/app/src/shared/locales/zh-TW.json
index c683daa5..b4c15100 100644
--- a/app/src/shared/locales/zh-TW.json
+++ b/app/src/shared/locales/zh-TW.json
@@ -677,5 +677,23 @@
"Yogurt couldn't reach that address. Check your connection and the address.": "Yogurt 無法連到這個地址。請檢查網路連線和地址。",
"{name} is connected. You can change this any time in Settings.": "{name}已連接。你隨時可以在設定中更改。",
"Only see \"Public address in iCal format\"? Your organization turned off secret addresses, so this calendar can't be connected this way.": "只看到「Public address in iCal format」?你的組織已關閉私人地址,因此無法用這種方式連接這個行事曆。",
- "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "這是公開地址,只有行事曆公開時才能使用。請改為複製「Secret address in iCal format」。"
+ "That's the public address, which only works if your calendar is public. Copy \"Secret address in iCal format\" instead.": "這是公開地址,只有行事曆公開時才能使用。請改為複製「Secret address in iCal format」。",
+ "Upload a file": "上傳檔案",
+ "Audio": "音訊",
+ "Transcribe": "轉錄",
+ "Preparing audio…": "正在準備音訊…",
+ "Transcribing…": "正在轉錄…",
+ "Waiting for the speech model": "正在等待語音模型",
+ "Waiting for recording to finish": "正在等待錄音結束",
+ "Finish recording before uploading a file.": "請先結束錄音,再上傳檔案。",
+ "This audio format is not supported.": "不支援此音訊格式。",
+ "Yogurt couldn't read this audio file.": "Yogurt 無法讀取此音訊檔案。",
+ "Yogurt couldn't transcribe this file.": "Yogurt 無法轉錄此檔案。",
+ "Reading the file…": "正在讀取檔案…",
+ "Start time": "開始時間",
+ "Transcription stopped.": "轉錄已停止。",
+ "Continue transcription": "繼續轉錄",
+ "Transcribe again": "重新轉錄",
+ "Stop transcription": "停止轉錄",
+ "Audio is unavailable.": "音訊無法使用。"
}
diff --git a/app/src/shared/speakerColors.ts b/app/src/shared/speakerColors.ts
index a606400f..effb12fe 100644
--- a/app/src/shared/speakerColors.ts
+++ b/app/src/shared/speakerColors.ts
@@ -1,13 +1,14 @@
+import { AUDIO_SPEAKER } from './audioUpload'
import { FOLDER_COLORS } from './folderAppearance'
export const SPEAKER_COLORS = Object.keys(FOLDER_COLORS).filter(color => color !== 'default')
/** Append newly named speakers without renumbering names already shown. */
export function speakerOrder(previous: readonly string[], names: readonly (string | null)[]): string[] {
- return [...new Set([...previous, ...names.filter((name): name is string => !!name?.trim())])]
+ return [...new Set([...previous, ...names.filter((name): name is string => !!name?.trim() && name !== AUDIO_SPEAKER)])]
}
export function speakerColor(track: string, name: string | null | undefined, order: readonly string[]): number | undefined {
- const index = track === 'them' && name ? order.indexOf(name) : -1
+ const index = track === 'them' && name && name !== AUDIO_SPEAKER ? order.indexOf(name) : -1
return index < 0 ? undefined : index % SPEAKER_COLORS.length
}
diff --git a/app/src/shared/transcript.ts b/app/src/shared/transcript.ts
index 6d6be69b..8b9fd800 100644
--- a/app/src/shared/transcript.ts
+++ b/app/src/shared/transcript.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from './audioUpload'
import { t } from './i18n'
import type { LiveWord } from './liveWords'
/** A transcript line as the view needs it */
@@ -116,3 +117,5 @@ export function recentRuns<L extends object, R extends { lines: L[] }>(runs: R[]
}
return { runs: out, earlier }
}
+
+export const transcriptSpeaker = (line: { track: string; speaker?: string | null }): string => line.speaker === AUDIO_SPEAKER ? t('Audio') : line.track === 'me' ? t('You') : line.speaker || t('Them')
diff --git a/app/src/shared/transcriptReplacement.ts b/app/src/shared/transcriptReplacement.ts
new file mode 100644
index 00000000..922eb177
--- /dev/null
+++ b/app/src/shared/transcriptReplacement.ts
@@ -0,0 +1,15 @@
+import type { Segment } from './types'
+
+type Line = Omit<Segment,'id'> & {id?:number;previous?:boolean}
+/** New words replace the old reading surface from the top; storage still owns the original. */
+export function transcriptReplacement(saved:Line[],draft:Line[]):Line[] {
+ const end=Math.max(0,...draft.map(line=>line.endMs))
+ return [...draft,...saved.filter(line=>line.startMs>=end).map(line=>({...line,previous:true}))]
+ .sort((a,b)=>a.startMs-b.startMs)
+}
+/** A known speaker survives a new segmentation only when every overlapping attribution agrees. */
+export function previousSpeaker(lines:Line[],track:Segment['track'],startMs:number,endMs:number):string|null {
+ const overlap=lines.filter(line=>line.track===track&&line.startMs<endMs&&line.endMs>startMs)
+ const names=new Set(overlap.map(line=>line.speaker))
+ return names.size===1 ? overlap[0]?.speaker??null : null
+}
diff --git a/app/src/shared/transcription.ts b/app/src/shared/transcription.ts
new file mode 100644
index 00000000..9416c000
--- /dev/null
+++ b/app/src/shared/transcription.ts
@@ -0,0 +1,6 @@
+import { t } from './i18n'
+export type TranscriptionState = 'preparing' | 'queued' | 'transcribing' | 'waiting-model' | 'waiting-recording' | 'stopped' | 'error' | 'done'
+export const transcriptionBusy = (state?: TranscriptionState) => !!state && ['preparing','queued','transcribing','waiting-model','waiting-recording'].includes(state)
+export function transcriptionLabel(state?: TranscriptionState) {
+ return state === 'preparing' ? t('Preparing audio…') : state === 'waiting-model' ? t('Waiting for the speech model') : state === 'waiting-recording' ? t('Waiting for recording to finish') : state === 'stopped' ? t('Transcription stopped.') : state === 'error' ? t("Yogurt couldn't transcribe this file.") : state && state !== 'done' ? t('Transcribing…') : undefined
+}
diff --git a/app/src/shared/types.ts b/app/src/shared/types.ts
index 25277698..c4bb4644 100644
--- a/app/src/shared/types.ts
+++ b/app/src/shared/types.ts
@@ -1,3 +1,4 @@
+import type { AudioUploadFile, AudioUploadStatus } from './audioUpload'
import type { RendererError } from './rendererError'
import type { WidgetLayout, WidgetSurface } from './widgetMorph'
import type { ContextChip, ContextTarget } from './askContext'
@@ -111,6 +112,11 @@ export type YogurtApi = {
}
/** the words heard in a meeting, live */
transcript: {
+ draft(meetingId:string):Promise<Segment[]>
+ onDraft(cb:(meetingId:string)=>void):()=>void
+ onReplaced(cb:(meetingId:string)=>void):()=>void
+ run(meetingId:string,again:boolean):Promise<boolean>
+ stop(meetingId:string):Promise<void>
/** the meeting's lines; hidden: the echo lines hidden after the meeting too (each marked hidden); last: only the latest lines */
get(meetingId: string, o?: { hidden?: boolean; last?: number }): Promise<Segment[]>
/** brings hidden lines back: the ones given, or all of the meeting's */
@@ -177,6 +183,13 @@ export type YogurtApi = {
show(): void
}
/** a meeting's recording, played at yogurt-audio://<meetingId>/<track> */
+ audioUpload: {
+ pick(): Promise<AudioUploadFile | null>
+ inspect(token: string): Promise<number>
+ start(token: string, title: string, at: number): Promise<void>
+ cancel(token: string): Promise<void>
+ onStatus(cb: (token: string, status: AudioUploadStatus) => void): () => void
+ }
audio: {
delete(id: string): Promise<DeleteRecordingResult>
onDeleted(cb: (id: string) => void): () => void
@@ -353,7 +366,7 @@ export type SetupState = {
export type { Meeting, Person, Segment, SnippetPart, Folder } from '../main/store'
export type { CalEvent, CalendarSource, CalendarStatus } from '../main/calendar'
/** Calendar occurrence with its saved note, if one exists. No inferred or sample meetings. */
-export type AgendaEvent = CalEvent & { note?: { id: string; state: Meeting['state'] } }
+export type AgendaEvent = CalEvent & { note?: { id: string; state: Meeting['state']; source?: string } }
/** Start notes: the meeting's id, or why it didn't start (gone: the event left the calendar) */
export type StartResult = { id: string; alreadyRecording?: true; resumeRequested?: true } | { error: 'gone' | 'failed' }
/** one meeting found: parts is a piece of its notes or transcript, hit on the words matched */
diff --git a/app/test/audio.test.ts b/app/test/audio.test.ts
index 8dbe5625..577e05e5 100644
--- a/app/test/audio.test.ts
+++ b/app/test/audio.test.ts
@@ -87,9 +87,9 @@ describe('the yogurt-audio protocol', () => {
describe('recordings from either kind of computer', () => {
it('a Mac records m4a, Windows and Linux record Ogg Opus; each plays the other\'s too, its own first', () => {
- expect(audioExts('darwin', false)).toEqual(['m4a', 'ogg'])
- expect(audioExts('win32', false)).toEqual(['ogg', 'm4a'])
- expect(audioExts('linux', false)).toEqual(['ogg', 'm4a'])
+ expect(audioExts('darwin', false)).toEqual(['m4a', 'ogg', 'wav'])
+ expect(audioExts('win32', false)).toEqual(['ogg', 'm4a', 'wav'])
+ expect(audioExts('linux', false)).toEqual(['ogg', 'm4a', 'wav'])
expect(audioExts('darwin', true)).toEqual(['wav'])
})
it('serves an Ogg recording as audio/ogg, and a Mac backup\'s m4a beside it', async () => {
diff --git a/app/test/audioUpload.test.ts b/app/test/audioUpload.test.ts
new file mode 100644
index 00000000..688e3921
--- /dev/null
+++ b/app/test/audioUpload.test.ts
@@ -0,0 +1,118 @@
+import { afterEach, beforeEach, expect, it, vi } from 'vitest'
+import { mkdtemp, readFile, rm, writeFile, stat, utimes } from 'node:fs/promises'
+import { join } from 'node:path'
+import { tmpdir } from 'node:os'
+import { createAudioUploads, uploadedAudio } from '../src/main/audioUpload'
+import { openStore, type Store } from '../src/main/store'
+import { wavBytes } from '../src/main/asr/transcribe'
+import { AUDIO_SPEAKER, uploadDate, uploadStartedAt, uploadDateTime, uploadTime, type AudioUploadStatus } from '../src/shared/audioUpload'
+import { transcriptSpeaker } from '../src/shared/transcript'
+import { whoSaid } from '../src/shared/exportNotes'
+import { transcriptText } from '../src/main/notes/enhance'
+import { chunkTranscript } from '../src/main/library/chunks'
+import { citationCardPassage } from '../src/shared/citationCard'
+import { speakerColor } from '../src/shared/speakerColors'
+const modifiedAt=+new Date(2026,10,16,10,30)
+let root:string,path:string,store:Store,recording:boolean
+const send=vi.fn(),prepared=vi.fn(),changed=vi.fn()
+const last=()=>send.mock.calls.at(-1)?.[2] as AudioUploadStatus
+let uploads:ReturnType<typeof createAudioUploads>
+beforeEach(async()=>{
+ root=await mkdtemp(join(tmpdir(),'audio-upload-'));path=join(root,'Planning.wav');store=openStore(':memory:');recording=false;vi.clearAllMocks()
+ await writeFile(path,wavBytes(new Float32Array(320)));await utimes(path,modifiedAt/1000,modifiedAt/1000)
+ uploads=createAudioUploads({root:join(root,'meetings'),store,recording:()=>recording,prepared,changed,send})
+})
+afterEach(async()=>{for(const token of uploads.tokens(1))await uploads.cancel(1,token);store.close();await rm(root,{recursive:true,force:true})})
+async function prepare(){const file=await uploads.select(1,path);await uploads.start(1,file.token,'Planning',modifiedAt-200);await uploads.write(1,file.token,new Float32Array(3200).fill(.25),1);return file}
+it('opens a pending note immediately, then hands a durable playable WAV to the shared queue',async()=>{
+ const before=await readFile(path),file=await prepare()
+ expect(store.meeting(file.token)).toMatchObject({title:'Planning',transcriptionState:'preparing',transcriptionPending:true})
+ expect(last().meetingId).toBe(file.token);await uploads.finish(1,file.token)
+ expect(prepared).toHaveBeenCalledExactlyOnceWith(file.token)
+ expect(store.meeting(file.token)).toMatchObject({startedAt:modifiedAt-200,endedAt:modifiedAt,durationMs:200})
+ const wave=await readFile(join(root,'meetings',file.token,'them.wav'));expect(wave.readUInt32LE(40)).toBe(6400)
+ expect(await readFile(path)).toEqual(before)
+})
+it('cancels preparation without deleting the original or the note someone may have edited',async()=>{
+ const file=await prepare();await uploads.cancel(1,file.token)
+ expect(store.meeting(file.token)?.transcriptionState).toBe('error');expect(prepared).not.toHaveBeenCalled();expect(await readFile(path)).toEqual(wavBytes(new Float32Array(320)))
+})
+it('validates ownership and bounds before accepting reads, output and metadata',async()=>{
+ const file=await uploads.select(1,path);await expect(uploads.start(2,file.token,'Planning',Date.now())).rejects.toThrow('Unknown')
+ await expect(uploads.start(1,file.token,'',Date.now())).rejects.toThrow('Invalid');expect(store.meetings({limit:10})).toEqual([])
+ await uploads.start(1,file.token,'Planning',Date.now());await expect(uploads.read(1,file.token,-1,12)).rejects.toThrow('Invalid')
+ await expect(uploads.read(1,file.token,0,1024**2+1)).rejects.toThrow('Invalid');await expect(uploads.write(1,file.token,new Float32Array([NaN]),.5)).rejects.toThrow('Invalid')
+ await expect(uploads.write(1,file.token,new Float32Array(65537),.5)).rejects.toThrow('Invalid')
+})
+it('waits for a recording and cancels a paused read without waiting for capture to finish',async()=>{
+ const file=await uploads.select(1,path);recording=true;expect(await uploads.start(1,file.token,'Planning',Date.now())).toMatchObject({decode:false})
+ recording=false;await uploads.start(1,file.token,'Planning',Date.now());recording=true
+ const pending=uploads.read(1,file.token,0,12);const rejection=expect(pending).rejects.toThrow('Cancelled');await uploads.cancel(1,file.token);await rejection
+})
+it('rejects a changed source and can retry preparation without retaining previous samples',async()=>{
+ const file=await prepare();await uploads.failed(1,file.token,'read');await uploads.start(1,file.token,'Revised title',modifiedAt)
+ await uploads.write(1,file.token,new Float32Array(1600),1);await uploads.finish(1,file.token)
+ expect(store.meeting(file.token)).toMatchObject({title:'Revised title',durationMs:100})
+})
+it('marks preparation interrupted by a restart as failed rather than claiming it resumed',async()=>{
+ const file=await prepare();store.interruptAudioPreparations();expect(store.meeting(file.token)?.transcriptionState).toBe('error');expect(store.meeting(file.token)?.transcriptionPending).toBeUndefined()
+})
+
+it('uses local calendar dates and keeps the file time when changing its date',()=>{
+ const original=+new Date(2026,10,16,23,42)
+ expect(uploadDate(original)).toBe('2026-11-16')
+ const changed=uploadStartedAt('2026-11-17',original)!
+ expect(new Date(changed).getHours()).toBe(23);expect(new Date(changed).getDate()).toBe(17)
+ expect(uploadStartedAt('2026-02-31',original)).toBeUndefined();expect(uploadStartedAt('bad',original)).toBeUndefined()
+})
+it('never labels the uploaded track as You, Them or a named person in UI, exports and notes',()=>{
+ const line={id:1,meetingId:'sample',track:'them' as const,speaker:AUDIO_SPEAKER,startMs:0,endMs:100,text:'A sample line'}
+ expect(transcriptSpeaker(line)).toBe('Audio');expect(whoSaid(line)).toBe('Audio');expect(transcriptText([line])).toBe('Audio: A sample line')
+ expect(speakerColor('them',AUDIO_SPEAKER,[AUDIO_SPEAKER])).toBeUndefined()
+})
+
+it('keeps Audio out of indexed people and strips its prefix from citation excerpts', () => {
+ const line = { id: 1, meetingId: 'sample', track: 'them' as const, speaker: AUDIO_SPEAKER, startMs: 0, endMs: 100, text: 'A sample line' }
+ expect(chunkTranscript([line])[0]).toMatchObject({ text: 'Audio: A sample line', speakers: [] })
+ const preview = citationCardPassage({ n: 1, meetingId: 'sample', title: 'Planning', startedAt: 0, atMs: 0, excerpt: 'Audio: A sample line', transcript: { speakers: [], lines: [line] } }, 'A sample line')
+ expect(preview.match.text).toBe('A sample line')
+ expect(transcriptSpeaker(preview.lines[0])).toBe('Audio')
+})
+
+it('shows the inferred start even across midnight, then keeps its time on an edited date', () => {
+ const modified = +new Date(2026, 10, 16, 0, 30), inferred = modified - 2 * 60 * 60 * 1000
+ expect(uploadDate(inferred)).toBe('2026-11-15')
+ expect(uploadTime(inferred)).toBe('22:30')
+ expect(uploadDateTime('2026-11-20', '22:30', inferred)).toBe(+new Date(2026, 10, 20, 22, 30))
+ expect(uploadDateTime('2026-11-20', '14:00', inferred)).toBe(+new Date(2026, 10, 20, 14))
+ expect(uploadDateTime('2026-11-20', '25:30', inferred)).toBeUndefined()
+ expect(uploadDateTime('2026-02-31', '14:00', inferred)).toBeUndefined()
+})
+it('keeps the inferred local time when the chosen day has a different daylight-saving offset', () => {
+ const inferred = +new Date(2026, 0, 15, 12, 55, 30, 500)
+ expect(uploadDateTime('2026-07-15', '12:55', inferred)).toBe(+new Date(2026, 6, 15, 12, 55, 30, 500))
+})
+it('allows bounded metadata reads before creating any output or meeting', async () => {
+ const file = await uploads.select(1,path)
+ expect(uploads.info(1,file.token)).toEqual(file)
+ expect(() => uploads.info(2,file.token)).toThrow('Unknown')
+ expect(await uploads.read(1,file.token,0,12)).toEqual((await readFile(path)).subarray(0,12))
+ expect(store.meetings({limit:10})).toEqual([])
+ await uploads.cancel(1,file.token)
+ expect(await readFile(path)).toEqual(wavBytes(new Float32Array(320)))
+})
+
+it('rejects a future meeting day at the main-process boundary',async()=>{
+ const file=await uploads.select(1,path),tomorrow=new Date();tomorrow.setDate(tomorrow.getDate()+1)
+ await expect(uploads.start(1,file.token,'Planning',+tomorrow)).rejects.toThrow('Invalid audio details')
+ expect(store.meetings({limit:10})).toEqual([])
+})
+
+it('exposes preparation before the first decoded sample and keeps edits made while it runs',async()=>{
+ const file=await uploads.select(1,path);await uploads.start(1,file.token,'Planning',modifiedAt)
+ expect(last()).toMatchObject({phase:'preparing',meetingId:file.token,fraction:0})
+ expect(prepared).not.toHaveBeenCalled();expect(store.meeting(file.token)?.transcriptionState).toBe('preparing')
+ store.updateMeeting(file.token,{title:'Edited on the note',startedAt:modifiedAt-60000})
+ await uploads.write(1,file.token,new Float32Array(1600),1);await uploads.finish(1,file.token)
+ expect(store.meeting(file.token)).toMatchObject({title:'Edited on the note',startedAt:modifiedAt-60000,endedAt:modifiedAt-59900,durationMs:100})
+})
diff --git a/app/test/audioUploadDecode.test.ts b/app/test/audioUploadDecode.test.ts
new file mode 100644
index 00000000..dd4bf05f
--- /dev/null
+++ b/app/test/audioUploadDecode.test.ts
@@ -0,0 +1,146 @@
+import { inspectAudioUpload } from '../src/preload/audioUpload/inspect'
+import { expect, it, vi } from 'vitest'
+import { AudioResampler } from '../src/preload/audioUpload/resample'
+import { AudioReader, type AudioSource } from '../src/preload/audioUpload/read'
+import { decodeAudioUpload } from '../src/preload/audioUpload/decode'
+import { mp3, mp3Header } from '../src/preload/audioUpload/mp3'
+import { m4a } from '../src/preload/audioUpload/m4a'
+import { wavBytes } from '../src/main/asr/transcribe'
+const source=(bytes:Uint8Array):AudioSource=>({size:bytes.length,read:async(at,n)=>bytes.slice(at,at+n)})
+const reader=(b:Uint8Array)=>new AudioReader(source(b),new AbortController().signal)
+const words=(...values:number[])=>{const b=Buffer.alloc(values.length*4);values.forEach((n,i)=>b.writeUInt32BE(n,i*4));return b}
+const box=(type:string,...body:Uint8Array[])=>{const bytes=Buffer.concat(body);return Buffer.concat([words(bytes.length+8),Buffer.from(type),bytes])}
+const full=(...body:Uint8Array[])=>Buffer.concat([words(0),...body])
+const desc=(tag:number,data:Uint8Array)=>Buffer.concat([Buffer.from([tag,data.length]),data])
+function aacFile(handler='soun') {
+ const ftyp=box('ftyp',Buffer.from('M4A '),words(0),Buffer.from('isom')),mdat=box('mdat',Buffer.from([1,2,3,4,5,6,7]))
+ const config=desc(3,Buffer.concat([Buffer.from([0,1,0]),desc(4,Buffer.concat([Buffer.alloc(13),desc(5,Buffer.from([0x12,0x10]))]))]))
+ const entry=Buffer.alloc(28);entry.writeUInt16BE(2,16);entry.writeUInt16BE(16,18);entry.writeUInt32BE(44100*65536,24)
+ const stbl=box('stbl',box('stsd',full(words(1),box('mp4a',entry,box('esds',full(config))))),box('stsz',full(words(0,2,3,4))),box('stco',full(words(1,ftyp.length+8))),box('stsc',full(words(1,1,2,1))),box('stts',full(words(1,2,1024))))
+ return Buffer.concat([ftyp,mdat,box('moov',box('mvhd',full(words(0,0,1000,47))),box('trak',box('mdia',box('mdhd',full(words(0,0,44100,2048))),box('hdlr',full(words(0),Buffer.from(handler),Buffer.alloc(12))),box('minf',stbl))))])
+}
+it('reads AAC config, chunk offsets, individual sample sizes and timestamps from M4A',async()=>{
+ const audio=await m4a(reader(aacFile()));expect(audio.config).toMatchObject({codec:'mp4a.40.2',sampleRate:44100,numberOfChannels:2})
+ expect(Array.from(new Uint8Array(audio.config.description as Uint8Array))).toEqual([0x12,0x10])
+ const packets=[];for await(const p of audio.packets)packets.push(p)
+ expect(packets.map(p=>Array.from(p.data))).toEqual([[1,2,3],[4,5,6,7]])
+ expect(packets.map(p=>p.timestamp)).toEqual([0,23220]);expect(packets.at(-1)?.fraction).toBe(1)
+})
+it('rejects video containers, fragmented files, and malformed M4A tables',async()=>{
+ await expect(m4a(reader(aacFile('vide')))).rejects.toThrow()
+ await expect(m4a(reader(Buffer.concat([aacFile(),box('moof')])))).rejects.toThrow()
+ const corrupt=aacFile();const at=corrupt.indexOf('stsz')+12;corrupt.writeUInt32BE(0xffffffff,at)
+ await expect(m4a(reader(corrupt))).rejects.toThrow()
+ const badChunk=aacFile();badChunk.writeUInt32BE(2,badChunk.indexOf('stsc')+12);await expect(m4a(reader(badChunk))).rejects.toThrow()
+})
+it('handles variable bitrate MP3 frames and skips ID3 metadata without reading the whole file',async()=>{
+ const headers=[Buffer.from([255,251,144,0]),Buffer.from([255,251,160,0])]
+ const frames=headers.map(h=>{const b=Buffer.alloc(mp3Header(h).length);b.set(h);return b})
+ const id3=Buffer.from([73,68,51,4,0,0,0,0,0,3,0,0,0]),audio=await mp3(reader(Buffer.concat([id3,...frames])))
+ expect(audio.config).toEqual({codec:'mp3',sampleRate:44100,numberOfChannels:2})
+ const result=[];for await(const p of audio.packets)result.push(p)
+ expect(result.map(p=>p.data.length)).toEqual(frames.map(f=>f.length));expect(result[1].timestamp).toBe(26122)
+})
+it('rejects truncated MP3 frames and unsupported free-bitrate headers',async()=>{
+ expect(()=>mp3Header(Buffer.from([255,251,0,0]))).toThrow()
+ const audio=await mp3(reader(Buffer.concat([Buffer.from([255,251,144,0]),Buffer.alloc(20)])))
+ await expect(audio.packets[Symbol.asyncIterator]().next()).rejects.toThrow()
+})
+it('decodes PCM WAV in bounded chunks, downmixes and preserves sample time',async()=>{
+ const bytes=wavBytes(Float32Array.from({length:32001},(_,i)=>.25*Math.sin(i/8)))
+ const chunks:Float32Array[]=[];await decodeAudioUpload(source(bytes),async p=>{chunks.push(p)},new AbortController().signal)
+ expect(chunks.reduce((n,c)=>n+c.length,0)).toBe(32001);expect(Math.max(...chunks.map(c=>c.length))).toBeLessThanOrEqual(8192)
+ expect(chunks[1].every(Number.isFinite)).toBe(true)
+ const stereo=Buffer.alloc(44+8);wavBytes(new Float32Array(4)).copy(stereo,0,0,44);stereo.writeUInt16LE(2,22);stereo.writeUInt16LE(4,32);stereo.writeUInt32LE(64000,28)
+ stereo.writeInt16LE(16384,44);stereo.writeInt16LE(-16384,46);stereo.writeInt16LE(16384,48);stereo.writeInt16LE(-16384,50)
+ let heard:Float32Array|undefined;await decodeAudioUpload(source(stereo),async p=>{heard=p},new AbortController().signal);expect([...heard!]).toEqual([0,0])
+})
+it('starts a three-hour WAV with bounded reads and cancels without decoding the remaining hours',async()=>{
+ const dataBytes=16000*2*3*3600,header=wavBytes(new Float32Array(0));header.writeUInt32LE(36+dataBytes,4);header.writeUInt32LE(dataBytes,40)
+ const sizes:number[]=[],abort=new AbortController()
+ const long:AudioSource={size:dataBytes+44,read:async(at,n)=>{sizes.push(n);const b=new Uint8Array(n);if(at<header.length)b.set(header.subarray(at,Math.min(header.length,at+n)));return b}}
+ let samples=0
+ await expect(decodeAudioUpload(long,async p=>{samples+=p.length;abort.abort()},abort.signal)).rejects.toThrow()
+ expect(samples).toBeGreaterThan(0);expect(samples).toBeLessThan(16000);expect(Math.max(...sizes)).toBeLessThanOrEqual(1024**2);expect(sizes.reduce((a,b)=>a+b,0)).toBeLessThan(2*1024**2)
+})
+it('rejects corrupt WAV payloads and nonfinite floating samples',async()=>{
+ const b=wavBytes(new Float32Array(30));await expect(decodeAudioUpload(source(b.subarray(0,b.length-1)),async()=>{},new AbortController().signal)).rejects.toThrow()
+ const bad=Buffer.alloc(48);wavBytes(new Float32Array(2)).copy(bad,0,0,44);bad.writeUInt16LE(3,20);bad.writeUInt16LE(32,34);bad.writeUInt16LE(4,32);bad.writeFloatLE(NaN,44)
+ await expect(decodeAudioUpload(source(bad),async()=>{},new AbortController().signal)).rejects.toThrow()
+})
+it('resamples identically across arbitrary chunk boundaries and rejects above-band energy',()=>{
+ const n=48000,input=Float32Array.from({length:n},(_,i)=>Math.sin(2*Math.PI*1000*i/48000))
+ const full=new AudioResampler(48000).push(input,true),stream=new AudioResampler(48000),pieces:Float32Array[]=[]
+ for(let at=0;at<input.length;at+=917)pieces.push(stream.push(input.subarray(at,at+917)))
+ pieces.push(stream.push(new Float32Array(0),true));const result=Float32Array.from(pieces.flatMap(p=>Array.from(p)))
+ expect(result).toEqual(full);expect(result).toHaveLength(16000)
+ const high=new AudioResampler(48000).push(Float32Array.from({length:n},(_,i)=>Math.sin(2*Math.PI*14000*i/48000)),true)
+ const rms=(a:Float32Array)=>Math.sqrt(a.slice(100,-100).reduce((sum,v)=>sum+v*v,0)/(a.length-200))
+ expect(rms(full)).toBeGreaterThan(.65);expect(rms(high)).toBeLessThan(.02)
+})
+it('keeps the exact output duration at 44.1kHz without accumulating block-rounding drift',()=>{
+ const r=new AudioResampler(44100);let frames=0
+ for(let i=0;i<101;i++)frames+=r.push(new Float32Array(441)).length
+ frames+=r.push(new Float32Array(0),true).length
+ expect(frames).toBe(16160)
+})
+
+it('accepts extensible PCM only with the actual PCM subtype GUID', async () => {
+ const plain=wavBytes(new Float32Array(100)),ext=Buffer.alloc(plain.length+24)
+ plain.copy(ext,0,0,36);ext.writeUInt32LE(ext.length-8,4);ext.writeUInt32LE(40,16);ext.writeUInt16LE(65534,20)
+ ext.writeUInt16LE(22,36);ext.writeUInt16LE(16,38);ext.writeUInt32LE(1,40)
+ ext.set([1,0,0,0,0,0,16,0,128,0,0,170,0,56,155,113],44);plain.copy(ext,60,36)
+ let count=0;await decodeAudioUpload(source(ext),async p=>{count+=p.length},new AbortController().signal);expect(count).toBe(100)
+ ext[59]=0
+ await expect(decodeAudioUpload(source(ext),async()=>{},new AbortController().signal)).rejects.toThrow()
+})
+
+it('reads WAV length from its header without walking through hours of samples', async () => {
+ const dataBytes=16000*2*3*3600,header=wavBytes(new Float32Array(0));header.writeUInt32LE(36+dataBytes,4);header.writeUInt32LE(dataBytes,40)
+ let read=0
+ const file:AudioSource={size:dataBytes+44,read:async(at,n)=>{read+=n;const b=new Uint8Array(n);if(at<header.length)b.set(header.subarray(at,Math.min(header.length,at+n)));return b}}
+ expect(await inspectAudioUpload(file,new AbortController().signal)).toBe(3*3600*1000)
+ expect(read).toBeLessThanOrEqual(1024**2)
+})
+it('reads M4A length from sample timing tables without decoding its payload', async () => {
+ expect(await inspectAudioUpload(source(aacFile()),new AbortController().signal)).toBeCloseTo(2048/44100*1000)
+})
+it('reads Xing and VBRI frame counts, or scans VBR frame headers when neither exists', async () => {
+ const h=Buffer.from([255,251,144,0]),length=mp3Header(h).length
+ const xing=Buffer.alloc(length*1000);xing.set(h);xing.write('Xing',36);xing.writeUInt32BE(1,40);xing.writeUInt32BE(1000,44)
+ expect(await inspectAudioUpload(source(xing),new AbortController().signal)).toBeCloseTo(1000*1152/44100*1000)
+ await expect(inspectAudioUpload(source(xing.subarray(0,length)),new AbortController().signal)).rejects.toThrow()
+ const vbri=Buffer.alloc(length*2000);vbri.set(h);vbri.write('VBRI',36);vbri.writeUInt32BE(2000,50)
+ expect(await inspectAudioUpload(source(vbri),new AbortController().signal)).toBeCloseTo(2000*1152/44100*1000)
+ const frames=[h,Buffer.from([255,251,160,0])].map(h=>{const b=Buffer.alloc(mp3Header(h).length);b.set(h);return b})
+ expect(await inspectAudioUpload(source(Buffer.concat(frames)),new AbortController().signal)).toBeCloseTo(2*1152/44100*1000)
+ await expect(inspectAudioUpload(source(Buffer.concat(frames).subarray(0,-1)),new AbortController().signal)).rejects.toThrow()
+})
+it('cancels metadata inspection and rejects empty or corrupt files instead of inventing a length', async () => {
+ const abort=new AbortController();abort.abort()
+ await expect(inspectAudioUpload(source(aacFile()),abort.signal)).rejects.toThrow()
+ await expect(inspectAudioUpload(source(wavBytes(new Float32Array(0))),new AbortController().signal)).rejects.toThrow()
+})
+it('interrupts a long MP3 header scan between bounded reads', async () => {
+ const h=Buffer.from([255,251,144,0]),size=mp3Header(h).length,bytes=Buffer.alloc(size*6000)
+ for(let at=0;at<bytes.length;at+=size)bytes.set(h,at)
+ const abort=new AbortController();let reads=0
+ const file:AudioSource={size:bytes.length,read:async(at,n)=>{if(++reads===2)abort.abort();return bytes.subarray(at,at+n)}}
+ await expect(inspectAudioUpload(file,abort.signal)).rejects.toThrow()
+ expect(reads).toBe(2)
+})
+
+it('batches decoded frames without losing samples or exceeding the main write limit',async()=>{
+ const h=Buffer.from([255,251,144,0]),length=mp3Header(h).length,bytes=Buffer.alloc(length*128)
+ for(let at=0;at<bytes.length;at+=length)bytes.set(h,at)
+ class Decoder {
+ static async isConfigSupported(){return{supported:true}}
+ state='configured';constructor(private callbacks:{output:(frame:unknown)=>void}){}
+ configure(){};close(){this.state='closed'};async flush(){}
+ decode(packet:{timestamp:number}){this.callbacks.output({timestamp:packet.timestamp,sampleRate:44100,numberOfChannels:1,numberOfFrames:1152,copyTo:(plane:Float32Array)=>plane.fill(.25),close(){}})}
+ }
+ vi.stubGlobal('AudioDecoder',Decoder);vi.stubGlobal('EncodedAudioChunk',class{timestamp:number;constructor(p:{timestamp:number}){this.timestamp=p.timestamp}})
+ try{const chunks:Float32Array[]=[];await decodeAudioUpload(source(bytes),async p=>{chunks.push(p.slice())},new AbortController().signal)
+ expect(chunks.length).toBeLessThan(5);expect(chunks.reduce((n,p)=>n+p.length,0)).toBe(Math.floor(128*1152*16000/44100));expect(chunks.every(p=>p.length<=65536&&p.every(Number.isFinite))).toBe(true)
+ }finally{vi.unstubAllGlobals()}
+})
diff --git a/app/test/backup.test.ts b/app/test/backup.test.ts
index bdcec4e7..07fdbe8d 100644
--- a/app/test/backup.test.ts
+++ b/app/test/backup.test.ts
@@ -140,7 +140,7 @@ describe('backup merge', () => {
it('knows every table that holds a meeting\'s rows, and every table is one of them', () => {
const s = fresh()
- expect(meetingTables(s.db).map((t) => t.table).sort()).toEqual(['chat_turns', 'folder_meetings', 'library_chunks', 'library_sources', 'notes', 'segments'])
+ expect(meetingTables(s.db).map((t) => t.table).sort()).toEqual(['chat_turns', 'folder_meetings', 'library_chunks', 'library_sources', 'notes', 'segments', 'transcription_drafts'])
// a new table that is not tied to a meeting would be left out of backups: decide what a backup does with it, then list it here
const all = (s.db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '%_fts%'").all() as Array<{ name: string }>).map((r) => r.name)
expect(all.filter((t) => t !== 'meetings' && !meetingTables(s.db).some((m) => m.table === t)).sort()).toEqual(['conversation_turns', 'conversations', 'folders', 'own_emails', 'people'])
diff --git a/app/test/libraryIndexer.test.ts b/app/test/libraryIndexer.test.ts
index afec15a2..0731455e 100644
--- a/app/test/libraryIndexer.test.ts
+++ b/app/test/libraryIndexer.test.ts
@@ -106,3 +106,12 @@ describe('indexing meetings for chat across them', () => {
expect(r.library.vectors(r.embedder.model())).toHaveLength(20)
})
})
+
+it('replaces chunks and vectors even when the transcript length and timestamps are unchanged',async()=>{
+ const r=rig({embedPath:'/m/e.gguf'}),m=meeting(r.store,'Review',['Old words'])
+ await r.indexer.schedule();const old=r.library.chunksOf(m.id)[0].id;r.indexer.vectors()
+ r.store.beginTranscriptionReplacement(m.id);r.store.addTranscriptionDraft(m.id,[{meetingId:m.id,track:'me',startMs:0,endMs:900,text:'New words',speaker:null}]);r.store.commitTranscriptionDraft(m.id)
+ r.indexer.ensure([m.id]);expect(r.library.chunksOf(m.id)[0].text).toContain('New words');expect(r.library.chunksOf(m.id)[0].id).not.toBe(old)
+ expect(r.library.vectors(r.embedder.model())).toEqual([])
+ await r.indexer.schedule();expect(r.library.vectors(r.embedder.model())).toHaveLength(1)
+})
diff --git a/app/test/meeting.test.ts b/app/test/meeting.test.ts
index 6e90e9ca..906178c5 100644
--- a/app/test/meeting.test.ts
+++ b/app/test/meeting.test.ts
@@ -362,3 +362,13 @@ it('calendar reads refresh active snapshots without changing manual edits or not
finally { fail.mockRestore(); warn.mockRestore() }
} finally { off() }
})
+
+it('links an uploaded note to the exact event time, title and people without changing its audio timeline', () => {
+ const startedAt = +new Date(2026, 10, 16, 9, 15), durationMs = 45 * 60_000
+ const imported = store.createMeeting({ source: 'audio-file', title: 'Planning audio', titleSource: 'user', startedAt, endedAt: startedAt + durationMs, durationMs, state: 'done', eventId: null, app: null, attendees: [] })
+ store.setNotes(imported.id, { mine: 'Keep my notes.', enhanced: 'Keep this summary.' })
+ const invite = { id: 'sample-event', title: 'Project planning', start: +new Date(2026, 10, 16, 9), end: +new Date(2026, 10, 16, 10), attendees: [{ name: 'Alex', email: '[email protected]' }], url: null }
+ linkEvent(imported.id, invite)
+ expect(store.meeting(imported.id)).toMatchObject({ source: 'audio-file', startedAt, durationMs, endedAt: startedAt + durationMs, eventId: invite.id, eventStartedAt: invite.start, eventEndedAt: invite.end, title: invite.title, titleSource: 'calendar', attendees: invite.attendees })
+ expect(store.notes(imported.id)).toMatchObject({ mine: 'Keep my notes.', enhanced: 'Keep this summary.' })
+})
diff --git a/app/test/noteDateRead.test.ts b/app/test/noteDateRead.test.ts
index 6e07ba3a..d32e47d7 100644
--- a/app/test/noteDateRead.test.ts
+++ b/app/test/noteDateRead.test.ts
@@ -220,3 +220,16 @@ it('opens choices on the note day, browses another day and keeps empty days navi
expect(byId(tree, 'note-date-previous')).toBeDefined()
expect(byId(tree, 'note-date-next')).toBeDefined()
})
+
+it('opens an uploaded note on its inferred start day and offers that day’s calendar events', async () => {
+ const startedAt = +new Date(2026, 10, 15, 22, 30)
+ const dayEvent = { ...event, start: +new Date(2026, 10, 15, 22), end: +new Date(2026, 10, 15, 23) }
+ const result = { status: 'granted', events: [dayEvent] }, day = vi.fn().mockResolvedValue(result)
+ const render = setup(day), imported = { ...unlinked, source: 'audio-file', startedAt }
+ render(imported)
+ await vi.advanceTimersByTimeAsync(0)
+ const choices = picker(render(imported))
+ expect(day).toHaveBeenCalledWith(startedAt)
+ expect(choices.props.day).toBe(startedAt)
+ expect(choices.props.result.events).toEqual([dayEvent])
+})
diff --git a/app/test/notes.test.ts b/app/test/notes.test.ts
index 96cf48b5..70d8cf0b 100644
--- a/app/test/notes.test.ts
+++ b/app/test/notes.test.ts
@@ -18,12 +18,12 @@ const wait = (ms = 5) => new Promise((r) => setTimeout(r, ms))
/** waits for what an assertion needs, up to 5 s: a fixed sleep was too short on a slow Windows runner */
const until = (check: () => void) => vi.waitFor(check, { timeout: 5000, interval: 10 })
-function setup(o: { summaryLanguage?: () => string; me?: string; named?: () => Promise<void>; namesWaitMs?: number; reply?: string | ((prompt: string) => string); during?: () => void; load?: Promise<void>; title?: string; recording?: () => boolean; smallMac?: boolean; showLoading?: boolean } = {}) {
+function setup(o: { source?: string; summaryLanguage?: () => string; me?: string; named?: () => Promise<void>; namesWaitMs?: number; reply?: string | ((prompt: string) => string); during?: () => void; load?: Promise<void>; title?: string; recording?: () => boolean; smallMac?: boolean; showLoading?: boolean } = {}) {
const d = mkdtempSync(join(tmpdir(), 'yogurt-notes-'))
dirs.push(d)
const store = openStore(join(d, 'yogurt.db'))
stores.push(store)
- const m = store.createMeeting({ title: o.title ?? 'Sync', startedAt: 1, endedAt: 2, eventId: null, app: null, attendees: [], state: 'stopped' })
+ const m = store.createMeeting({ source: o.source, title: o.title ?? 'Sync', startedAt: 1, endedAt: 2, eventId: null, app: null, attendees: [], state: 'stopped' })
store.addSegments([{ meetingId: m.id, track: 'them', startMs: 0, endMs: 1000, text: 'We ship Tuesday.', speaker: 'Priya Nair' }])
store.setNotes(m.id, { mine: '- ship tuesday' })
let transcribed!: () => void
@@ -47,6 +47,18 @@ function setup(o: { summaryLanguage?: () => string; me?: string; named?: () => P
}
describe('hookNotes', () => {
+ it('waits for an imported transcript before recovery or a manual rewrite creates notes', async () => {
+ const s = setup({ source: 'audio-file' })
+ s.store.updateMeeting(s.m.id, { transcriptionPending: true })
+ s.transcribed()
+ s.notes.recover()
+ await s.notes.writeAgain(s.m.id)
+ await wait()
+ expect(s.prompts).toEqual([])
+ s.store.updateMeeting(s.m.id, { transcriptionPending: false })
+ await s.notes.writeAgain(s.m.id)
+ expect(s.prompts.length).toBeGreaterThan(0)
+ })
it('a manual stop invalidates a pending transcript without restarting on recovery', async () => {
const s = setup()
s.stop()
diff --git a/app/test/resumeRequest.test.ts b/app/test/resumeRequest.test.ts
index ea87c2be..0968cf42 100644
--- a/app/test/resumeRequest.test.ts
+++ b/app/test/resumeRequest.test.ts
@@ -26,6 +26,7 @@ vi.mock('../src/renderer/src/motion', async original => ({ ...await original<typ
let meeting: MeetingView, notes: NoteView
let meetingChanged: () => void, notesChanged: (notes: NoteView) => void
const resume = vi.fn(), consumed = vi.fn(), title = vi.fn(), source = vi.fn()
+const meetingListeners=new Set<()=>void>()
const transcriptGet = vi.fn(), stopSummary = vi.fn()
let segmentChanged: (line: { meetingId: string; text: string }) => void, transcriptChanged: (id: string) => void, setupChanged: (state: SetupState) => void
let requested: (() => void) | undefined
@@ -47,7 +48,7 @@ function find(node: ReactNode, id: string | typeof NoteMenu): ReactElement<Recor
return node.type === id || node.props['data-testid'] === id || node.props.testId === id ? node : find(node.props.children as ReactNode, id)
}
beforeEach(() => {
- vi.clearAllMocks()
+ vi.clearAllMocks();meetingListeners.clear();meetingChanged=()=>meetingListeners.forEach(cb=>cb())
meeting = { id: 'resume-fixture', title: 'Resume fixture', startedAt: 1, endedAt: 2, eventId: 'event', app: null, attendees: [], state: 'stopped', language: null, titleSource: 'calendar' }
notes = { meetingId: meeting.id, mine: '', enhanced: null, edited: false, status: 'writing', draft: '', peopleChanged: false }
requested = () => { consumed(); requested = undefined }
@@ -55,10 +56,11 @@ beforeEach(() => {
resume.mockResolvedValue({ id: meeting.id })
stopSummary.mockResolvedValue(undefined)
vi.stubGlobal('window', { matchMedia: () => ({ matches: true }), yogurt: {
- meetings: { get: async () => meeting, onChange: (cb: typeof meetingChanged) => { meetingChanged = cb; return vi.fn() }, resume, stop: vi.fn() },
+ meetings: { get: async () => meeting, onChange: (cb: typeof meetingChanged) => { meetingListeners.add(cb); return ()=>meetingListeners.delete(cb) }, resume, stop: vi.fn() },
notes: { stop: stopSummary, setMine: async (_id: string, _text: string, revision: number) => ({ revision, status: 'saved' }), get: async () => notes, onChange: (cb: typeof notesChanged) => { notesChanged = cb; return vi.fn() } },
transcript: { get: transcriptGet, onSegment: (cb: typeof segmentChanged) => { segmentChanged = cb; return vi.fn() }, onSpeakers: (cb: typeof transcriptChanged) => { transcriptChanged = cb; return vi.fn() } },
setup: { state: async () => ({ phase: 'ready', fraction: 1 }), onState: (cb: typeof setupChanged) => { setupChanged = cb; return vi.fn() } },
+ audio: { tracks: async()=>[], onDeleted:()=>vi.fn() },
widget: { state: async () => null, onState: () => vi.fn() },
} })
})
diff --git a/app/test/savedTranscription.test.ts b/app/test/savedTranscription.test.ts
new file mode 100644
index 00000000..fe7ca7dd
--- /dev/null
+++ b/app/test/savedTranscription.test.ts
@@ -0,0 +1,77 @@
+import {afterEach,beforeEach,expect,it,vi} from 'vitest'
+import {openStore,type Store} from '../src/main/store'
+import {createSavedTranscriptions} from '../src/main/savedTranscription'
+import {feedRecording} from '../src/main/asr/backfill'
+let store:Store,model=true,recording=false
+const transcribe=vi.fn(),summarize=vi.fn(),changed=vi.fn()
+let jobs:ReturnType<typeof createSavedTranscriptions>
+const line=(id:string,start=0,end=100,text='A sample line')=>({meetingId:id,track:'them' as const,startMs:start,endMs:end,text,speaker:null})
+const note=()=>store.createMeeting({title:'Planning',startedAt:100,endedAt:200,state:'stopped',attendees:[],eventId:null,app:null})
+const make=()=>createSavedTranscriptions({store,ready:()=>model,recording:()=>recording,tracks:async()=>({them:(async function*(){yield new Float32Array(1600)})()}),transcribe,summarize,changed})
+beforeEach(()=>{store=openStore(':memory:');model=true;recording=false;vi.resetAllMocks();transcribe.mockResolvedValue(true);jobs=make()})
+afterEach(async()=>{jobs.shutdown();await vi.waitFor(()=>expect(store.meetings({limit:20}).some(m=>jobs.owns(m.id))).toBe(false));store.close()})
+it('stops without deleting lines, continues at their saved boundary, and summarizes only on completion',async()=>{
+ const id=note().id
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{store.addSegments([line(id)]);return new Promise(resolve=>options.signal.addEventListener('abort',()=>resolve(false),{once:true}))})
+ await jobs.start(id);await vi.waitFor(()=>expect(store.segments(id)).toHaveLength(1));jobs.stop(id)
+ await vi.waitFor(()=>expect(jobs.owns(id)).toBe(false))
+ expect(store.meeting(id)).toMatchObject({transcriptionState:'stopped',transcriptionPending:true});expect(summarize).not.toHaveBeenCalled()
+ await jobs.pump();expect(transcribe).toHaveBeenCalledTimes(1)
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{expect(options.fromMs).toEqual({them:100});store.addSegments([line(id,100,200,'Next line')]);return true})
+ await jobs.start(id);await vi.waitFor(()=>expect(store.meeting(id)?.transcriptionState).toBe('done'))
+ expect(store.segments(id).map(s=>s.text)).toEqual(['A sample line','Next line']);expect(summarize).toHaveBeenCalledExactlyOnceWith(id)
+})
+it('stages a replacement durably and keeps the old transcript and summary through quit and restart',async()=>{
+ const id=note().id;store.addSegments([line(id,0,300,'Original words')]);store.db.prepare('INSERT INTO notes (meeting_id,mine,enhanced) VALUES (?,?,?)').run(id,'','Edited summary')
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{options.save([line(id,0,100,'Replacement start')]);return new Promise(resolve=>options.signal.addEventListener('abort',()=>resolve(false),{once:true}))})
+ await jobs.start(id,true);await vi.waitFor(()=>expect(store.transcriptionDraft(id)).toHaveLength(1));jobs.shutdown();await vi.waitFor(()=>expect(jobs.owns(id)).toBe(false))
+ expect(store.segments(id)[0].text).toBe('Original words');expect(store.notes(id).enhanced).toBe('Edited summary')
+ jobs=make();expect(transcribe).toHaveBeenCalledTimes(1)
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{expect(options.fromMs).toEqual({them:100});options.save([line(id,100,200,'Replacement end')]);return true})
+ await jobs.start(id);await vi.waitFor(()=>expect(store.meeting(id)?.transcriptionState).toBe('done'))
+ expect(store.segments(id).map(s=>s.text)).toEqual(['Replacement start','Replacement end']);expect(store.transcriptionDraft(id)).toEqual([])
+ expect(store.notes(id).enhanced).toBe('Edited summary');expect(summarize).not.toHaveBeenCalled()
+})
+it('waits for the model, yields to a recording and resumes without clearing partial lines',async()=>{
+ const id=note().id;model=false;await jobs.start(id);expect(store.meeting(id)?.transcriptionState).toBe('waiting-model');expect(transcribe).not.toHaveBeenCalled()
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{store.addSegments([line(id)]);return new Promise(resolve=>options.signal.addEventListener('abort',()=>resolve(false),{once:true}))})
+ model=true;jobs.resume();await vi.waitFor(()=>expect(store.segments(id)).toHaveLength(1));recording=true;jobs.pause();await vi.waitFor(()=>expect(jobs.owns(id)).toBe(false))
+ expect(store.meeting(id)?.transcriptionPending).toBe(true);expect(store.segments(id)).toHaveLength(1)
+ recording=false;jobs.resume();await vi.waitFor(()=>expect(store.meeting(id)?.transcriptionState).toBe('done'));expect(transcribe.mock.calls.at(-1)?.[2].fromMs).toEqual({them:100})
+})
+it('leaves failures retryable and never writes a summary from a failed partial result',async()=>{
+ const id=note().id;transcribe.mockResolvedValueOnce(false);await jobs.start(id);await vi.waitFor(()=>expect(store.meeting(id)?.transcriptionState).toBe('error'))
+ expect(summarize).not.toHaveBeenCalled();await jobs.pump();expect(transcribe).toHaveBeenCalledTimes(1)
+ await jobs.start(id);await vi.waitFor(()=>expect(store.meeting(id)?.transcriptionState).toBe('done'))
+})
+it('uses the same queue for an existing empty recording and an upload and runs one at a time',async()=>{
+ const first=note().id,second=note().id;store.db.prepare('UPDATE meetings SET source=? WHERE id=?').run('audio-file',second)
+ let release:()=>void=()=>{}
+ transcribe.mockImplementationOnce(()=>new Promise<boolean>(resolve=>{release=()=>resolve(true)}))
+ await jobs.start(first);await vi.waitFor(()=>expect(transcribe).toHaveBeenCalledOnce());await jobs.start(second);expect(transcribe).toHaveBeenCalledOnce()
+ release();await vi.waitFor(()=>expect(store.meeting(second)?.transcriptionState).toBe('done'));expect(transcribe).toHaveBeenCalledTimes(2)
+})
+it('skips already persisted audio with absolute timestamps, including a partial input piece',async()=>{
+ const push=vi.fn();const samples=new Float32Array(3200).map((_,i)=>i)
+ expect(await feedRecording({tracks:{them:(async function*(){yield samples})()},fromMs:{them:150},push,backlogMs:()=>0})).toBe(200)
+ expect(push).toHaveBeenCalledOnce();expect(push.mock.calls[0][1]).toBe(150);expect(push.mock.calls[0][2]).toHaveLength(800);expect(push.mock.calls[0][2][0]).toBe(2400)
+})
+
+it('cancelling a complete replacement restores the original without a stopped or pending state',async()=>{
+ const id=note().id;store.addSegments([line(id,0,300,'Original')]);store.setNotes(id,{enhanced:'Saved summary'})
+ transcribe.mockImplementationOnce(async(_id,_tracks,options)=>{options.save([line(id,0,100,'Draft')]);return new Promise(resolve=>options.signal.addEventListener('abort',()=>resolve(false),{once:true}))})
+ await jobs.start(id,true);await vi.waitFor(()=>expect(store.transcriptionDraft(id)).toHaveLength(1));jobs.stop(id);await vi.waitFor(()=>expect(jobs.owns(id)).toBe(false))
+ expect(store.meeting(id)).toMatchObject({transcriptionState:'done'});expect(store.meeting(id)?.transcriptionPending).not.toBe(true);expect(store.meeting(id)?.transcriptionAgain).not.toBe(true)
+ expect(store.transcriptionDraft(id)).toEqual([]);expect(store.segments(id).map(l=>l.text)).toEqual(['Original']);expect(store.notes(id).enhanced).toBe('Saved summary')
+ await jobs.pump();expect(transcribe).toHaveBeenCalledOnce();expect(summarize).not.toHaveBeenCalled()
+})
+it('cancelling a queued replacement also restores whether the original was partial',async()=>{
+ const id=note().id;store.addSegments([line(id)]);store.updateMeeting(id,{transcriptionPending:true});model=false
+ await jobs.start(id,true);jobs.stop(id)
+ expect(store.meeting(id)).toMatchObject({transcriptionState:'stopped',transcriptionPending:true});expect(store.meeting(id)?.transcriptionAgain).not.toBe(true)
+})
+
+it('retains a complete original when a replacement finishes without usable words',async()=>{
+ const id=note().id;store.addSegments([line(id,0,300,'Original')]);await jobs.start(id,true)
+ await vi.waitFor(()=>expect(jobs.owns(id)).toBe(false));expect(store.segments(id).map(l=>l.text)).toEqual(['Original']);expect(store.meeting(id)?.transcriptionAgain).not.toBe(true);expect(summarize).not.toHaveBeenCalled()
+})
diff --git a/app/test/startRecordingActions.test.ts b/app/test/startRecordingActions.test.ts
index 8184112d..f96f3e21 100644
--- a/app/test/startRecordingActions.test.ts
+++ b/app/test/startRecordingActions.test.ts
@@ -69,11 +69,12 @@ beforeEach(async () => {
})
afterEach(() => { cleanups.reverse().forEach(cleanup => cleanup()); vi.useRealTimers(); vi.unstubAllGlobals() })
-it('keeps the plain, unattached action and no arrow outside the live/15-minute window', async () => {
+it('keeps upload and the unattached action available outside the live/15-minute window', async () => {
for (const events of [[], [event('past', now - 60_000, now)], [event('later', now + 15 * 60_000 + 1)]]) {
const tree = await calendar(events)
expect(label(tree)).toContain('Start recording')
- expect(find(tree, 'recording-choices')).toBeUndefined()
+ expect(find(tree, 'recording-choices').type).toBe(Menu.Trigger)
+ expect(find(tree, 'recording-upload')).toBeDefined()
await click(find(tree, 'start-recording'))
expect(start).toHaveBeenLastCalledWith(null)
}
@@ -91,7 +92,7 @@ it('attaches the one live meeting and preserves its full title while CSS truncat
expect(css).toMatch(/\.recording-label \{[^}]*max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap/)
expect(css).toMatch(/\.recording-split \{[^}]*max-width:min\(100%,276px\)/)
})
-it('uses the menu trigger for two live meetings, with live choices first and an unattached final action', async () => {
+it('uses the menu trigger for two live meetings, with live choices first, New recording, and Upload', async () => {
const tree = await calendar([event('soon', now + 8 * 60_000), event('second', now - 30_000), event('first')])
expect(label(tree)).toContain('Take notes · 2 now')
// The same Base UI trigger used by the arrow owns click, Enter, arrows and Escape.
@@ -101,7 +102,7 @@ it('uses the menu trigger for two live meetings, with live choices first and an
expect(render()!.props.open).toBe(true)
expect(start).not.toHaveBeenCalled()
const items = elements(tree).filter(el => el.type === Menu.Item)
- expect(items.map(item => item.props.label)).toEqual(['Planning first', 'Planning second', 'Planning soon', undefined])
+ expect(items.map(item => item.props.label)).toEqual(['Planning first', 'Planning second', 'Planning soon', undefined, undefined])
expect(renderToStaticMarkup(items[0].props.children as ReactNode)).toContain('Now')
const soon = renderToStaticMarkup(items[2].props.children as ReactNode)
expect(soon).toContain('in 8 min'); expect(soon).toContain('Robin Vale')
@@ -158,7 +159,7 @@ it('refreshes the resume label when the linked note changes or is trashed', asyn
it('changes at the 15-minute, start and end boundaries and never offers a past event', async () => {
const upcoming = event('boundary', now + 16 * 60_000, now + 17 * 60_000)
await calendar([upcoming])
- for (const [minutes, expected, arrow] of [[0, 'Start recording', false], [1, 'Start recording', true], [16, 'Take notes · Planning boundary', true], [17, 'Start recording', false]] as const) {
+ for (const [minutes, expected, arrow] of [[0, 'Start recording', true], [1, 'Start recording', true], [16, 'Take notes · Planning boundary', true], [17, 'Start recording', true]] as const) {
vi.setSystemTime(now + minutes * 60_000 - 1)
render(); run(hooks.effects[1]); await vi.advanceTimersByTimeAsync(1)
const tree = render()
@@ -180,11 +181,11 @@ it('clears revoked calendars immediately and ignores an older in-flight response
let reply!: (value: unknown) => void
day.mockImplementationOnce(() => new Promise(resolve => { reply = resolve }))
calendarChanged()
- expect(find(render(), 'recording-choices')).toBeUndefined()
+ expect(find(render(), 'recording-meeting')).toBeUndefined()
day.mockResolvedValue({ status: 'denied', events: [event('private')] })
calendarChanged(); await flush()
reply({ status: 'granted', events: [event('stale')] }); await flush()
- expect(find(render(), 'recording-choices')).toBeUndefined()
+ expect(find(render(), 'recording-meeting')).toBeUndefined()
})
it('refreshes on focus and polls today without reading the agenda-selected date', async () => {
await calendar([])
@@ -202,7 +203,7 @@ it('reports a removed event, refreshes choices, and never reports a failed or ra
await click(find(tree, 'start-recording'))
expect(toasts.add).toHaveBeenLastCalledWith(expect.objectContaining({ title: 'That meeting is no longer on your calendar.' }))
expect(gone).toHaveBeenCalledOnce()
- expect(find(render(), 'recording-choices')).toBeUndefined()
+ expect(find(render(), 'recording-meeting')).toBeUndefined()
expect(started).not.toHaveBeenCalled()
start.mockResolvedValueOnce({ id: 'existing', alreadyRecording: true })
await click(find(render(), 'start-recording'))
@@ -213,3 +214,23 @@ it('reports a removed event, refreshes choices, and never reports a failed or ra
expect(find(render(), 'start-recording').props.disabled).toBe(false)
expect(gone).toHaveBeenCalledOnce()
})
+
+it('opens an uploaded calendar-linked note without offering to append a recording', async () => {
+ const tree = await calendar([{ ...event('imported'), note: { id: 'imported', state: 'done', source: 'audio-file' } }])
+ expect(label(tree)).toContain('Open Planning imported')
+ expect(label(tree)).not.toContain('Resume')
+})
+
+it('opens the upload flow with the current destination callback without starting a recording', async () => {
+ const dispatchEvent = vi.fn()
+ const file = { token: 'sample', name: 'Planning.mp3', title: 'Planning', modifiedAt: now, size: 1000 }
+ const pick = vi.fn(async () => file)
+ Object.assign(window.yogurt, { audioUpload: { pick } })
+ Object.assign(document, { dispatchEvent })
+ const tree = await calendar([])
+ await click(find(tree, 'recording-upload'))
+ expect(start).not.toHaveBeenCalled()
+ expect(pick).toHaveBeenCalledOnce()
+ expect(dispatchEvent).toHaveBeenCalledOnce()
+ expect(dispatchEvent.mock.calls[0][0]).toMatchObject({ type: 'audio-upload-open', detail: { file, onCreated: started } })
+})
diff --git a/app/test/transcriptReplacement.test.ts b/app/test/transcriptReplacement.test.ts
new file mode 100644
index 00000000..314facc5
--- /dev/null
+++ b/app/test/transcriptReplacement.test.ts
@@ -0,0 +1,29 @@
+import {LOCALES} from '../src/shared/i18n'
+import {expect,it} from 'vitest'
+import {transcriptReplacement,previousSpeaker} from '../src/shared/transcriptReplacement'
+import {uploadClock,uploadDayAllowed} from '../src/shared/audioUpload'
+const line=(startMs:number,endMs:number,text:string,speaker:string|null='Alex')=>({meetingId:'sample',track:'them' as const,startMs,endMs,text,speaker})
+it('dims the original, then writes the staged prefix over only the reached time range',()=>{
+ const old=[line(0,100,'Old beginning'),line(100,200,'Old ending')],draft=[line(0,110,'New beginning')]
+ expect(transcriptReplacement(old,[]).every(l=>l.previous)).toBe(true)
+ expect(transcriptReplacement(old,draft).map(l=>l.text)).toEqual(['New beginning'])
+ expect(transcriptReplacement(old,[line(0,80,'New beginning')]).map(l=>[l.text,!!l.previous])).toEqual([['New beginning',false],['Old ending',true]])
+ expect(old[0].text).toBe('Old beginning')
+})
+it('keeps a previous speaker only across agreeing overlaps on that track',()=>{
+ const old=[line(0,100,'One'),line(100,200,'Two','Jamie')]
+ expect(previousSpeaker(old,'them',10,90)).toBe('Alex');expect(previousSpeaker(old,'them',50,150)).toBeNull();expect(previousSpeaker(old,'me',0,100)).toBeNull()
+})
+it('accepts a single localized clock field and rejects invalid clocks or future dates',()=>{
+ const at=+new Date(2026,10,17,10,30)
+ expect(new Date(uploadClock('2:45 PM',at,'en')!).getHours()).toBe(14)
+ expect(new Date(uploadClock('14:45',at,'de')!).getMinutes()).toBe(45)
+ expect(new Date(uploadClock('٢:٤٥ م',at,'ar')!).getHours()).toBe(14)
+ expect(uploadClock('25:99',at,'en')).toBeUndefined();expect(uploadClock('13:00 PM',at,'en')).toBeUndefined()
+ expect(uploadDayAllowed(+new Date(10000,0,1),at)).toBe(false);expect(uploadDayAllowed(at,at)).toBe(true);expect(uploadDayAllowed(+new Date(2026,10,18),at)).toBe(false)
+})
+
+it('round trips the displayed clock in every app locale',()=>{
+ const at=+new Date(2026,10,17,14,45)
+ for(const {id} of LOCALES){const value=new Intl.DateTimeFormat(id,{hour:'numeric',minute:'2-digit'}).format(at);expect(uploadClock(value,at,id),id+' '+value).toBe(at)}
+})
diff --git a/app/test/transcription.test.ts b/app/test/transcription.test.ts
index b4018fc5..0da881db 100644
--- a/app/test/transcription.test.ts
+++ b/app/test/transcription.test.ts
@@ -1,3 +1,4 @@
+import { AUDIO_SPEAKER } from '../src/shared/audioUpload'
import { EventEmitter } from 'node:events'
import { PassThrough } from 'node:stream'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -36,7 +37,7 @@ function fakeProc() {
let store: Store
beforeEach(() => { store = openStore(':memory:') })
-const meeting = (): Meeting => store.createMeeting({ title: 't', startedAt: 1, endedAt: null, eventId: null, app: null, attendees: [], state: 'recording' })
+const meeting = (source?: string): Meeting => store.createMeeting({ source, title: 't', startedAt: 1, endedAt: null, eventId: null, app: null, attendees: [], state: 'recording' })
const says = (c: Chunk): Line[] => [{ track: c.track, startMs: c.startMs, endMs: c.startMs + 1000, text: `${c.track} said it at ${c.startMs}` }]
const disposers: Array<() => void> = []
@@ -385,6 +386,53 @@ describe('a meeting recorded before the speech model was in (#30)', () => {
expect(store.meeting(m.id)?.transcriptionPending).not.toBe(true)
expect(store.untranscribedMeetings()).toEqual([])
})
+ it('continues saved audio at the persisted timestamp without duplicating its first line', async () => {
+ rig('transcription-first')
+ const m=meeting('audio-file')
+ store.addSegments([{meetingId:m.id,track:'them',startMs:1000,endMs:2000,text:'Kept first line',speaker:AUDIO_SPEAKER}])
+ expect(await transcribeRecorded(m.id,{them:track(1,4)},undefined,{fromMs:{them:2000}})).toBe(true)
+ const lines=store.segments(m.id)
+ expect(lines[0].text).toBe('Kept first line');expect(lines).toHaveLength(2)
+ expect(lines[1].startMs).toBeGreaterThanOrEqual(4000)
+ })
+ it('stages replacement words through the actual pipeline without publishing or removing old words', async () => {
+ const r=rig('transcription-first'),m=meeting('audio-file')
+ store.addSegments([{meetingId:m.id,track:'them',startMs:0,endMs:100,text:'Original transcript',speaker:AUDIO_SPEAKER}])
+ expect(await transcribeRecorded(m.id,{them:track(1,4)},undefined,{save:lines=>store.addTranscriptionDraft(m.id,lines)})).toBe(true)
+ expect(store.segments(m.id).map(line=>line.text)).toEqual(['Original transcript'])
+ expect(r.sent).toEqual([]);expect(store.transcriptionDraft(m.id)).toHaveLength(2)
+ expect(store.meeting(m.id)?.transcriptionPending).toBe(true)
+ store.commitTranscriptionDraft(m.id)
+ expect(store.segments(m.id)).toHaveLength(2);expect(store.segments(m.id).some(line=>line.text==='Original transcript')).toBe(false)
+ })
+ it.each([undefined, 'audio-file'])('reports saved transcription progress for source %s without requiring an upload job', async source => {
+ rig('transcription-first')
+ const m = meeting(source), progress = vi.fn()
+ store.updateMeeting(m.id, { state: 'stopped', transcriptionPending: true })
+ expect(await transcribeRecorded(m.id, { them: track(1, 4) }, undefined, { progress })).toBe(true)
+ expect(store.segments(m.id).length).toBeGreaterThan(0)
+ expect(store.segments(m.id).map(line => line.speaker)).toEqual(source ? [AUDIO_SPEAKER, AUDIO_SPEAKER] : [null, null])
+ expect(progress).toHaveBeenCalled()
+ expect(store.meeting(m.id)?.transcriptionPending).not.toBe(true)
+ })
+ it('retains an interrupted uploaded transcript for restart recovery, but never calls it complete', async () => {
+ const abort = new AbortController(), progress = vi.fn()
+ rig('transcription-first', { transcriber: c => { abort.abort(); return says(c) } })
+ const m = meeting('audio-file')
+ store.updateMeeting(m.id, { state: 'stopped', transcriptionPending: true })
+ expect(await transcribeRecorded(m.id, { them: track(1, 4) }, undefined, { signal: abort.signal, progress })).toBe(false)
+ expect(progress).not.toHaveBeenCalled()
+ expect(store.meeting(m.id)?.transcriptionPending).toBe(true)
+ store.addSegments([{ meetingId: m.id, track: 'them', startMs: 0, endMs: 1000, text: 'A partial line', speaker: AUDIO_SPEAKER }])
+ expect(store.untranscribedMeetings().map(m => m.id)).toContain(m.id)
+ })
+ it('does not report successful deferred transcription when the model fails', async () => {
+ rig('transcription-first', { transcriber: () => { throw new Error('speech model failed') } })
+ const m = meeting()
+ store.updateMeeting(m.id, { state: 'stopped', transcriptionPending: true })
+ expect(await transcribeRecorded(m.id, { them: track(1) })).toBe(false)
+ expect(store.meeting(m.id)?.transcriptionPending).toBe(true)
+ })
it('a meeting with some transcript is never transcribed again (no lines twice)', async () => {
const r = rig('transcription-first', { transcriber: async () => { throw new Error('whisper fell over') } })
const m = meeting()
diff --git a/app/test/uploadPresentation.test.ts b/app/test/uploadPresentation.test.ts
new file mode 100644
index 00000000..74c16054
--- /dev/null
+++ b/app/test/uploadPresentation.test.ts
@@ -0,0 +1,58 @@
+import {readFileSync} from 'node:fs'
+import {afterEach,expect,it,vi} from 'vitest'
+import {useState,type ReactElement,type ReactNode} from 'react'
+import {Transcript} from '../src/renderer/src/components/Transcript'
+import {Swap,SwapText} from '../src/renderer/src/components/Swap'
+import {TranscriptionControl} from '../src/renderer/src/components/Transcription'
+import {stepUploadClock,uploadClock} from '../src/shared/audioUpload'
+
+vi.mock('react',async original=>({...await original<typeof import('react')>(),useState:vi.fn(),useRef:(current:unknown)=>({current}),useMemo:(fn:()=>unknown)=>fn(),useCallback:(fn:unknown)=>fn,useEffect:vi.fn(),useLayoutEffect:vi.fn()}))
+vi.mock('../src/renderer/src/i18n',()=>({useLanguage(){}}))
+vi.mock('../src/renderer/src/useLoadingState',()=>({useLoadingState:()=> 'ready'}))
+afterEach(()=>vi.clearAllMocks())
+function elements(node:ReactNode):ReactElement<any>[] {
+ if(Array.isArray(node))return node.flatMap(elements)
+ if(!node||typeof node!=='object'||!('props' in node))return []
+ const el=node as ReactElement<any>
+ return [el,...elements(el.props.children)]
+}
+function transcript(processing:boolean,hasLines:boolean,replacing=false) {
+ const lines=hasLines?[{id:1,meetingId:'sample',track:'them',startMs:0,endMs:1000,text:'The draft is ready.'}]:[]
+ const states:unknown[]=[[],lines,true,{},false,false,['them']]
+ vi.mocked(useState).mockImplementation((initial?:unknown):[unknown,()=>void]=>[states.length?states.shift():typeof initial==='function'?initial():initial,()=>{}])
+ return elements(Transcript({id:'sample',recording:false,processing,replacing})).map(e=>e.props.className)
+}
+it('shows the transcription placeholder only until the first text, and hides playback while working',()=>{
+ expect(transcript(true,false)).toContain('transcription-placeholder')
+ for(const replacing of [false,true]) {
+ const working=transcript(true,true,replacing)
+ expect(working).not.toContain('transcription-placeholder')
+ expect(working).not.toContain('transcript-player-dock')
+ }
+ expect(transcript(false,true)).toContain('transcript-player-dock')
+})
+it('keeps the shared busy button box and label, without the extra inset edge',()=>{
+ const css=readFileSync(new URL('../src/renderer/src/styles.css',import.meta.url),'utf8')
+ const busy=css.match(/\.note-resume-action\[data-processing=true\] \{([^}]+)\}/)![1]
+ expect(busy).not.toMatch(/border-color:|background:/)
+ expect(busy).toContain('box-shadow:0 1px 2px #0000000A')
+ expect(busy).not.toContain('inset')
+ for(const state of ['preparing','transcribing'] as const) {
+ const control=TranscriptionControl({state,onStop:()=>{}})
+ expect(control.props.className).toContain('note-resume-action')
+ expect(control.props['data-processing']).toBe('true')
+ expect(control.props['aria-busy']).toBe('true')
+ const children=elements(control)
+ expect(children.find(e=>e.type===SwapText)?.props.text).toBe(state==='preparing'?'Preparing audio…':'Transcribing…')
+ expect(children.some(e=>e.props.className==='chat-step')).toBe(false)
+ const icon=children.find(e=>e.type===Swap)!
+ expect(elements(Swap(icon.props)).some(e=>e.props.className==='summary-stop-square')).toBe(true)
+ }
+})
+it('steps minutes and hours without changing the chosen date, including midnight',()=>{
+ const at=+new Date(2026,10,17,23,59)
+ expect(new Date(stepUploadClock(at,1))).toEqual(new Date(2026,10,17,0,0))
+ expect(new Date(stepUploadClock(at,60))).toEqual(new Date(2026,10,17,0,59))
+ expect(new Date(stepUploadClock(+new Date(2026,10,17),-1))).toEqual(new Date(2026,10,17,23,59))
+ expect(new Date(stepUploadClock(uploadClock('2:45 PM',at,'en')!,1))).toEqual(new Date(2026,10,17,14,46))
+})