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

Add guard to validate fileSampleRate > 0 before resampleRatio calculation (#118)

macroscopeapp[bot]b8f40a3510b9
diff --git a/Sources/Fluid/Services/MeetingTranscriptionService.swift b/Sources/Fluid/Services/MeetingTranscriptionService.swift
index 2de12414..22a93710 100644
--- a/Sources/Fluid/Services/MeetingTranscriptionService.swift
+++ b/Sources/Fluid/Services/MeetingTranscriptionService.swift
@@ -163,6 +163,9 @@ final class MeetingTranscriptionService: ObservableObject {
let fileFormat = audioFile.processingFormat
let totalFrames = AVAudioFrameCount(audioFile.length)
let fileSampleRate = fileFormat.sampleRate
+ guard fileSampleRate > 0 else {
+ throw TranscriptionError.audioConversionFailed("Invalid audio file: sample rate is 0")
+ }
let resampleRatio = sampleRate / fileSampleRate
// Calculate chunk size in source file frames