Screeching if Line Out and Mic1 are enabled together
DESCRIPTION: Following an apparent solution to getting audio calls to work [issue #8 (closed)], a remaining problem was that sms notifications and the ringing to announce an incoming phone call did not give audible sounds, apart from the sounds associated with the vibrational buzz. Enabling (unmuting) the Line Out Playback Switch [speaker at the lower back of the pinephone] while the USB-C cable was plugged in caused a quickly increasing screeching sound. Muting Mic1 [microphone at bottom of pinephone] stopped the screeching sound. Adapting the alsa-ucm-conf *.conf files to satisfy (i) have no screeching sound, (ii) have sms/phone audio notifications/ringing occur audibly, (iii) have audio phone calls without bad audio feedback effects, and (iv) have automatic returning to state (ii) after a phone call required some testing. This is a bug for situations where someone wishes to have sound input to Mic1 and sound output from Line Out simultaneously.
CONTEXT: Slightly updated since #8 (closed) .
- Pinephone v1.2
- Mobian/trixie
- biktorgj modem package 0.7.2
- ADSP 01.003.01.003
dpkg -l |grep -E "phosh|phoc|alsa|gnome-calls|pipewire|pulse"
ii alsa-ucm-conf 1.2.9-1mobian1 all ALSA Use Case Manager configuration files
ii alsa-utils 1.2.9-1 arm64 Utilities for configuring and using ALSA
ii gnome-calls 45~alpha.0-4 arm64 Make and receive PSTN phone calls
ii gstreamer1.0-pulseaudio:arm64 1.22.4-1 arm64 GStreamer plugin for PulseAudio (transitional package)
ii libcanberra-pulse:arm64 0.30-10 arm64 PulseAudio backend for libcanberra
ii libpipewire-0.3-0:arm64 0.3.76-1 arm64 libraries for the PipeWire multimedia server
ii libpipewire-0.3-modules:arm64 0.3.76-1 arm64 libraries for the PipeWire multimedia server - modules
ii libpulse-dev:arm64 16.1+dfsg1-2+b1 arm64 PulseAudio client development headers and libraries
ii libpulse-mainloop-glib0:arm64 16.1+dfsg1-2+b1 arm64 PulseAudio client libraries (glib support)
ii libpulse0:arm64 16.1+dfsg1-2+b1 arm64 PulseAudio client libraries
ii libpulsedsp:arm64 16.1+dfsg1-2+b1 arm64 PulseAudio OSS pre-load library
ii mobian-phosh 0.4.1 all Mobian -- full Phosh environment
ii mobian-phosh-base 0.4.1 all Mobian -- base Phosh environment
ii mobian-phosh-extras 0.4.1 all Mobian -- extra applications for the Phosh environment
ii mobian-phosh-phone 0.4.1 all Mobian -- telephony applications for the Phosh environment
ii mobian-tweaks-phosh 0.5.8 all Mobian -- Configuration settings for Phosh
ii phoc 0.30.0+ds-1 arm64 Wayland compositor for mobile phones
ii phosh 0.30.0-1 arm64 Pure Wayland shell for mobile devices
ii phosh-core 24 arm64 GNOME/Phosh mobile Environment -- essential components
ii phosh-full 24 arm64 GNOME/Phosh mobile Environment, with extra components
ii phosh-mobile-settings 0.29.0-1 arm64 Phosh and related settings for mobile
ii phosh-mobile-tweaks 0.29.0-1 all Pure Wayland shell for mobile devices - GSettings tweaks
ii phosh-phone 24 arm64 GNOME/Phosh mobile Environment -- phone components
ii phosh-plugins 0.29.0-1 arm64 Pure Wayland shell for mobile devices - Plugins
ii phosh-tour 0.24.0-2 arm64 Short introduction to phosh on smartphones
ii pipewire:arm64 0.3.76-1 arm64 audio and video processing engine multimedia server
ii pipewire-alsa:arm64 0.3.76-1 arm64 PipeWire ALSA plugin
ii pipewire-audio 0.3.76-1 all recommended set of PipeWire packages for a standard audio desktop use
ii pipewire-audio-client-libraries 0.3.76-1 all transitional package for pipewire-alsa and pipewire-jack
ii pipewire-bin 0.3.76-1 arm64 PipeWire multimedia server - programs
ii pipewire-jack:arm64 0.3.76-1 arm64 PipeWire JACK plugin
ii pipewire-pulse 0.3.76-1 arm64 PipeWire PulseAudio daemon
rc pulseaudio 16.1+dfsg1-2+b1 arm64 PulseAudio sound server
ii pulseaudio-utils 16.1+dfsg1-2+b1 arm64 Command line tools for the PulseAudio sound server
DISCUSSION:
As in #8 (closed), a reboot appears to be necessary for the *.conf files to be read by whichever program uses them (presumably you may do callaudiod
)sudo alsaucm reload && systemctl --user restart pipewire.service && systemctl --user restart wireplumber
. If you enable Mic1 and Line Out simultaneously in PinePhone.conf and reboot, you are likely to have screeching until the boot sequence finishes and you manage to get access to alsa through amixer
or alsamixer
, e.g. you may wish to put
amixer -c 0 sset 'Line Out' mute
in your bash history before rebooting, for fast access. :) Check first if there are people around you who may be upset by the screeching. This situation may occur on reboot if you do not have the cset "name='Line Out Playback Switch' off"
line inserted in PinePhone.conf
as shown in the proposed solution below.
When I did not yet have cset "name='Mic1 Playback Switch' off"
and cset "name='Mic1 Capture Switch' off"
in the SectionDevice."Speaker"
EnableSequence
section of VoiceCall.conf in the proposed solution below; and I rebooted; and phoned to a remote phone without immediately putting my ear on the pinephone (to trigger the proximity sensor), I got a strong and varying audio feedback (not screeching) - not as bad as screeching, but still unacceptable for a regular phone call.
With the solution below, once a phone call had started, pressing on the 'Speaker' gui button caused the input sound to the remote phone to emerge from the pinephone lower-back speaker (as opposed to the earpiece speaker). I didn't try testing if input sound (to Mic1) was received; in principle (based on my understanding of the VoiceCall.conf file), it was blocked.
HYPOTHESIS:
It seems both from this bug and from issue #8 (closed), that a regular phone call causes EnableSequence and DisableSequence rules in the SectionDevice."Speaker"
section to be run, even though no sound comes from the speaker and there's no obvious reason why the speaker should be enabled.
PROPOSED SOLUTION: With the following patch against alsa-ucm-conf 1.2.9-1mobian1, conditions (i) to (iv) were satisfied for my testing.
diff -ub Mobian_PP_trixie/HiFi.conf PinePhone/HiFi.conf
--- Mobian_PP_trixie/HiFi.conf 2023-06-14 14:10:42.000000000 +0200
+++ PinePhone/HiFi.conf 2023-08-07 15:39:11.698079207 +0200
@@ -19,7 +19,12 @@
Comment "Internal speaker"
EnableSequence [
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
+ # 2023-08-07 re-enabled Line Out; not tested
+ # 2023-07-31 forcibly disabled
+ cset "name='Mic1 Capture Switch' off"
+ cset "name='Mic1 Playback Switch' off"
cset "name='Line Out Playback Switch' on"
+ #cset "name='Line Out Playback Switch' off"
cset "name='Line Out Playback Volume' 100%"
]
diff -ub Mobian_PP_trixie/PinePhone.conf PinePhone/PinePhone.conf
--- Mobian_PP_trixie/PinePhone.conf 2023-06-14 14:10:42.000000000 +0200
+++ PinePhone/PinePhone.conf 2023-07-31 19:17:52.875883854 +0200
@@ -31,6 +31,9 @@
cset "name='Headphone Source Playback Route' DAC"
# The Pinephone speaker is mono.
cset "name='Line Out Source Playback Route' Mono Differential"
+ # 2023-07-31 hack to try to prevent unexplained switching
+ # on/unmuting of the Line Out parameter
+ cset "name='Line Out Playback Switch' off"
]
SectionDefaults [
diff -ub Mobian_PP_trixie/VoiceCall.conf PinePhone/VoiceCall.conf
--- Mobian_PP_trixie/VoiceCall.conf 2023-07-30 21:04:13.000000000 +0200
+++ PinePhone/VoiceCall.conf 2023-08-07 17:28:18.065105445 +0200
@@ -1,17 +1,47 @@
SectionVerb {
EnableSequence [
# Playback volumes.
- cset "name='DAC Playback Volume' 160"
+ cset "name='DAC Playback Volume' 163"
+ cset "name='DAC Playback Switch' on"
cset "name='AIF1 DA0 Playback Volume' 160"
- cset "name='AIF2 DAC Playback Volume' 160"
+ #cset "name='AIF2 DAC Playback Volume' 160"
+ cset "name='AIF2 DAC Playback Volume' 186"
# Capture volumes.
- cset "name='ADC Capture Volume' 160"
+ #cset "name='ADC Capture Volume' 160"
+ cset "name='ADC Capture Volume' 179"
+ # 2023-08-07 - turn off Mic1 instead
+ # Make sure that if you plug something into your USB-C
+ # connector, it won't cause screeching.
+ cset "name='Line Out Playback Switch' off"
+ #
cset "name='AIF1 AD0 Capture Volume' 160"
- cset "name='AIF2 ADC Capture Volume' 160"
- cset "name='Mic2 Boost Volume' 1"
+ #cset "name='AIF2 ADC Capture Volume' 160"
+ cset "name='AIF2 ADC Capture Volume' 192"
+ cset "name='ADC Gain Capture Volume' 2"
# Routing
cset "name='AIF2 Digital DAC Playback Switch' on"
cset "name='AIF2 ADC Mixer ADC Capture Switch' on"
+ ## Microphones:
+ # Assume only 'Mic1' will be used, not a headset
+ cset "name='Mic1 Capture Switch' on"
+ cset "name='Mic1 Playback Switch' on"
+ cset "name='Mic1 Playback Volume' 6"
+ # boost is too noisy
+ cset "name='Mic1 Boost Volume' 0"
+ # Mic2 - disable
+ cset "name='Mic2 Boost Volume' 0"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Mic2 Playback Volume' 0"
+ # 'Plackback Switch' typically corresponds to 'mute' in alsamixer
+ cset "name='Mic2 Playback Switch' off"
+ ]
+
+ DisableSequence [
+ cset "name='Mic1 Capture Switch' off"
+ # 2023-08-07: Line Out + Mic1 give screeching
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic2 Capture Switch' off"
+ cset "name='Line Out Playback Switch' on"
]
Value {
@@ -24,12 +54,20 @@
EnableSequence [
cset "name='AIF1 DA0 Stereo Playback Route' Mix Mono"
- cset "name='Line Out Playback Switch' on"
+ # 2032-08-07 disabled again - with Mic1 off to be doubly safe
+ # 2023-07-31 forcibly disabled
+ cset "name='Mic1 Playback Switch' off"
+ cset "name='Mic1 Capture Switch' off"
+ #cset "name='Line Out Playback Switch' on"
+ #
+ cset "name='Line Out Playback Switch' off"
cset "name='Line Out Playback Volume' 100%"
]
DisableSequence [
cset "name='Line Out Playback Switch' off"
+ cset "name='Mic1 Playback Switch' on"
+ cset "name='Mic1 Capture Switch' on"
]
Value {
@@ -68,10 +106,16 @@
EnableSequence [
cset "name='Mic1 Capture Switch' on"
+ cset "name='Mic1 Playback Volume' 6 on"
+ cset "name='Mic1 Playback Switch' on"
+ cset "name='AIF2 ADC Capture Volume' 192"
+ cset "name='ADC Gain Capture Volume' 2"
]
DisableSequence [
cset "name='Mic1 Capture Switch' off"
+ # 2023-08-07: Line Out + Mic1 give screeching
+ cset "name='Mic1 Playback Switch' off"
]
Value {