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

Merge transcription sound toggle into picker with None option

moogmand23aa9f5dbff
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 83745604..0525788d 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -1780,7 +1780,7 @@ struct ContentView: View {
self.menuBarManager.setOverlayMode(.dictation)
}
- if SettingsStore.shared.enableTranscriptionSounds, !self.isRecordingForCommand, !self.isRecordingForRewrite {
+ if !self.isRecordingForCommand, !self.isRecordingForRewrite {
TranscriptionSoundPlayer.shared.playStartSound()
}
@@ -2030,9 +2030,7 @@ struct ContentView: View {
"Starting voice recording for command",
source: "ContentView"
)
- if SettingsStore.shared.enableTranscriptionSounds {
- TranscriptionSoundPlayer.shared.playStartSound()
- }
+ TranscriptionSoundPlayer.shared.playStartSound()
Task {
await self.asr.start()
}
@@ -2063,9 +2061,7 @@ struct ContentView: View {
// Start recording immediately for the rewrite instruction (or text to improve)
DebugLogger.shared.info("Starting voice recording for rewrite/write mode", source: "ContentView")
- if SettingsStore.shared.enableTranscriptionSounds {
- TranscriptionSoundPlayer.shared.playStartSound()
- }
+ TranscriptionSoundPlayer.shared.playStartSound()
Task {
await self.asr.start()
}
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index d23b57da..db42a09f 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -17,6 +17,7 @@ final class SettingsStore: ObservableObject {
private let keychain = KeychainService.shared
private init() {
+ self.migrateTranscriptionStartSoundIfNeeded()
self.migrateProviderAPIKeysIfNeeded()
self.scrubSavedProviderAPIKeys()
self.migrateDictationPromptProfilesIfNeeded()
@@ -738,6 +739,7 @@ final class SettingsStore: ObservableObject {
}
enum TranscriptionStartSound: String, CaseIterable, Identifiable {
+ case none = "none"
case fluidSfx1 = "fluid_sfx_1"
case fluidSfx2 = "fluid_sfx_2"
case fluidSfx3 = "fluid_sfx_3"
@@ -747,6 +749,7 @@ final class SettingsStore: ObservableObject {
var displayName: String {
switch self {
+ case .none: return "None"
case .fluidSfx1: return "Fluid SFX 1"
case .fluidSfx2: return "Fluid SFX 2"
case .fluidSfx3: return "Fluid SFX 3"
@@ -754,8 +757,9 @@ final class SettingsStore: ObservableObject {
}
}
- var soundFileName: String {
+ var soundFileName: String? {
switch self {
+ case .none: return nil
case .fluidSfx1: return "FV_start"
case .fluidSfx2: return "FV_start_2"
case .fluidSfx3: return "sfx_3"
@@ -796,6 +800,7 @@ final class SettingsStore: ObservableObject {
var transcriptionStartSound: TranscriptionStartSound {
get {
+ self.migrateTranscriptionStartSoundIfNeeded()
guard let raw = self.defaults.string(forKey: Keys.transcriptionStartSound),
let option = TranscriptionStartSound(rawValue: raw)
else {
@@ -1244,6 +1249,14 @@ final class SettingsStore: ObservableObject {
}
}
+ private func migrateTranscriptionStartSoundIfNeeded() {
+ guard let legacyEnabled = self.defaults.object(forKey: Keys.enableTranscriptionSounds) as? Bool else { return }
+ if legacyEnabled == false {
+ self.defaults.set(TranscriptionStartSound.none.rawValue, forKey: Keys.transcriptionStartSound)
+ }
+ self.defaults.removeObject(forKey: Keys.enableTranscriptionSounds)
+ }
+
private func migrateProviderAPIKeysIfNeeded() {
self.defaults.removeObject(forKey: Keys.providerAPIKeyIdentifiers)
diff --git a/Sources/Fluid/Services/TranscriptionSoundPlayer.swift b/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
index af8da231..c1eefc58 100644
--- a/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
+++ b/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
@@ -11,7 +11,8 @@ final class TranscriptionSoundPlayer {
func playStartSound() {
let selected = SettingsStore.shared.transcriptionStartSound
- self.play(soundName: selected.soundFileName)
+ guard let soundName = selected.soundFileName else { return }
+ self.play(soundName: soundName)
}
private func play(soundName: String) {
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index 76859fd2..11a6dfb4 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -180,38 +180,27 @@ struct SettingsView: View {
}
Divider().opacity(0.2)
- self.settingsToggleRow(
- title: "Transcription Sounds",
- description: "Play a short sound when dictation or command recording starts.",
- isOn: Binding(
- get: { SettingsStore.shared.enableTranscriptionSounds },
- set: { SettingsStore.shared.enableTranscriptionSounds = $0 }
- )
- )
-
- if SettingsStore.shared.enableTranscriptionSounds {
- HStack {
- VStack(alignment: .leading, spacing: 2) {
- Text("Start Sound")
- .font(.body)
- Text("Choose which sound plays when recording starts.")
- .font(.subheadline)
- .foregroundStyle(.secondary)
- }
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Transcription Sounds")
+ .font(.body)
+ Text("Choose which sound plays when recording starts. Select None to disable.")
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
- Spacer()
+ Spacer()
- Picker("", selection: Binding(
- get: { SettingsStore.shared.transcriptionStartSound },
- set: { SettingsStore.shared.transcriptionStartSound = $0 }
- )) {
- ForEach(SettingsStore.TranscriptionStartSound.allCases) { option in
- Text(option.displayName).tag(option)
- }
+ Picker("", selection: Binding(
+ get: { SettingsStore.shared.transcriptionStartSound },
+ set: { SettingsStore.shared.transcriptionStartSound = $0 }
+ )) {
+ ForEach(SettingsStore.TranscriptionStartSound.allCases) { option in
+ Text(option.displayName).tag(option)
}
- .pickerStyle(.menu)
- .frame(width: 170, alignment: .trailing)
}
+ .pickerStyle(.menu)
+ .frame(width: 170, alignment: .trailing)
}
Divider().opacity(0.2)
diff --git a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
index 68201136..c9e93417 100644
--- a/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
+++ b/Tests/FluidDictationIntegrationTests/DictationE2ETests.swift
@@ -4,6 +4,42 @@ import XCTest
@testable import FluidVoice_Debug
final class DictationE2ETests: XCTestCase {
+ private let enableTranscriptionSoundsKey = "EnableTranscriptionSounds"
+ private let transcriptionStartSoundKey = "TranscriptionStartSound"
+
+ func testTranscriptionStartSound_noneOptionHasNoFile() {
+ XCTAssertEqual(SettingsStore.TranscriptionStartSound.none.displayName, "None")
+ XCTAssertNil(SettingsStore.TranscriptionStartSound.none.soundFileName)
+ }
+
+ func testTranscriptionStartSound_legacyDisabledToggleMigratesToNone() {
+ self.withRestoredDefaults(keys: [self.enableTranscriptionSoundsKey, self.transcriptionStartSoundKey]) {
+ let defaults = UserDefaults.standard
+ defaults.set(false, forKey: self.enableTranscriptionSoundsKey)
+ defaults.set(SettingsStore.TranscriptionStartSound.fluidSfx1.rawValue, forKey: self.transcriptionStartSoundKey)
+
+ let value = SettingsStore.shared.transcriptionStartSound
+
+ XCTAssertEqual(value, .none)
+ XCTAssertNil(defaults.object(forKey: self.enableTranscriptionSoundsKey))
+ XCTAssertEqual(defaults.string(forKey: self.transcriptionStartSoundKey), SettingsStore.TranscriptionStartSound.none.rawValue)
+ }
+ }
+
+ func testTranscriptionStartSound_legacyEnabledToggleKeepsSelectedSound() {
+ self.withRestoredDefaults(keys: [self.enableTranscriptionSoundsKey, self.transcriptionStartSoundKey]) {
+ let defaults = UserDefaults.standard
+ defaults.set(true, forKey: self.enableTranscriptionSoundsKey)
+ defaults.set(SettingsStore.TranscriptionStartSound.fluidSfx2.rawValue, forKey: self.transcriptionStartSoundKey)
+
+ let value = SettingsStore.shared.transcriptionStartSound
+
+ XCTAssertEqual(value, .fluidSfx2)
+ XCTAssertNil(defaults.object(forKey: self.enableTranscriptionSoundsKey))
+ XCTAssertEqual(defaults.string(forKey: self.transcriptionStartSoundKey), SettingsStore.TranscriptionStartSound.fluidSfx2.rawValue)
+ }
+ }
+
func testDictationEndToEnd_whisperTiny_transcribesFixture() async throws {
// Arrange
SettingsStore.shared.shareAnonymousAnalytics = false
@@ -63,4 +99,26 @@ final class DictationE2ETests: XCTestCase {
return collapsed
}
+
+ private func withRestoredDefaults(keys: [String], run: () -> Void) {
+ let defaults = UserDefaults.standard
+ var snapshot: [String: Any] = [:]
+ for key in keys {
+ if let value = defaults.object(forKey: key) {
+ snapshot[key] = value
+ }
+ }
+
+ defer {
+ for key in keys {
+ if let previous = snapshot[key] {
+ defaults.set(previous, forKey: key)
+ } else {
+ defaults.removeObject(forKey: key)
+ }
+ }
+ }
+
+ run()
+ }
}