# Audiophile options for a HQ external USB DAC



## cartesius23 (Aug 19, 2022)

Guys, I'm quite new to the FreeBSD world but amazed so far. Please, out of curiosity, you guys who use *USB DACs* could you share ideas and/or sysctl.conf how to tweak the audio system for highest possible quality. Things regarding *bitperfect* and such. Thank you!

This is all I currently got:


```
# Sound
hw.snd.verbose=2
hw.snd.default_unit=6
hw.snd.feeder_rate_quality=3
dev.pcm.6.play.vchanformat=s32le:2.0
```


----------



## larshenrikoern (Aug 20, 2022)

I have:

hw.snd.feeder_rate_quality=4
##To reduce number of sound generated interrupts
hw.snd.latency=7

See also man.sound (the manpage for sound). Lots of useful information


----------



## cartesius23 (Aug 20, 2022)

Yes, I was just curious what people use.


----------



## rsronin (Aug 21, 2022)

Did you read this on the forum?


----------



## cartesius23 (Aug 21, 2022)

rsronin said:


> Did you read this on the forum?


Great, thank you! Sounds precisely like something I was looking for.


----------



## hardworkingnewbie (Aug 22, 2022)

The plain and simple, also ugly truth is that you don't need an USB DAC normally, because the DACs which are put on mainboards are more than capable of doing their job nowadays.

Only reasons where it is desireable to get one is this:

1. if the audio coming from mainboard is pestered with hisses and interferences, which you cannot get rid of.
2. if you have got a high impedance set of headphones, like 600 Ohms, while your audio output only can handle let's say 32, which means that volume becomes a problem. Which is not a DAC issue anyway strictly, but of amplification.

It's way more effective to invest the money, which you would use for a DAC for, into your headphones.


----------



## cartesius23 (Aug 22, 2022)

hardworkingnewbie said:


> It's way more effective to invest the money, which you would use for a DAC for, into your headphones.


Luckily/unfortunately I got both: HQ higher impedance (>= 250-300 Ohm) headphones, so using the USB DAC with integrated amplifier. Currently Fulla Shiit 3 DAC. But I agree that for cheaper headphones it's a waste of money.


----------



## Zare (Aug 24, 2022)

I don't use DACs but interfaces. Focusrite Scarlett works out of the box.


----------



## angry_vincent (Aug 24, 2022)

Zare said:


> I don't use DACs but interfaces. Focusrite Scarlett works out of the box.


does it work in bitperfect mode?  if this mode of any interest. i considering in some future times motu m2 interface but it happens to be not working in bitperfect.


----------



## Zare (Aug 24, 2022)

Yes. 
I just use low latency (0) and bitperfect in sysctl.conf.

It's connected to t-400 poweramp which in turn drives a pair of Infinity EL-40 bass reflex speakers. 
The sound on FreeBSD is really good.


----------



## Error415 (Nov 2, 2022)

angry_vincent said:


> does it work in bitperfect mode?  if this mode of any interest. i considering in some future times motu m2 interface but it happens to be not working in bitperfect.


