Sound issues

I am trying to switch to FreeBSD full time but one of the bottlenecks I have is misbehaving sound system.
Basically, when I boot into FreeBSD after a well operating session of Linux, the sound works in FreeBSD but I am not able change the sound device using hw.pcm.default_unit. Nor does hw.pcm default_auto work for me. So sometimes both my earphones and laptop speakers are working at the same time and sometimes just one of these.
On the next reboot into FreeBSD, there is a beep before the system even starts to boot up, and then sometimes the sound works sometimes it doesn't.
But on the very next reboot, there is a beep before system starts and one more beep while FreeBSD is booting up, and the sound doesn't work.

Also when I get back to Linux after this, the sound problem persists. But on the very next reboot into Linux. The sound works just fine.
I don't understand what is going on with my system. Is FreeBSD setting some flags for the initial beep? Is the sound device not getting removed properly?

When I only had Linux on my system, there was no such problem with the sound.
I have gone through man sound. snd_hda(4).
I am loading snd_hda(4) and snd_uaudio(4) at boot. Rest of the drivers don't seem to make any difference either.
 
I suggest to test your audio with mgp123 which is a simple command-line tool. It will eliminate various bridges or connectors that link drivers to applications. If mpg123 works, you can proceed to the full system test.
First you need to list the pcm channels which are listed in the system logs and readable using dmesg
or dmesg | grep pcm | more

You can use a script for convenience or just type the sysctl and replace the $1 with the channel number.
Finally, put a few mp3 in a test folder and type mpg123 test/*mp3

Code:
#!/bin/sh
# file myplay.sh
echo  "usage: ./myplay.sh  5" # ..(where '5' is the pcm device_number)
cat /dev/sndstat
sysctl hw.snd.default_unit=$1
sysctl -d hw.snd.default_auto
cat /dev/sndstat
mpg123  test/*.mp3
echo "bye"

I have 5 pcm channels from the internal CODEC and 1 channel each for the 2 USB DACs.

Here is some audio meta data from dmesg:
Code:
hdacc0: <ATI R6xx HDA CODEC> at cad 0 on hdac0
hdaa0: <ATI R6xx Audio Function Group> at nid 1 on hdacc0
pcm0: <ATI R6xx (HDMI)> at nid 3 on hdaa0
pcm1: <ATI R6xx (HDMI)> at nid 5 on hdaa0
hdacc1: <Realtek ALC892 HDA CODEC> at cad 0 on hdac1
hdaa1: <Realtek ALC892 Audio Function Group> at nid 1 on hdacc1
pcm2: <Realtek ALC892 (Rear Analog 5.1/2.0)> at nid 20,22,21 and 24,26 on hdaa1
pcm3: <Realtek ALC892 (Front Analog)> at nid 27 and 25 on hdaa1
pcm4: <Realtek ALC892 (Rear Digital)> at nid 30 on hdaa1
 
What does /dev/sndstat show? What does "dmesg|grep hda" show? Try to relate it with what "man snd_hda" says. If you are still stuck, post that here.
Mine shows this:

Code:
hdac0: <NVIDIA (0x0fb8) HDA Controller> mem 0xf7080000-0xf7083fff irq 55 at device 0.1 on pci10
hdac1: <AMD X370 HDA Controller> mem 0xf7a00000-0xf7a07fff irq 43 at device 0.3 on pci12
hdacc0: <NVIDIA (0x0081) HDA CODEC> at cad 0 on hdac0
hdaa0: <NVIDIA (0x0081) Audio Function Group> at nid 1 on hdacc0
pcm0: <NVIDIA (0x0081) (HDMI/DP 8ch)> at nid 4 on hdaa0
pcm1: <NVIDIA (0x0081) (HDMI/DP 8ch)> at nid 5 on hdaa0
hdacc1: <Realtek ALC1220 HDA CODEC> at cad 0 on hdac1
hdaa1: <Realtek ALC1220 Audio Function Group> at nid 1 on hdacc1
pcm2: <Realtek ALC1220 (Analog 5.1+HP/2.0)> at nid 27,22,21,20 and 24,26 on hdaa1
pcm3: <Realtek ALC1220 (Rear Digital)> at nid 30 on hdaa1
pcm4: <Realtek ALC1220 (Front Analog Mic)> at nid 25 on hdaa1

I had to change "hw.snd.default_unit" to 0 from 2. Except for that I haven't had to do anything special and I can even play youtube videos in Firefox with sound (via the HDMI connected display) just fine.
 
Back
Top