How to input from headphone mic output to built-in speakers
How to Input from Headphone Mic, Output to Built-in Speakers on Kubuntu
As avid users and contributors to the open-source community, we at revWhiteShadow understand the intricacies of configuring audio devices, especially on Linux distributions like Kubuntu. This guide provides a comprehensive, step-by-step approach to resolve the common issue of routing headphone microphone input to the built-in laptop speakers for audio output on Kubuntu 18.04, even when facing the “Unavailable” speaker status in PulseAudio Volume Control. This setup can be invaluable for scenarios like online meetings, presentations, or even casual voice chats where using headphones for both input and output isn’t ideal.
Understanding the Audio Architecture: PulseAudio’s Role
Before diving into the solutions, it’s crucial to grasp the underlying audio system. Kubuntu, by default, relies on PulseAudio, a sound server that acts as an intermediary between applications and the ALSA (Advanced Linux Sound Architecture) drivers, which interact directly with your sound card. PulseAudio’s primary function is to manage audio streams, allowing you to control volume levels, select input/output devices, and route audio between different devices.
The challenge you’re encountering stems from how PulseAudio detects and manages your laptop’s single sound card. When headphones are connected, PulseAudio may automatically switch both input and output to the headphone jack, effectively disabling the built-in speakers. The “Unavailable” status in PulseAudio Volume Control indicates that the speakers are not currently considered an active output device when the headphones are plugged in.
Step-by-Step Solutions to Route Audio Effectively
We will guide you through several troubleshooting steps, each addressing a specific aspect of PulseAudio configuration and sound card management, to effectively route the audio input from your headphone microphone to your laptop’s built-in speakers.
1. Verifying Hardware Detection with alsamixer
First, ensure that your sound card and both your headphone jack and internal speakers are correctly detected by ALSA, the underlying sound system. alsamixer
provides a text-based interface to inspect and adjust ALSA sound card settings.
Open a Terminal: Press
Ctrl+Alt+T
.Run
alsamixer
: Typealsamixer
and press Enter.Select Your Sound Card: If
alsamixer
opens with the wrong sound card, pressF6
to choose the correct one, typically labeled with your sound card model (e.g., “HDA Intel PCH”).Check Speaker and Headphone Status: In
alsamixer
, use the left and right arrow keys to navigate through the different volume controls. Look for “Speaker,” “Headphone,” and “Internal Mic.”Ensure Unmuted: If “MM” appears below any of these controls, it means they are muted. Press
M
to unmute them. “OO” indicates that the control is unmuted.Adjust Volume Levels: Use the up and down arrow keys to adjust the volume levels. Make sure the volumes are at a reasonable level (e.g., 70-80%).
Check for “Auto-Mute Mode”: Look for a control called “Auto-Mute Mode” or similar. This feature often automatically mutes the speakers when headphones are plugged in. If present, disable it by navigating to it and pressing the down arrow key until it says “Disabled.” The setting to look for is often named “Auto-Mute Mode”. Use arrow keys to navigate, and the disable options is usually named
Disabled
.
Exit
alsamixer
: PressEsc
to exit.
2. PulseAudio Configuration via pavucontrol
(PulseAudio Volume Control)
PulseAudio Volume Control (pavucontrol
) offers a graphical interface for fine-tuning audio settings. You likely already tried some of this, but follow closely.
Install
pavucontrol
(if not already installed):sudo apt update sudo apt install pavucontrol
Open PulseAudio Volume Control: Type
pavucontrol
in the terminal and press Enter, or search for “PulseAudio Volume Control” in your application menu.Configuration Tab: Go to the “Configuration” tab.
- Profile Selection: Check the “Profile” setting for your sound card. Experiment with different profiles, such as “Analog Stereo Duplex” or specific options that mention “Headphones” and “Speakers” separately. Sometimes, selecting a different profile can enable both the headphone microphone and the built-in speakers simultaneously. After each change, test the audio output.
Output Devices Tab: Go to the “Output Devices” tab.
Speaker Status: Verify if your built-in speakers are listed and not muted. If they are muted, click the mute icon to unmute them.
Fallback Device: Ensure that your built-in speakers are set as the “Fallback Device.” This setting ensures that applications default to the speakers when no other output device is explicitly selected.
Input Devices Tab: Go to the “Input Devices” tab.
Headphone Microphone Selection: Ensure your headphone microphone is selected as the active input device. You should see a level meter that responds to your voice.
Mute Check: Verify that the microphone is not muted.
Playback and Recording Tabs: While playing audio (e.g., a song or a test sound), check the “Playback” tab to ensure the audio stream is directed to the correct output device (your built-in speakers). Similarly, check the “Recording” tab when using the microphone to verify that the input stream is coming from your headphone microphone.
3. Utilizing pacmd
(PulseAudio Command-Line Interface)
For more advanced configuration, you can use pacmd
, the PulseAudio command-line interface. This tool allows you to directly manipulate PulseAudio’s settings.
List Sinks and Sources: Open a terminal and run the following commands to list available output devices (sinks) and input devices (sources):
pacmd list-sinks pacmd list-sources
Carefully examine the output. Look for the index numbers of your built-in speakers (sink) and your headphone microphone (source). Note these numbers down, as you’ll need them in subsequent commands.
Set Default Sink and Source: Use the following commands to set your built-in speakers as the default sink and your headphone microphone as the default source. Replace
sink_index
andsource_index
with the actual index numbers you obtained in the previous step:pacmd set-default-sink sink_index pacmd set-default-source source_index
For example:
pacmd set-default-sink 1 pacmd set-default-source 2
Create a Combined Sink (Simultaneous Output Alternative): While you mentioned that “Simultaneous Output” didn’t work, creating a combined sink manually might yield better results. This creates a virtual output device that mirrors audio to both your speakers and headphones (though you only want the speakers). Then, you can move your primary output to this sink.
pacmd load-module module-combine-sink sink_name=combined sink_properties=device.description="Combined Output" slaves=sink1,sink2
Replace
sink1
andsink2
with the names (not indices) of your speaker sink and headphone sink respectively. You can find these names in the output ofpacmd list-sinks
. The sink name is after the#
in the sink listing.After creating the combined sink, set it as the default:
pacmd set-default-sink combined
Note: this approach might not directly solve the core issue, as it effectively duplicates the audio output (potentially to both headphones and speakers). However, it’s a valuable troubleshooting step to test whether PulseAudio can handle simultaneous output at all. If the headphones are silent, this can work.
Moving Existing Streams (If Necessary): If some applications are still using the wrong output, you can manually move their audio streams to the correct sink. Use the following command to list the active audio streams:
pacmd list-sink-inputs
Identify the stream you want to move and note its index number. Then, use the following command to move it to your built-in speakers (replace
stream_index
with the stream’s index andsink_index
with the speaker’s index):pacmd move-sink-input stream_index sink_index
4. Persistent Configuration: Modifying PulseAudio’s Configuration Files
The changes made through pavucontrol
and pacmd
are typically temporary and will be lost after a reboot. To make them permanent, you need to modify PulseAudio’s configuration files.
Copy the System Configuration: Copy the system-wide PulseAudio configuration file to your user directory:
mkdir -p ~/.config/pulse cp /etc/pulse/default.pa ~/.config/pulse/default.pa
Edit
default.pa
: Open thedefault.pa
file in your user directory with a text editor (e.g.,nano
orgedit
):nano ~/.config/pulse/default.pa
Add Configuration Directives: Add the following lines to the end of the file, replacing
sink_name
andsource_name
with the actual names of your built-in speaker sink and headphone microphone source (as found inpacmd list-sinks
andpacmd list-sources
):set-default-sink sink_name set-default-source source_name
If you implemented the combined sink, add:
load-module module-combine-sink sink_name=combined sink_properties=device.description="Combined Output" slaves=sink1,sink2 set-default-sink combined
Save and Exit: Save the changes and exit the text editor.
Restart PulseAudio: Restart PulseAudio to apply the changes:
pulseaudio -k pulseaudio --start
5. Addressing “Unavailable” Speaker Status with Module Loading
The “Unavailable” status you’re seeing might be because PulseAudio isn’t properly loading the module responsible for your built-in speakers when the headphones are connected. Try explicitly loading the module:
Edit
default.pa
(again): Open the~/.config/pulse/default.pa
file as described above.Add Module Loading Directive: Add the following line to the end of the file:
load-module module-alsa-sink device=hw:0,0
Important: The
device=hw:0,0
part needs to be adjusted to match your specific sound card configuration. You can find the correct device identifier usingaplay -l
. Look for the entry corresponding to your built-in speakers and note the card and device numbers (e.g.,card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
). Replacehw:0,0
withhw:card_number,device_number
.Save and Exit: Save the changes and exit the text editor.
Restart PulseAudio: Restart PulseAudio to apply the changes:
pulseaudio -k pulseaudio --start
6. Checking for Conflicting Configurations in KDE System Settings
KDE’s System Settings also provide audio configuration options that might conflict with PulseAudio’s settings.
Open System Settings: Open “System Settings” from your application menu.
Multimedia Section: Go to the “Multimedia” section and then to “Audio and Video.”
Audio Hardware Setup: Review the settings under “Audio Hardware Setup.”
Device Preference: Ensure that your preferred input and output devices (headphone microphone and built-in speakers, respectively) are selected as the default devices.
Connector Settings: Check the “Connector” settings for your sound card. Make sure the headphone jack and internal speakers are configured correctly.
7. Kernel Module Options (Advanced Users)
In rare cases, the issue might stem from incorrect kernel module options for your sound card. This is an advanced troubleshooting step and should only be attempted if you are comfortable with command-line editing and system configuration.
Identify Your Sound Card Module: Determine the kernel module used by your sound card. A common module is
snd_hda_intel
. You can usually find this information in the output oflspci -v
(look for the “Audio device” entry).Create a Module Configuration File: Create a configuration file for your sound card module in the
/etc/modprobe.d/
directory. For example, if your module issnd_hda_intel
, create a file named/etc/modprobe.d/alsa-base.conf
.Add Module Options: Add options to the configuration file to explicitly specify the speaker and headphone behavior. The options vary depending on your sound card model. Consult the ALSA sound card documentation for your specific model to find the appropriate options.
Example (for
snd_hda_intel
, may not be correct for your card):options snd_hda_intel model=laptop
Reboot Your System: Reboot your system for the changes to take effect.
Conclusion: Persistent Troubleshooting for Optimal Audio Routing
Configuring audio routing on Linux can sometimes be challenging due to the complex interaction between hardware, ALSA drivers, and PulseAudio. We have outlined a comprehensive set of troubleshooting steps, starting with basic hardware verification and progressing to advanced configuration techniques. By systematically working through these steps, you should be able to successfully route the input from your headphone microphone to your laptop’s built-in speakers on Kubuntu 18.04. Remember to test your configuration thoroughly after each step to identify the specific solution that works for your system. The revWhiteShadow team hopes this in-depth guide helps you achieve the desired audio setup for your Kubuntu system.