Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix: address late review edge cases

altic-dev611c311a8f27
diff --git a/Sources/Fluid/Persistence/BackupService.swift b/Sources/Fluid/Persistence/BackupService.swift
index 60a85710..10823fd4 100644
--- a/Sources/Fluid/Persistence/BackupService.swift
+++ b/Sources/Fluid/Persistence/BackupService.swift
@@ -173,9 +173,12 @@ final class BackupService {
func restore(_ document: AppBackupDocument) async throws {
try self.validate(document)
- if let pronunciationProfiles = document.pronunciationProfiles {
- try await PronunciationDictionaryStore.shared.replaceAllProfiles(pronunciationProfiles)
- }
+ // A legacy backup represents the complete state from before voice
+ // profiles existed. Restoring it must therefore clear newer profiles
+ // instead of leaving them attached to restored dictionary entry IDs.
+ try await PronunciationDictionaryStore.shared.replaceAllProfiles(
+ document.pronunciationProfiles ?? []
+ )
SettingsStore.shared.restore(
from: document.settings,
promptProfiles: document.promptProfiles,
diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swift
index a10cc8e4..7b0be0ee 100644
--- a/Sources/Fluid/Services/ASRService.swift
+++ b/Sources/Fluid/Services/ASRService.swift
@@ -3927,9 +3927,17 @@ private final nonisolated class AudioCapturePipeline: @unchecked Sendable {
}
self.capturedOutputFrameCount += mono16k.count
let capturedMilliseconds = self.capturedOutputFrameCount * 1000 / 16_000
+ // Compare sample duration with the hardware acquisition timeline. The
+ // consumer queue can be delayed under CPU pressure, but late delivery
+ // does not mean the captured audio clock is malformed.
+ let acceptedPacketEndHostTime = Self.hostTime(
+ inputHostTime,
+ advancedByFrames: acceptedRange.upperBound,
+ sampleRate: sampleRate
+ )
let elapsedMilliseconds = Self.elapsedMilliseconds(
from: startHostTime,
- to: mach_absolute_time()
+ to: acceptedPacketEndHostTime
)
let shouldReportDurationMismatch = self.durationMismatchReported == false &&
ASRService.directCaptureDurationIsMismatched(