Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix: Record meetings in the one Dictation language on macOS 14 and 15 instead of asking which language it is

wquguru84ab3a167819
diff --git a/Sources/LiveSubs/ListenEngine.swift b/Sources/LiveSubs/ListenEngine.swift
index 5ad2f14..83abe03 100644
--- a/Sources/LiveSubs/ListenEngine.swift
+++ b/Sources/LiveSubs/ListenEngine.swift
@@ -84,7 +84,11 @@ final class ListenEngine {
private var unconfirmed: [(seg: Segment, at: Date, duration: Double)] = []
private var recordable: Bool {
settings.sourceMode != .auto || languageConfirmed || (ambiguousDetections >= 2 && !mismatch)
+ || legacySingleLanguage
}
+ /// macOS 14/15 with one Dictation language: nothing to compare it with and none Cicada could
+ /// fetch, and every check takes the recognizer from the meeting. It is taken as heard.
+ private var legacySingleLanguage: Bool { Recognition.legacy && candidates.count < 2 }
/// The only model there is checked the audio and it isn't its language: what it writes is
/// noise, neither shown nor kept, until another model or a pick settles it.
private(set) var mismatch = false
@@ -683,7 +687,7 @@ final class ListenEngine {
private func maybeDetectLanguage() {
// One model can still tell whether the audio is its language, until the language is known.
- guard isRunning, settings.sourceMode == .auto, !detecting,
+ guard isRunning, settings.sourceMode == .auto, !detecting, !legacySingleLanguage,
candidates.count >= 2 || (!languageConfirmed && candidates.first == activeLang && activeLang != nil) else { return }
var stats = router.stats(window: 6)
if stats.silenceRun >= AudioRouter.gapSeconds { needsDetection = true }
@@ -867,7 +871,7 @@ final class ListenEngine {
/// keep disagreeing, a model that couldn't be fetched: one click ends each.
var asksLanguage: Bool {
guard isRunning, settings.sourceMode == .auto, !languageConfirmed, fetchingModel == nil,
- let firstHeardAt else { return false }
+ !legacySingleLanguage, let firstHeardAt else { return false }
// Once offered it stays until answered: a check running meanwhile doesn't make it blink.
if askShown { return true }
// The one model said no and no other is coming: nothing is shown or kept, so ask now.
diff --git a/Sources/LiveSubs/Recognition.swift b/Sources/LiveSubs/Recognition.swift
index 822e73b..2271381 100644
--- a/Sources/LiveSubs/Recognition.swift
+++ b/Sources/LiveSubs/Recognition.swift
@@ -320,7 +320,9 @@ final class LegacyStream: RecognitionStream, @unchecked Sendable {
private static let pause = 0.7
private static let longest = 45.0
private static let preroll = 0.3
- private static let holdLimit = 6.0
+ /// How long the meeting's audio can wait for the line before it, a language check or the
+ /// talk key (a slow Mac takes several seconds to check two languages).
+ private static let holdLimit = 12.0
private struct Line {
let request: SFSpeechAudioBufferRecognitionRequest
@@ -336,11 +338,12 @@ final class LegacyStream: RecognitionStream, @unchecked Sendable {
nonisolated(unsafe) private static var liveLines = 0
nonisolated(unsafe) private static var clips = 0
- /// Waits (up to 4 s) for no live line to be open, then holds new ones back. False: gave up.
+ /// Waits (up to 15 s) for no live line and no other clip, then holds new lines back. One clip
+ /// at a time: a language check of two candidates runs them one after the other. False: gave up.
static func enterClip() async -> Bool {
- for _ in 0..<40 {
+ for _ in 0..<150 {
let ok = lock.withLock { () -> Bool in
- guard liveLines == 0 else { return false }
+ guard liveLines == 0, clips == 0 else { return false }
clips += 1
return true
}