OSS with USB DAC: crackles

Many thanks for following up me.
1. uname -a
Code:
FreeBSD thecuong.tk 10.1-STABLE FreeBSD 10.1-STABLE #0 r282290: Fri May  1 14:16:20 ICT 2015  root@thecuong.tk:/usr/obj/usr/src/sys/VUDIEPANH  amd64

2. cat /dev/sndstat
Code:
pcm0: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm1: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm2: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm3: <NVIDIA GT440 (HDMI/DP 8ch)> (play)
pcm4: <USB audio> (play) default

3. sysctl dev.pcm.4
Code:
dev.pcm.4.%desc: USB audio
dev.pcm.4.%driver: pcm
dev.pcm.4.%location:
dev.pcm.4.%pnpinfo:
dev.pcm.4.%parent: uaudio0
dev.pcm.4.hwvol_step: 5
dev.pcm.4.hwvol_mixer: vol
dev.pcm.4.play.vchans: 1
dev.pcm.4.play.vchanmode: fixed
dev.pcm.4.play.vchanrate: 48000
dev.pcm.4.play.vchanformat: s16le:2.0
dev.pcm.4.buffersize: 0
dev.pcm.4.bitperfect: 1
dev.pcm.4.mixer.vol_0.val: -14521
dev.pcm.4.mixer.vol_0.min: -32767
dev.pcm.4.mixer.vol_0.max: 0
dev.pcm.4.mixer.vol_0.desc:
dev.pcm.4.mixer.mute_1.val: 0
dev.pcm.4.mixer.mute_1.min: 0
dev.pcm.4.mixer.mute_1.max: 1
dev.pcm.4.mixer.mute_1.desc:
dev.pcm.4.feedback_rate: 47999

4. sysctl hw.usb.uaudio
Code:
hw.usb.uaudio.debug: 0
hw.usb.uaudio.default_rate: 0
hw.usb.uaudio.default_bits: 32
hw.usb.uaudio.default_channels: 0
best regards,
 
First I see your using or trying to use bitperfect. Is that intentional or an attempt at fixing your problem? Try adding the following sysctl(8) settings to your sysctl.conf file:
Code:
hw.usb.uaudio.default_rate=44100
hw.usb.uaudio.default_bits=16
hw.usb.uaudio.default_channels=2
dev.pcm.4.bitperfect=0
If any of these sysctl(8) settings are already in the file, just replace them. Bitperfect just turns off all kernel mixing and sends a raw unaltered audio stream to your connected device(audio amp, etc) so won't do anything for this problem in case that was your reasoning behind setting it and if not, it shouldn't matter in this case whether it's set or not.

Additionally, there have been some updates to USB audio recently so if experimenting with these settings doesn't fix the issue, you could try updating your source tree and rebuilding 10-STABLE to see if that helps as well.
 
I'm not sure what the local etiquette is for bumping an old thread rather creating a new one so apologies in advance if I have committed a faux pas.

I have a USB DAC that is also crackling. The model is the Audioengine D1. I'm attempting to use bitperfect mode. With bitperfect turned off there is less crackling, but I can still hear the occasional pop. Would upgrading to 10.2 stable possibly help?

Some stuff that was asked before plus some info from dmesg that will hopefully be helpful.


Code:
% uname -a
FreeBSD rosbox 10.2-RELEASE-p7 FreeBSD 10.2-RELEASE-p7 #15 r285073M: Thu Nov 12
14:34:22 PST 2015     ross@rosbox:/usr/obj/usr/src/sys/ALTQENABLED  amd64


% cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC662 (Analog)> (play/rec)
pcm1: <Realtek ALC662 (Onboard Digital)> (play)
pcm2: <Realtek ALC662 (Front Analog Headphones)> (play)
pcm3: <USB audio> (play) default