I used the Focusrite Scarlett on Freebsd 12 and 13 to feed my Drop 789 headphone amp and it worked perfectly in bit-perfect mode. I recently replaced it with a Topping E30 II (price to performance, you can't beat it) and it works perfectly too. I had a Topping D10s for a couple weeks before exchange it for the E30 II and it worked perfectly as well. I've never had issue with my external USB DAC's on Linux or FreeBSD.


----------



## angry_vincent (Nov 2, 2022)

i had only Shiit Fulla 2 usb dac and it does not work in bit-perfect mode, only distorted sound. It is claimed that this device has full USB protocol support but still no go. It works fine in usual way. Now i am in research of devices that do work in bit-perfect mode.


----------



## Voltaire (Nov 5, 2022)

_/etc/sysctl.conf_

dev.pcm.0.bitperfect=1
dev.pcm.1.bitperfect=1
kern.timecounter.alloweddeviation=0
hw.snd.maxautovchans=0
hw.snd.latency=0

You have to adjust the first two lines according to the channel your music is played on.
For example, it can also be dev.pcm.*3*.bitperfect=1 depending on your system.

You don't need an USB DAC for perfect sound with these settings.
All you need is an analog connection that is available on almost every motherboard:


			https://hardwaresecrets.com/wp-content/uploads/2005/12/259_011.jpg
		


By that I mean that if you have a decent motherboard and my settings you achieve a sound quality on the analog connection that can hardly be better. 
Analog has the potential to scale the best of all options at 24-bit 96 kHz.

I recommend cmus as a music player with the following settings:
softvol true
softvol_state 100 100

That's all important and to me gives the best quality possible on FreeBSD.


----------



## angry_vincent (Nov 5, 2022)

Yes, i  tried mentioned tunables before and it still did not work. all i had is distorted sound. removing dev.pcm.%d.bitperfect=1 makes it sound normally. with the rest of tunables kept as in example


----------



## Voltaire (Nov 5, 2022)

angry_vincent said:


> makes it sound normally


Do you mean the analog connection or the USB DAC?
My settings are for an analog connection.
You will have perfect quality that can no longer be significantly improved via the green analog jack.
What is your playback device? (*/dev/dsp0, /dev/dsp1, /dev/dsp2, /dev/dsp3, /dev/dsp4, ..)*


----------



## angry_vincent (Nov 5, 2022)

i no longer have that usb dac ( Shiit Fulla 2 ), i was referring only to this device in all my posts. i tried almost all possible settings and it did not work. currently i have onboard sound in notebook.


----------



## Voltaire (Nov 5, 2022)

angry_vincent said:


> i no longer have that usb dac ( Shiit Fulla 2 ), i was referring only to this device in all my posts. i tried almost all possible settings and it did not work. currently i have onboard sound in notebook.


You can run the following command in a terminal:  *sysctl dev.pcm*

Could you please take a screenshot of the full output of this command?


----------



## angry_vincent (Nov 5, 2022)

dev.pcm.0.mode: 7
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 65536
dev.pcm.0.rec.vchans: 0
dev.pcm.0.rec.autosrc: 2
dev.pcm.0.rec.32bit: 24
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 1
dev.pcm.0.play.32bit: 24
dev.pcm.0.%parent: hdaa0
dev.pcm.0.%pnpinfo:
dev.pcm.0.%location: nid=31,25,35,27
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: Conexant CX20590 (Analog 2.0+HP/2.0)
dev.pcm.%parent:


----------



## Voltaire (Nov 5, 2022)

Ok.
I'm not sure if that *%d* in _dev.pcm.%d.bitperfect=1_ is the right method.
Just to be sure, add the following settings and remove all your other _audio_ settings from this file:

_/etc/sysctl.conf_

dev.pcm.0.bitperfect=1
kern.timecounter.alloweddeviation=0
hw.snd.maxautovchans=0
hw.snd.latency=0


----------



## angry_vincent (Nov 5, 2022)

i guess we lost in conversation, %d is just number holder for devices, in your example ( pot #13 ) they are 0 and 1,  is why i  i have typed generic %d as example., in real situation i  use 0 in my case ( just like your example in #19 ). it does not work ( notice it is just notebook oboard sound )


----------



## Voltaire (Nov 5, 2022)

angry_vincent said:


> i guess we lost in conversation, %d is just number holder for devices, in your example ( pot #13 ) they are 0 and 1,  is why i  i have typed generic %d as example., in real situation i  use 0 in my case ( just like your example in #19 ). it does not work ( notice it is just notebook oboard sound )


I think the fact that we can see your output from sysctl dev.pcm will make it easier for people with more expertise to solve your problem.
The last thing I can personally think of is:
1. Apply my settings that I specified in the previous post
2. Then run the following command: *mixer*

What I sometimes see is that a seriously distorted sound can be produced in some situations when igain or ogain is set to 4 or another value different from 0.

Then I change this via eg *mixer igain 0* or via *mixer ogain 0* and then this distorted sound is immediately gone.

If that doesn't fix it I can't immediately figure out the reason for your problem, unless maybe because it could be a mic and output on the same jack, but I don't know, that's just a wild guess.


----------



## angry_vincent (Nov 5, 2022)

there is no igain or ogain for me:
Mixer vol      is currently set to  90:90
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to  50:50
Mixer rec      is currently set to   1:1
Mixer monitor  is currently set to  42:42
Recording source: mic
mixer igain   0
mixer: unknown device: igain


----------



## Voltaire (Nov 5, 2022)

I actually have an old netbook with a newer version of FreeBSD that I use as a music player. The weird thing is that *I also see ogain and igain there* when I run the mixer command. So that's something I would investigate further, what the reason is.

This netbook only has two settings:
dev.pcm.0.bitperfect=1
hw.snd.maxautovchans=0

I don't see 'Mixer monitor' on my desktop, but I do see 'Mixer monitor' on the netbook, and that* is set to 0*. In my current setup, the sound is not played on the internal speakers but is sent to the audio output to which my headphones are connected. So set monitor to 0 by typing *mixer monitor 0*. That was the last thing I can think of, someone else can probably help you better. I'm not going to have time tonight to help you further.


----------



## Voltaire (Nov 6, 2022)

Can you also post this:

_Repeat for all /dev/mixerN

mixer -f /dev/mixer0
mixer -f /dev/mixer1
mixer -f /dev/mixer2
mixer -f /dev/mixer3
mixer -f /dev/mixer4
mixer -f /dev/mixer5
mixer -f /dev/mixer6
mixer -f /dev/mixer7
..._

You can try to dump the mixer nodes that you don't use for playback.

You can try:
mixer -f /dev/mixer4 -s mix 0
mixer -f /dev/mixer5 -s mix 0
etc.

But only for the mixer nodes that you don't use.. 
It has solved other people's problem in the past.


----------



## angry_vincent (Nov 6, 2022)

i have only 5 of them:

mixer -f /dev/mixer0
Mixer vol      is currently set to  86:86
Mixer pcm      is currently set to 100:100

mixer -f /dev/mixer1
Mixer vol      is currently set to  75:75
Mixer pcm      is currently set to  75:75

mixer -f /dev/mixer2
Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100

mixer -f /dev/mixer3

Mixer vol      is currently set to 100:100
Mixer pcm      is currently set to 100:100

mixer -f /dev/mixer4

Mixer vol      is currently set to  86:86
Mixer pcm      is currently set to 100:100
Mixer speaker  is currently set to 100:100
Mixer mic      is currently set to  50:50
Mixer rec      is currently set to   1:1
Mixer monitor  is currently set to  42:42
Recording source: mic


----------



## Voltaire (Nov 6, 2022)

*mixer monitor 0*
Did the command above didn't solve it?

You can try:
mixer -f /dev/mixer0 -s mix 0
mixer -f /dev/mixer1 -s mix 0
mixer -f /dev/mixer2 -s mix 0
mixer -f /dev/mixer3 -s mix 0

Avoid (don't do!):
mixer -f /dev/mixer4 -s mix 0


----------



## angry_vincent (Nov 6, 2022)

mixer monitor 0 did not solve

i have:
mixer -f /dev/mixer0 -s mix 0 mixer: unknown device: mix usage: mixer [-f device] [-s | -S] [dev [+|-][voll[:[+|-]volr]] ...       mixer [-f device] [-s | -S] recsrc ...       mixer [-f device] [-s | -S] {^|+|-|=}rec rdev ... devices: vol, pcm
it looks it is new mixer ( there was rewrite of it )


----------



## Voltaire (Nov 6, 2022)

angry_vincent said:


> mixer monitor 0 did not solve
> 
> i have:
> mixer -f /dev/mixer0 -s mix 0 mixer: unknown device: mix usage: mixer [-f device] [-s | -S] [dev [+|-][voll[:[+|-]volr]] ...       mixer [-f device] [-s | -S] recsrc ...       mixer [-f device] [-s | -S] {^|+|-|=}rec rdev ... devices: vol, pcm
> it looks it is new mixer ( there was rewrite of it )


Please do all these commands after each other:

mixer -f /dev/mixer0 0
mixer -f /dev/mixer0 pcm 0
mixer -f /dev/mixer1 0
mixer -f /dev/mixer1 pcm 0
mixer -f /dev/mixer2 0
mixer -f /dev/mixer2 pcm 0
mixer -f /dev/mixer3 0
mixer -f /dev/mixer3 pcm 0


----------



## angry_vincent (Nov 6, 2022)

this worked
bitperfect also now working. thats quite and achievement! thank you very much!


----------



## angry_vincent (Nov 6, 2022)

question: are these mixer changes permanent?


----------



## Voltaire (Nov 6, 2022)

angry_vincent said:


> this worked
> bitperfect also now working. thats quite and achievement! thank you very much!


You're welcome.


> question: are these mixer changes permanent?


No, you can always reconfigure them as you wish.
But if you don't change them, they'll be remembered.

My experience with bit-perfect on FreeBSD is that cmus does not play 24-bit files but only (the standard) 16-bit files. (I'm talking about lossless FLAC and APE files)
Audacious can play all file types (also FLAC 24-bit 96kHz) in bit-perfect mode, so I would recommend this audio player.


----------



## angry_vincent (Nov 6, 2022)

i am quite familiar with audio/musicpd so this is my player choice. I also meant that applied changes to mixer are remembered but used wrong word, sorry. I still shocked this was that simple


----------



## Voltaire (Nov 6, 2022)

angry_vincent said:


> i am quite familiar with audio/musicpd so this is my player choice. I also meant that applied changes to mixer are remembered but used wrong word, sorry. I still shocked this was that simple


mpd may also be my favorite app but it takes a little longer to configure. I'm also glad it's resolved for you


----------



## Voltaire (Nov 8, 2022)

I installed mpd today. I used to use it all the time but hadn't used it for a few years.

So what I noticed is that Audacious gives a little more volume at 100% volume on both players. I then adjusted this by giving 2% more volume to mpd in the mixer.

Then I compared the sound quality. I would think it's the same with bit-perfect settings, but it wasn't. The song I played didn't have that much bass, but the bass had more impact on Audacious than it did on mpd.

Then I played the following song on both players:  https://opbeatz.beatstars.com/beat/hourglass-1680975

It sounds better in Chromium and Audacious than on mpd. The bass is less tight and less detailed on MPD. Maybe I've misconfigured mpd and that's why it doesn't sound as good. I'll investigate that further.

It could also be that Audacious has better sound for one reason or another: https://www.reddit.com/r/Ubuntu/comments/ado6kl/audacious_sound_with_a_gnome_music_like_interface/

_I'm not an audiophile but I find the quality sound of the audacious music player much better than other music players I tried._


----------



## Voltaire (Nov 8, 2022)

Audacious and MPD sound slightly different on my system. I researched it further and compared a few more tracks. Audacious has a bass that is more punchy. But MPD has more purity in the voice and instruments.


----------



## angry_vincent (Nov 14, 2022)

1. i have to say, sadly to my too early excitement, that disabling of mixers we did with above commands, pcm4  became my main device.
cat /dev/sndstat:
pcm4:  (play/rec) default
and i had dev.pcm0 set to bitperfect. now that all other mixers disabled, i set dev.pcm.4.bitperfect=1 and it produces distorted sound, hiss and noise. so i was wrong in my comments, wrongly assuming dev.pcm.0 has worked ( it was main device before disable of other mixer devices )
2. i find it very weird, that in bitperfect mode audacious and musicpd plays differently. it cannot be so, in my understanding. either one or second doing something wrong with sound ( equalizer or similar )


----------



## Voltaire (Nov 14, 2022)

Audacious has a more punchy and more emphasized bass, MPD has better vocals. For me it is definitely correctly configured on the right output. They both sound very good but there are subtle differences.

I don't know why it won't work for you, I think a developer will be able to help you better, I don't have detailed knowledge of FreeBSD's audio stack.


----------



## Tieks (Nov 14, 2022)

angry_vincent said:


> i set dev.pcm.4.bitperfect=1 and it produces distorted sound, hiss and noise


Bitperfect mode sends an audio stream directly, without any processing, to a device. In your case to pcm4, likely your DAC. If you get hiss and noise, you may be sending a format or a sample rate your DAC cannot handle.


----------



## angry_vincent (Nov 15, 2022)

Yes, i understand. but how to find out which format/sample which DAC can handle? it is onboard sound card


----------



## Tieks (Nov 15, 2022)

angry_vincent said:


> how to find out which format/sample which DAC can handle?


Most of all from the manual and specifications of the DAC and its settings, if any. Ffprobe (part of the ffmpeg), by using `ffprobe audio.file`, gives you sample rate, no. of channels and bit depth of an audio file. 
Remember that audio applications may alter audio before sending it to an output device. Command `cat /dev/sndstat` will show you these data as it was last sent.


----------



## angry_vincent (Nov 15, 2022)

ffprobe was really helpful, thank you very much.


----------



## wolffnx (Nov 15, 2022)

Voltaire said:


> Audacious has a more punchy and more emphasized bass, MPD has better vocals. For me it is definitely correctly configured on the right output. They both sound very good but there are subtle differences.
> 
> I don't know why it won't work for you, I think a developer will be able to help you better, I don't have detailed knowledge of FreeBSD's audio stack.



Im not an expert in sound but me too, I find audacious with better sound, if you are interest I made a patch to have 31 bands on audacious

audacious hack

if you like I cant update the post for the actual version


----------

