[Bug 268136] [snd_uaudio] Distorted audio from MOTU M4 USB interface

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 03 Dec 2022 14:09:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268136

            Bug ID: 268136
           Summary: [snd_uaudio] Distorted audio from MOTU M4 USB
                    interface
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: usb@FreeBSD.org
          Reporter: markus.buretorp@gmail.com

All audio coming from the MOTU M4 audio interface is distorted. There is a high
frequency buzz on top of all sounds, both sounds generated by FreeBSD over USB
and external analog inputs. I've tried all a lot of sysctl combinations but no
difference at all.

As I said this affects all analog inputs with direct monitoring. For example
with the computer OFF I can connect an external signal generator to one analog
input and hear it. Once I boot FreeBSD and do something audio related like
opening a YouTube tab it starts distorting the external signal as well as
YouTube. Now if I close the YouTube tab the external signal is clean again and
the distortion is gone.

My guess is that something with the uaudio initialization messes up the audio
interface internals.

POTENTIAL FIX:
This has nothing to do with PulseAudio as it happens on a base installation
with no pkgs. BUT the only fix I've found is to either start or kill the
PulseAudio daemon with 'pulseaudio -D' or 'pulseaudio -k'. So something in the
PulseAudio init/shutdown code is pokes something which fixes the audio. Note
that this has to be repeated every time audio is reinitialized, so if you close
YouTube and later open it again you would have to do the PulseAudio trick
again.

Maybe stepping through the PA init code to find what function call fixes it
would help.


INFO:
root@marcus:~ # freebsd-version
13.1-RELEASE-p5

root@marcus:~ # dmesg | grep -i audio
hdaa0: <NVIDIA (0x0099) Audio Function Group> at nid 1 on hdacc0
uaudio0 on uhub1
uaudio0: <MOTU M4, class 239/2, rev 2.00/2.02, addr 4> on usbus3
uaudio0: Play[0]: 192000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play[0]: 176400 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play[0]: 96000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play[0]: 88200 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play[0]: 48000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play[0]: 44100 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 192000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 176400 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 96000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 88200 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 48000 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record[0]: 44100 Hz, 4 ch, 32-bit S-LE PCM format, 2x8ms buffer.
uaudio0: MIDI sequencer.
pcm4: <USB audio> on uaudio0
uaudio0: No HID volume keys found.

root@marcus:~ # sysctl hw.snd
hw.snd.maxautovchans: 16
hw.snd.default_unit: 4
hw.snd.version: 2009061500/amd64
hw.snd.default_auto: 1
hw.snd.verbose: 0
hw.snd.vpc_mixer_bypass: 1
hw.snd.feeder_rate_quality: 1
hw.snd.feeder_rate_round: 25
hw.snd.feeder_rate_max: 2016000
hw.snd.feeder_rate_min: 1
hw.snd.feeder_rate_polyphase_max: 183040
hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
hw.snd.feeder_eq_exact_rate: 0
hw.snd.feeder_eq_presets:
PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
hw.snd.basename_clone: 1
hw.snd.compat_linux_mmap: 0
hw.snd.syncdelay: -1
hw.snd.usefrags: 0
hw.snd.vpc_reset: 0
hw.snd.vpc_0db: 45
hw.snd.vpc_autoreset: 1
hw.snd.timeout: 5
hw.snd.latency_profile: 1
hw.snd.latency: 2
hw.snd.report_soft_matrix: 1
hw.snd.report_soft_formats: 1

root@marcus:~ # sysctl hw.usb.uaudio
hw.usb.uaudio.debug: 0
hw.usb.uaudio.buffer_ms: 8
hw.usb.uaudio.default_channels: 0
hw.usb.uaudio.default_bits: 32
hw.usb.uaudio.default_rate: 0
hw.usb.uaudio.handle_hid: 1

-- 
You are receiving this mail because:
You are the assignee for the bug.