In plasma-pa's MicrophoneTest component, the sample rate for recording and playback is hardcoded to 44.1 kHz (constexpr int SAMPLE_RATE = 44100;). When performing a microphone test, this hardcoded rate forces audio servers like PipeWire to switch the stream/node clock rate to 44100 Hz. For microphones and devices operating natively at 48000 Hz (or higher), this triggers unnecessary resamplers or clock rate switching across the audio graph. Steps to reproduce: 1. Use an audio interface or microphone operating at 48000 Hz on PipeWire. 2. Open System Settings -> Sound and initiate a microphone test. 3. Observe the PipeWire graph / stream properties (pw-top). Expected behavior: MicrophoneTest should query and use the native sample rate of the selected source (m_source) rather than enforcing a fixed 44.1 kHz rate. Proposed solution: Query the native sample rate from PulseAudioQt::Source / m_source during startRecording(). Store the detected sample rate and pass it to pa_sample_spec for both recording and playback streams (startRecording and playRecording).
Good find. Would you like to submit a patch to change that?
Created attachment 195100 [details] Query native sample rate from source instead of hardcoding 44.1kHz Ok Nate, here's the patch. Thanks! *** Use the source's native sample rate for the microphone test MicrophoneTest hardcoded the record/playback sample rate to 44.1 kHz. When the selected source (m_source) actually runs at a different native rate — 48 kHz being common with PipeWire — this forces the audio server to switch the stream/node clock rate for the whole graph, triggering unnecessary resampling. Query the source's native sample rate via pa_context_get_source_info_by_name() before starting the record stream, and reuse the detected rate for both the record and the playback pa_sample_spec. The previous synchronous stream setup is now split into startRecording() (kicks off the async query) and beginRecording() (does the actual stream setup), invoked from the source_info_callback(). Falls back to the previous 44.1 kHz default if the query cannot be issued. BUG: 523693
Thanks, but how about in the form of a merge request over at https://invent.kde.org/plasma/plasma-pa/-/merge_requests/?
(In reply to Nate Graham from comment #3) > Thanks, but how about in the form of a merge request over at > https://invent.kde.org/plasma/plasma-pa/-/merge_requests/? Ok, I'll do it.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-pa/-/merge_requests/418
Git commit 459256d5482cab598da6e87642e72dffa93a99c9 by Nate Graham, on behalf of Dan Fi. Committed on 17/08/2026 at 18:54. Pushed by ngraham into branch 'master'. Use the source's native sample rate for the microphone test MicrophoneTest hardcoded the record/playback sample rate to 44.1 kHz. When the selected source (m_source) actually runs at a different native rate — 48 kHz being common with PipeWire — this forces the audio server to switch the stream/node clock rate for the whole graph, triggering unnecessary resampling. Query the source's native sample rate via pa_context_get_source_info_by_name() before starting the record stream, and reuse the detected rate for both the record and the playback pa_sample_spec. The previous synchronous stream setup is now split into startRecording() (kicks off the async query) and beginRecording() (does the actual stream setup), invoked from the source_info_callback(). Falls back to the previous 44.1 kHz default if the query cannot be issued. Test Plan: Tested microphone test with a source running at 48 kHz on PipeWire; confirmed via `pw-top` that the node clock rate no longer switches to 44100 Hz during the test. Also verified the fallback path (default 44.1 kHz) still works when the source info query fails. FIXED-IN: 6.8.0 M +44 -3 src/microphonetest.cpp M +6 -0 src/microphonetest.h https://invent.kde.org/plasma/plasma-pa/-/commit/459256d5482cab598da6e87642e72dffa93a99c9