2

When using the h2n as USB mic and playback device, it displays 44.1khz as sample rate.

When pulseaudio restarts, it is detected correctly (pacmd list-sinks): sample spec: s16le 2ch 44100Hz

Now I start playing a video on youtube and while it plays, turn the "Profile" of it in "pavucontrol" -> "Configuration" to "off" and back to "Analog Stereo Duplex". Now pulseaudio tells me: sample spec: s16le 2ch 48000Hz

On a fresh system start it's even enough to just open pavucontrol to cause the wrong sampling rate.

Which results in a pitched output with a lot of crackling.


Stuff I have tried:

1.

Make the following changes to ~/.config/pulse/daemon.conf:

default-sample-rate = 44100
avoid-resampling = yes

as suggested in another question (Setting different per-device sampling rates in pulseaudio?) and in https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting

2.

put

pcm.device{
    format S16_LE
    rate 41000
    type hw
    card 0
    device 0
}
pcm.!default{
    type plug
    slave.pcm "device"
}

into ~/.asoundrc and logging out and back in. (https://unix.stackexchange.com/a/141234/227331)

3.

put

pcm.!default {
    type rate
    slave {
        pcm "plughw:0,0"
        rate 44100
    }
}

into ~/.asoundrc as suggested here: https://bbs.archlinux.org/viewtopic.php?pid=400718#p400718 and rebooting.

4.

pactl list sinks | grep -oP "(?<=device.string = \")(.*)(?=\")" | while read in; do pasuspender -- speaker-test --nloops=1 --channels=2 --test=wav --device=$in; done as suggested in https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/Users/Troubleshooting/ sounds good. Afterwards firefox will resume with crackling noises.

sezanzeb
  • 397
  • 3
  • 22
  • Possibly the same issue as [Steinberg UR22C Audio Interface Sometimes Low-pitched Playback, Cracks](https://bbs.archlinux.org/viewtopic.php?id=256005) but I cannot comment there because I can't register, maybe because I'm not running arch. – sezanzeb Sep 06 '20 at 09:50
  • Here is a bug report for this: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/980 – sezanzeb Sep 08 '20 at 16:33

2 Answers2

5

Uncomment and set alternate-sample-rate to 44100 in /etc/pulse/daemon.conf (and remove ~/.asoundrc).

Tom Yan
  • 450
  • 2
  • 6
  • Thanks! It seems like this only helped on my laptop (xubuntu 19.04, kernel 5.3.0-51), but not on my computer (manjaro, kernel 5.4.18-1). Both have pulseaudio 13.0. But it's a good start. – sezanzeb May 11 '20 at 06:50
  • Ony my itx (manjaro, kernel 5.4.13-2) it never even was a problem and always played audio correctly. – sezanzeb May 11 '20 at 07:00
  • I might reinstall all my stuff on wednesday. I had lots of jack stuff running on the computer and maybe trying to get that nightmare to work messed up everything else – sezanzeb May 11 '20 at 07:52
  • Reinstalled my computer, added that change and it does not solve the problem unfortunatelly – sezanzeb May 21 '20 at 18:15
  • 1
    One possible reason why this didn't work for me back then could be because `~/.config/pulse/daemon.conf` seems to take precedence over `/etc/pulse/daemon.conf` – sezanzeb Jun 20 '22 at 12:54
5

After Installing cadence and jack2, adding myself to the audio group (usermod -a -G audio username), logging back in and setting cadence to use the h2n for input and output it seems to be promising. In pavucontrol I have a "Jack sink" for output and "Jack source" for input and I can select those as default when I need to use it. No crackling yet.

So basically I need to put jack between pulseaudio and alsa to make it work, if I understand the linux audio environment correctly.


Edit

I have tried to remove pulseaudio completely now. Quite a lot of programs still work, but not all of them. In order to get volume control working I made this: https://github.com/sezanzeb/ALSA-Control. Also see https://unix.stackexchange.com/a/293206/227331


Edit 2

try https://pipewire.org/

sezanzeb
  • 397
  • 3
  • 22