Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Add an opt-out toggle for Chrome's audio processing (echo cancellation / noise suppression / auto-gain) on the microphone capture path — these are correct defaults for human voice next to a mic but they kill sustained speech and music coming in through a PulseAudio monitor source or virtual audio device (BlackHole, VB-Cable) because Chrome's noiseSuppression algorithm classifies sustained audio as noise and gates the stream to silence about a second in; this is exactly what was happening when the user routed Monitor of WF-1000XM5 through the recording — initial activity, then silence; new state ref disableAudioProcessing (persisted to localStorage so the choice survives sessions) gates the constraint values in audio.js's microphone and both-mode capture paths, with all three processors switching off together when the flag is true; toggle exposed in the upload modal as a small labelled checkbox under the recording buttons, with a one-sentence explanation of when to use it
Murtaza Nasir82fd335990a9
diff --git a/static/js/app.modular.js b/static/js/app.modular.jsindex 799fd775..041d5a87 100644--- a/static/js/app.modular.js+++ b/static/js/app.modular.js@@ -358,6 +358,19 @@ document.addEventListener('DOMContentLoaded', async () => {const recordingNotes = ref('');const showSystemAudioHelp = ref(false);const showSystemAudioHelpModal = ref(false);+ // When true the microphone getUserMedia call is made WITHOUT+ // echoCancellation / noiseSuppression / autoGainControl —+ // appropriate when the user is routing system audio in via a+ // PulseAudio monitor source or a virtual audio device (BlackHole,+ // VB-Cable). The default-on suppression kills sustained speech+ // audio from monitor sources because the algorithm classifies it+ // as "noise". Persisted across sessions in localStorage.+ const disableAudioProcessing = ref(+ (typeof localStorage !== 'undefined' && localStorage.getItem('disableAudioProcessing') === 'true')+ );+ watch(disableAudioProcessing, (v) => {+ try { localStorage.setItem('disableAudioProcessing', v ? 'true' : 'false'); } catch (_) {}+ });// Platform + capability state for the system-audio flow.// Detected once on init; the help modal uses these to// pre-select the right OS tab and to gate which paragraphs@@ -1410,7 +1423,7 @@ document.addEventListener('DOMContentLoaded', async () => {// Audio RecordingisRecording, mediaRecorder, audioChunks, audioBlobURL, recordingTime, recordingInterval,canRecordAudio, canRecordSystemAudio, systemAudioSupported, systemAudioError,- recordingNotes, showSystemAudioHelp, showSystemAudioHelpModal,+ recordingNotes, showSystemAudioHelp, showSystemAudioHelpModal, disableAudioProcessing,platformInfo, audioCaps, helpModalOsTab, virtualAudioDevices, refreshVirtualAudioDevices,asrLanguage, asrMinSpeakers, asrMaxSpeakers,audioContext, analyser, micAnalyser, systemAnalyser, visualizer, micVisualizer,diff --git a/static/js/modules/composables/audio.js b/static/js/modules/composables/audio.jsindex 018031a1..5bfbd531 100644--- a/static/js/modules/composables/audio.js+++ b/static/js/modules/composables/audio.js@@ -13,7 +13,7 @@ export function useAudio(state, utils) {audioChunks, recordingTime, recordingInterval, recordingMode, audioBlobURL,estimatedFileSize, actualBitrate, recordingNotes, recordingQuality,maxRecordingMB, fileSizeWarningShown, sizeCheckInterval, recordingDisclaimer,- showRecordingDisclaimerModal, pendingRecordingMode, currentView, showUploadModal, showSystemAudioHelp, isDarkMode, wakeLock, animationFrameId,+ showRecordingDisclaimerModal, pendingRecordingMode, currentView, showUploadModal, showSystemAudioHelp, disableAudioProcessing, isDarkMode, wakeLock, animationFrameId,activeStreams, visualizer, micVisualizer, systemVisualizer, canRecordAudio,canRecordSystemAudio, systemAudioSupported, systemAudioError, globalError,selectedTagIds, selectedFolderId, asrLanguage, asrMinSpeakers, asrMaxSpeakers, uploadQueue,@@ -265,10 +265,21 @@ export function useAudio(state, utils) {if (!canRecordAudio.value) {throw new Error('Microphone recording is not available. Make sure you are using HTTPS.');}+ // When the user is routing system audio in via a+ // monitor source / virtual audio device, the default+ // echoCancellation + noiseSuppression + autoGainControl+ // processing trio aggressively gates the stream to+ // silence after about a second because the algorithm+ // classifies sustained speech/music audio as noise.+ // Flag-controlled via disableAudioProcessing, exposed+ // as a toggle in the upload modal next to the mic+ // button and persisted in localStorage.+ const skipProc = disableAudioProcessing && disableAudioProcessing.value;stream = await navigator.mediaDevices.getUserMedia({audio: {- echoCancellation: true,- noiseSuppression: true,+ echoCancellation: !skipProc,+ noiseSuppression: !skipProc,+ autoGainControl: !skipProc,sampleRate: 48000}});@@ -342,10 +353,14 @@ export function useAudio(state, utils) {if (!canRecordAudio.value || !canRecordSystemAudio.value) {throw new Error('Recording is not available. Make sure you are using HTTPS.');}+ // Honour the disableAudioProcessing flag here too —+ // see comment at the microphone-only path above.+ const skipProcBoth = disableAudioProcessing && disableAudioProcessing.value;const micStream = await navigator.mediaDevices.getUserMedia({audio: {- echoCancellation: true,- noiseSuppression: true,+ echoCancellation: !skipProcBoth,+ noiseSuppression: !skipProcBoth,+ autoGainControl: !skipProcBoth,sampleRate: 48000}});diff --git a/templates/components/upload-view.html b/templates/components/upload-view.htmlindex 0ed95f63..a18a1bb3 100644--- a/templates/components/upload-view.html+++ b/templates/components/upload-view.html@@ -268,6 +268,22 @@</span></div>+ <!-- Audio-processing opt-out. Chrome's getUserMedia+ applies echoCancellation + noiseSuppression ++ autoGainControl by default, which is correct for+ voice but kills sustained speech / music coming+ in through a monitor source or virtual audio+ device (the suppressor classifies it as noise+ after about a second). Persisted to localStorage. -->+ <label class="flex items-start gap-2 mt-2 px-2 py-1.5 rounded-md cursor-pointer hover:bg-[var(--bg-tertiary)] transition-colors">+ <input type="checkbox" v-model="disableAudioProcessing"+ class="mt-0.5 h-3.5 w-3.5 rounded border-[var(--border-secondary)]">+ <span class="text-[11px] flex-1" style="color: var(--text-secondary);">+ <strong>Disable echo cancellation, noise suppression & auto-gain</strong>+ — enable when you're routing system audio in through a monitor source or virtual audio device (BlackHole, VB-Cable, Pulse monitor). Leave off for normal microphone recording.+ </span>+ </label>+<!-- Help Text - Compact --><div class="text-[10px] text-[var(--text-muted)] space-y-0.5 mt-2"><div class="flex items-center justify-between">