- ALSA
- Pulseaudio
- Jack Audio
- Software
- Tools
- Bluetooth
- Check when the headphone is plugged and unplugged
- Replace pulseaudio and jack with pipewire
This is required after messing up with jack and getting strange behaviour. ALSA config files are:
- User level
~/.asoundrc - System wide
/etc/asound.conf
sudo alsactl restore
Check the sound modules and their names cat /proc/asound/modules and create a file /etc/modprobe.d/alsa-base.conf with this content:
options snd_hda_intel index=0To set the default sound card. Check your devices cat /proc/asound/cards
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xe2340000 irq 137
1 [Microphone ]: USB-Audio - Yeti Stereo Microphone
Blue Microphones Yeti Stereo Microphone at usb-0000:00:14.0-2.3, full speed
2 [Capture ]: USB-Audio - FHD Capture
VXIS Inc FHD Capture at usb-0000:00:14.0-2.2, super speedType aplay -l to list all the devices that can play sound
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX8200 Analog [CX8200 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Microphone [Yeti Stereo Microphone], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0and modify ~/.asoundrc to use CX8200 by default
pcm.!default {
type hw
card 0
hint {
show on
description "Default ALSA Output (currently CX8200 sound card)"
}
}
ctl.!default {
type hw
card 0
}To persistently set the default mutes/levels in alsamixer run sudo alsactl store
This is required after messing up with jack and getting strange behaviour. Pulseaudio config files:
- It will check first user level
~/.config/pulse - System wide
/etc/pulse/
In the configuration tab of pavucontrol select the appropiate profile you wish.
You might want to install the AUR package pamac to identify the DEVICE or just look it up with pacmd list-sinks and pacmd list-sources. Then rename a sink with:
pacmd 'update-sink-proplist DEVICE device.description="DESCRIPTION" '
And for the sources:
pacmd 'update-source-proplist DEVICE device.description="DESCRIPTION" '
If you want this at login add this to ~/.config/pulse/default.pa
update-sink-proplist DEVICE device.description="DESCRIPTION"
update-source-proplist DEVICE device.description="DESCRIPTION"In my case I have:
update-sink-proplist alsa_output.pci-0000_00_1f.3.analog-stereo device.description="Internal Output"
update-source-proplist alsa_input.pci-0000_00_1f.3.analog-stereo device.description=device.description="Monitor of Internal Output"
update-source-proplist alsa_output.pci-0000_00_1f.3.analog-stereo.monitor device.description="Monitor of Internal Output"A null sink is a virtual sink that discards audio sent to it. That’s not very useful by itself, but the monitor that comes with it can be very useful. In ~/.config/pulse/default.pa
.ifexists module-null-sink.so
load-module module-null-sink sink_name=nulla sink_properties='device.description="Virtual Output A"'
.endifMost applications won't allow you to select a microphone from a source. Here is where a virtual source comes handy.
# virtual source
# This will create a virtual source (a microphone you can select) from a monitor
.ifexists module-virtual-source.so
load-module module-virtual-source source_name=VirtualMic master=nulla.monitor source_properties='device.description="Virtual Mic A"'
.endifThe default audio server in Linux is pulseaudio. That is fine for standard use (one recording sink). But once you start having more complex situations, where you want to record the output of the speakers or you want multiple recordings or playbacks, you will find limitations. That cannot be achieved with pulseaudio. You need a more advanced audio server. That server is jack.
Installing jack is a bit tricky: install the following packages jack2 libffado cadence jack_capture python-dbus realtime-privileges pulseaudio-jack, add yourself to the groups audio and realtime then reboot. You should be able to start jack via cadence. Then make sure you autostart at boot.
NOTE: In arch/i3 to make start at login modify
/etc/X11/xinit/xinitrc.d/61-cadence-session-inject.shand add$STARTUPat the endSTARTUP="$INSTALL_PREFIX/bin/cadence-session-start --system-start-by-x11-startup $STARTUP" $STARTUP
Otherwise it won't autostart jack at login. Also bridge ALSA Audio using ALSA > PulseAudio > JACK (Plugin) option and bridge PulseAudio with Auto-start at login. Otherwise you might realise that you cannot play youtube videos while jack is running. In that case install the pakage pulseaudio-jack. Then edit /etc/pulse/default.pa and the following below #load-module module-alsa-sink section:
load-module module-jack-sink
load-module module-jack-sourceAnd restart pulseaudio with killall pulseaudio
Check the audio recording devices with arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CX8200 Analog [CX8200 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 2: Microphone [Yeti Stereo Microphone], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 3: Capture [FHD Capture], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0In this case the name of the device is Microphone. So add it with alsa_in -j "Yeti" -d hw:Microphone -q 1 2>&1 1> /dev/null &. Explanation:
alsa_inis the command-j "Yeti"is the name that will appear inCarla-d hw:Microphoneis the name of the device we are adding-q 1sets the quality to low/passable2>&1sends all the output to std output1> /dev/nulltrashes std output&puts the process in the background
In cadence go to configure and change the output device to the HDMI. Make sure you also have duplex mode selected. Stop and restart jack and the pulseaudio bridge.
Ardour requires you to start jack server previously. Ardour now works with pulseaudio as well
Placeholder for Helm synth
Install mpd and add a config file in ~/.config/mpd/mpd.conf like
####### MPD CONFIG #######
# Required files
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/log"
# Optional
music_directory "~/Music"
playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
audio_output {
type "pulse"
name "pulse audio"
}
audio_output {
type "fifo"
name "toggle_visualizer"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
####### END MPD CONFIG #######Create the playlist dir mkdir ~/.config/mpd/playlists
Start/enable the mpd service systemctl start --user mpd.service and systemctl enable --user mpd.service.
Install ncmpcpp and probably set a better alias for it.
mkdir outputs
for f in *.wav; do ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%}.mp3"; doneInstall bluez bluez-utils pulseaudio-bluetooth pulseaudio-alsa and start/enable bluetooth.service. Make sure is not blocked rfkill unblock bluetooth
Run bluetoothctl:
power onlistcomputer controllerscan on/offscan for devicesdeviceslist discovered devicespaired-deviceslist theminfodevice check device infopairdevicetrustdeviceconnectdevice
If you are getting a connection error org.bluez.Error.Failed retry by restarting PulseAudio daemon first pulseaudio -k and the pulseaudio and try again.
pacmd list-cards to get the card number and pacmd set-card-profile card_number a2dp_sink
But A2DP high fidelity profile is not working. No audio out. To keep fixing later.
First check if the service is running systemctl start acpid.service then run acpi_listen
jack/headphone HEADPHONE unplug
jack/microphone MICROPHONE unplug
jack/headphone HEADPHONE plug
jack/microphone MICROPHONE plugYou will be able to see the events.
To Fix: Note that plugging the headphones also makes the system think that there is a mic plugged-in. This mutes the laptop mic leaving you with no mic.
Install pipewire pipewire-jack pipewire-alsa pipewire-pulse you will have to uninstall pulseaudio.
Prevent cadence loading jack at login (undo some things we did above). Edit /etc/X11/xinit/xinitrc.d/61-cadence-session-inject.sh and remove $STARTUP at the end.
Now run a jack app with pipewire pw-jack carla is MINDBLOWING. You can pipe anything to anything!!! All devices and all apps! There is no way back from here. Pipewire now becomes my standard in audio for linux.