% sysctl dev.pcm.3
dev.pcm.3.feedback_rate: 48000
dev.pcm.3.mixer.mute_0.desc:
dev.pcm.3.mixer.mute_0.max: 1
dev.pcm.3.mixer.mute_0.min: 0
dev.pcm.3.mixer.mute_0.val: 0
dev.pcm.3.bitperfect: 1
dev.pcm.3.buffersize: 0
dev.pcm.3.play.vchans: 0
dev.pcm.3.hwvol_mixer: vol
dev.pcm.3.hwvol_step: 5
dev.pcm.3.%parent: uaudio0
dev.pcm.3.%pnpinfo:
dev.pcm.3.%location:
dev.pcm.3.%driver: pcm
dev.pcm.3.%desc: USB audio


% sysctl hw.usb.uaudio
hw.usb.uaudio.default_channels: 0
hw.usb.uaudio.default_bits: 32
hw.usb.uaudio.default_rate: 0
hw.usb.uaudio.debug: 0


% dmesg | grep uaudio
uaudio0: <Audioengine Audioengine D1, class 0/0, rev 1.10/0.03, addr 2> on usbus1
uaudio0: Play: 96000 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 88200 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 48000 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 32000 Hz, 2 ch, 24-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No recording.
uaudio0: No MIDI sequencer.
pcm3: <USB audio> on uaudio0
uaudio0: HID volume keys found.

Possibly related is that in bitperfect mode, the DAC doesn't seem to want to accept a stream that isn't 24bit. I can only play files with mplayer by adding '-format s24le'. Even natively 24bit files seem to be interpreted as 32bit by mplayer and need the flag added. If there is another, better player to try, I will happily test that out.
 
Hi,

Please try a 10-STABLE kernel first. Did you try different sample rates?

--HPS

I have the same issue running 10.2-STABLE FreeBSD 10.2-STABLE #0 r291083

Which setting should be changed?

Code:
dev.pcm.6.feedback_rate: 48000
dev.pcm.6.mixer.mute_0.desc: 
dev.pcm.6.mixer.mute_0.max: 1
dev.pcm.6.mixer.mute_0.min: 0
dev.pcm.6.mixer.mute_0.val: 0
dev.pcm.6.bitperfect: 0
dev.pcm.6.buffersize: 0
dev.pcm.6.rec.vchanformat: s16le:2.0
dev.pcm.6.rec.vchanrate: 48000
dev.pcm.6.rec.vchanmode: fixed
dev.pcm.6.rec.vchans: 1
dev.pcm.6.play.vchanformat: s16le:2.0
dev.pcm.6.play.vchanrate: 48000
dev.pcm.6.play.vchanmode: fixed
dev.pcm.6.play.vchans: 1
dev.pcm.6.hwvol_mixer: vol
dev.pcm.6.hwvol_step: 5
dev.pcm.6.%parent: uaudio0
dev.pcm.6.%pnpinfo: 
dev.pcm.6.%location: 
dev.pcm.6.%driver: pcm
dev.pcm.6.%desc: USB audio
 
This is the result when I make the attempt:
Code:
sudo sysctl dev.pcm.6.play.vchanrate=44100
dev.pcm.6.play.vchanrate: 48000 -> 48000

I also tried placing the change in /etc/sysctl.conf then rebooting with no effect.
 
That possibly means some application is already using /dev/dsp and it cannot change the rate. Please verify that vchanrate is 44100 Hz.
Can you log some debug prints?

1) sysctl hw.usb.uaudio.debug=16
2) Plug USB DAC
3) Play some music 5 seconds
4) Send dmesg log to me: hps@selasky.org

--HPS
 
I've been keeping my system up to date with the freebsd-update(8) binaries. Should I rebuild the world, and the kernel as stable, or can I just build the kernel? I'd like to avoid getting off the release binaries.
 
Last edited by a moderator:
I tried files with different bit depths and sample rates and they all had crackles, even after upgrading to the 10.2 Stable kernel. I'm playing all these files with mplayer and the '-format s24le' argument.

I e-mailed you the logs you requested.
 
I have similar problems with a USB S/PDIF output (hiFaceTWO UAC2 M2Tech)
Please tell me how is your UAC2 audio device working now?
I generally could not find evidence of its support in FreeBSD. I even created a topic on the forum, but there are no answers.

Ogogon.
 
It's working very well now on 12 snd_uaudio.ko up to 24/96
Code:
ugen2.6: <M2Tech hiFaceTWO UAC2> at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (100mA)
no problems
 
Back
Top