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 transcription sound volume control and fix overlay menus in light mode

Bezhanae12f768760c
diff --git a/.gitignore b/.gitignore
index 2cb9b48a..f6464d13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -216,3 +216,4 @@ scripts/
icon_work/
sample/
.codex
+builds/
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 60294295..cdba03b4 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -1056,6 +1056,29 @@ final class SettingsStore: ObservableObject {
}
}
+ var transcriptionSoundVolume: Float {
+ get {
+ let value = self.defaults.object(forKey: Keys.transcriptionSoundVolume)
+ return (value as? Float) ?? 1.0
+ }
+ set {
+ objectWillChange.send()
+ let clamped = max(0.0, min(1.0, newValue))
+ self.defaults.set(clamped, forKey: Keys.transcriptionSoundVolume)
+ }
+ }
+
+ var transcriptionSoundIndependentVolume: Bool {
+ get {
+ let value = self.defaults.object(forKey: Keys.transcriptionSoundIndependentVolume)
+ return value as? Bool ?? false
+ }
+ set {
+ objectWillChange.send()
+ self.defaults.set(newValue, forKey: Keys.transcriptionSoundIndependentVolume)
+ }
+ }
+
var transcriptionStartSound: TranscriptionStartSound {
get {
self.migrateTranscriptionStartSoundIfNeeded()
@@ -2527,6 +2550,8 @@ private extension SettingsStore {
static let accentColorOption = "AccentColorOption"
static let enableTranscriptionSounds = "EnableTranscriptionSounds"
static let transcriptionStartSound = "TranscriptionStartSound"
+ static let transcriptionSoundVolume = "TranscriptionSoundVolume"
+ static let transcriptionSoundIndependentVolume = "TranscriptionSoundIndependentVolume"
static let pressAndHoldMode = "PressAndHoldMode"
static let enableStreamingPreview = "EnableStreamingPreview"
static let enableAIStreaming = "EnableAIStreaming"
diff --git a/Sources/Fluid/Services/TranscriptionSoundPlayer.swift b/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
index c1eefc58..b0476a3f 100644
--- a/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
+++ b/Sources/Fluid/Services/TranscriptionSoundPlayer.swift
@@ -1,4 +1,5 @@
import AVFoundation
+import CoreAudio
import Foundation
@MainActor
@@ -15,12 +16,39 @@ final class TranscriptionSoundPlayer {
self.play(soundName: soundName)
}
- private func play(soundName: String) {
+ /// Preview a specific sound at the current volume setting (used in Settings UI).
+ func playPreview(sound: SettingsStore.TranscriptionStartSound) {
+ guard let soundName = sound.soundFileName else { return }
+ self.play(soundName: soundName)
+ }
+
+ /// Preview current sound at a specific volume (used when slider is released).
+ func playPreviewAtVolume(_ volume: Float) {
+ let selected = SettingsStore.shared.transcriptionStartSound
+ guard let soundName = selected.soundFileName else { return }
+ self.play(soundName: soundName, overrideVolume: volume)
+ }
+
+ private func play(soundName: String, overrideVolume: Float? = nil) {
guard let url = Bundle.main.url(forResource: soundName, withExtension: "m4a") else {
DebugLogger.shared.error("Missing sound resource: \(soundName).m4a", source: "TranscriptionSoundPlayer")
return
}
+ let settings = SettingsStore.shared
+ let desiredVolume = overrideVolume ?? settings.transcriptionSoundVolume
+
+ let playerVolume: Float
+ if settings.transcriptionSoundIndependentVolume {
+ let systemVol = Self.getSystemVolume()
+ // If muted, don't play
+ guard systemVol > 0.001 else { return }
+ // Compensate for system volume so the sound is always at the desired absolute level
+ playerVolume = min(1.0, desiredVolume / systemVol)
+ } else {
+ playerVolume = desiredVolume
+ }
+
do {
let player: AVAudioPlayer
if let existing = self.players[soundName] {
@@ -32,6 +60,7 @@ final class TranscriptionSoundPlayer {
}
player.currentTime = 0
+ player.volume = playerVolume
player.play()
} catch {
DebugLogger.shared.error(
@@ -40,4 +69,36 @@ final class TranscriptionSoundPlayer {
)
}
}
+
+ // MARK: - System Volume Reading via CoreAudio
+
+ private static func getDefaultOutputDeviceID() -> AudioObjectID? {
+ var address = AudioObjectPropertyAddress(
+ mSelector: kAudioHardwarePropertyDefaultOutputDevice,
+ mScope: kAudioObjectPropertyScopeGlobal,
+ mElement: kAudioObjectPropertyElementMain
+ )
+ var deviceID = AudioObjectID(0)
+ var size = UInt32(MemoryLayout<AudioObjectID>.size)
+ let status = AudioObjectGetPropertyData(
+ AudioObjectID(kAudioObjectSystemObject),
+ &address, 0, nil, &size, &deviceID
+ )
+ guard status == noErr, deviceID != kAudioObjectUnknown else { return nil }
+ return deviceID
+ }
+
+ static func getSystemVolume() -> Float {
+ guard let deviceID = getDefaultOutputDeviceID() else { return 1.0 }
+ var address = AudioObjectPropertyAddress(
+ mSelector: kAudioHardwareServiceDeviceProperty_VirtualMainVolume,
+ mScope: kAudioDevicePropertyScopeOutput,
+ mElement: kAudioObjectPropertyElementMain
+ )
+ var volume: Float32 = 1.0
+ var size = UInt32(MemoryLayout<Float32>.size)
+ let status = AudioObjectGetPropertyData(deviceID, &address, 0, nil, &size, &volume)
+ guard status == noErr else { return 1.0 }
+ return volume
+ }
}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index 2aed7616..2544f983 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -199,7 +199,10 @@ struct SettingsView: View {
Picker("", selection: Binding(
get: { SettingsStore.shared.transcriptionStartSound },
- set: { SettingsStore.shared.transcriptionStartSound = $0 }
+ set: { newValue in
+ SettingsStore.shared.transcriptionStartSound = newValue
+ TranscriptionSoundPlayer.shared.playPreview(sound: newValue)
+ }
)) {
ForEach(SettingsStore.TranscriptionStartSound.allCases) { option in
Text(option.displayName).tag(option)
@@ -209,6 +212,45 @@ struct SettingsView: View {
.frame(width: 170, alignment: .trailing)
}
+ if SettingsStore.shared.transcriptionStartSound != .none {
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Volume")
+ .font(.body)
+ Text("Adjust the notification sound volume.")
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
+
+ Spacer()
+
+ Slider(
+ value: Binding(
+ get: { Double(SettingsStore.shared.transcriptionSoundVolume) },
+ set: { SettingsStore.shared.transcriptionSoundVolume = Float($0) }
+ ),
+ in: 0...1,
+ step: 0.05
+ ) { editing in
+ if !editing {
+ TranscriptionSoundPlayer.shared.playPreviewAtVolume(
+ SettingsStore.shared.transcriptionSoundVolume
+ )
+ }
+ }
+ .frame(width: 150)
+ }
+
+ self.settingsToggleRow(
+ title: "Independent Volume",
+ description: "Sound volume stays constant regardless of system volume. Mute is still respected.",
+ isOn: Binding(
+ get: { SettingsStore.shared.transcriptionSoundIndependentVolume },
+ set: { SettingsStore.shared.transcriptionSoundIndependentVolume = $0 }
+ )
+ )
+ }
+
Divider().opacity(0.2)
// Automatic Updates
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swift
index 0bdd8e21..b1376c85 100644
--- a/Sources/Fluid/Views/BottomOverlayView.swift
+++ b/Sources/Fluid/Views/BottomOverlayView.swift
@@ -1188,6 +1188,7 @@ private struct BottomOverlayModeMenuView: View {
.stroke(Color.white.opacity(0.12), lineWidth: 1)
)
.frame(maxWidth: self.maxWidth)
+ .preferredColorScheme(.dark)
.onHover { hovering in
self.onHoverChanged(hovering)
}
@@ -1308,6 +1309,7 @@ private struct BottomOverlayPromptMenuView: View {
.stroke(Color.white.opacity(0.12), lineWidth: 1)
)
.frame(maxWidth: self.maxWidth)
+ .preferredColorScheme(.dark)
.onHover { hovering in
self.onHoverChanged(hovering)
}
@@ -1459,6 +1461,7 @@ private struct BottomOverlayActionsMenuView: View {
.stroke(Color.white.opacity(0.12), lineWidth: 1)
)
.frame(maxWidth: self.maxWidth)
+ .preferredColorScheme(.dark)
.onHover { hovering in
self.onHoverChanged(hovering)
}