Sound? How do I hear thee? NOT! Let me count the ways. The sounds of silence.

Sound?  How do I hear thee? NOT!  Let me count the ways. The sounds of silence. 

From electrical field to mechanical air vibrations to my ear.

How do you set the sound to work on GhostBSD/FreeBSD ?  As a new user you have:
 NO IDEA WHAT TO DO!
What cryptic incantation do issue to appease the great monster in the VOID beyond my simple imagination.  On what sequence of characters to type into the command line?

After having working  Ghos tBSD 23 with sound.  I upgraded to GhostBSD 24.01.01 with the GUI app Update-Station.   This app deleted some software apps and then re-installed the newer version of that software library and applications.

virtual_oss_cmd /dev/dsp.ctl -f /dev/dsp1




That is the one SINGLE command line I issued to just magically turn on the sound.  Yes I had spent about 8 hours of time 3 months ago, trying to use USB Headphones on my laptop and on my Raspberry Pi 4B running both FreeBSD 14.0-RELEASE and GhostBSD-Arm64 14.0-STABLE to hear sounds from a test using MPG123 ( pkg install mpg123) audio MP3 player.  I had read many WEB posts to test and use USB Headphones, but that always seemed to leave out some key, crucial missing step (for me)  , that for them just worked.

I thought maybe this H Sleaski with his virtual_OSS command could redirect an audio stream to play youtube audio in the browser to my USB headphones.   So I started checking to see what needed to be enabled in this BARE Raspberry Pi running FreeBSD (which did not support HDMI audio ),  So I thought using USB headphones should be a simple breeze to make work.   Edit 2 files and add a couple lines like this:
/boot/loader.conf
snd_driver_load="YES" 
cuse_load="YES"

/etc/rc.conf 
sndiod_enable="YES"

fred@fred-T440pc /u/h/fred [64]> cat /dev/sndstat
Installed devices:
pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Realtek ALC292 (Internal Analog Mic)> (rec)
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)



fred@fred-T440pc /u/h/fred [1]> dmesg | grep pcm
pcm0: <Intel Haswell (HDMI/DP 8ch)> at nid 3 on hdaa0
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> at nid 20,21 and 26 on hdaa1
pcm2: <Realtek ALC292 (Internal Analog Mic)> at nid 18 on hdaa1
interface ua_pcm.1 already present in the KLD 'kernel'!
pcm0: <Intel Haswell (HDMI/DP 8ch)> at nid 3 on hdaa0
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> at nid 20,21 and 26 on hdaa1
pcm2: <Realtek ALC292 (Internal Analog Mic)> at nid 18 on hdaa1
interface ua_pcm.1 already present in the KLD 'kernel'!
pcm0: <Intel Haswell (HDMI/DP 8ch)> at nid 3 on hdaa0
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> at nid 20,21 and 26 on hdaa1
pcm2: <Realtek ALC292 (Internal Analog Mic)> at nid 18 on hdaa1
interface ua_pcm.1 already present in the KLD 'kernel'!


fred@fred-T440pc /u/h/fred> virtual_oss -Q 0 -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/dsp1 -R /dev/null -w vdsp.wav -l dsp

 fred@fred-T440pc /u/h/fred> cat /boot/loader.conf

rc_system="bsdrc"
crypto_load="YES"
aesni_load="YES"
geom_eli_load="YES"
vfs.zfs.arc_max="512M"
zfs_load="YES"
snd_driver_load="YES"
cuse_load="YES"

fred@fred-T440pc /u/h/fred> sysctl hw.snd.default_unit=0

hw.snd.default_unit: 0 -> 0

fred@fred-T440pc /u/h/fred> sysctl hw.snd.default_unit=1

hw.snd.default_unit: 0 -> 1

fred@fred-T440pc /u/h/fred> mpg123 file*.mp3

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.32.5; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes

Terminal control enabled, press 'h' for listing of keys and functions.
Playing MPEG stream 1 of 1: file_example_MP3_700KB.mp3 ...

MPEG 1.0 L III vbr 44100 j-s
Year:    2018

[src/libout123/libout123.c:out123_play():745] error: Error in writing audio, wrote only 4152 of 4608 (No error: 0?)!
[0:00] Decoding of file_example_MP3_700KB.mp3 finished.


fred@fred-T440pc /u/h/fred> cat /dev/sndstat

Installed devices:

pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Realtek ALC292 (Internal Analog Mic)> (rec)

Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)

fred@fred-T440pc /u/h/fred [1]> mixer

pcm1:mixer: <Realtek ALC292 (Analog 2.0+HP/2.0)> on hdaa1  (play/rec) (default)

    vol       = 0.85:0.85     pbk
    pcm       = 0.85:0.85     pbk
    speaker   = 0.59:0.59     rec
    mic       = 0.20:0.20     rec src
    mix       = 0.37:0.37     rec
    rec       = 0.37:0.37     pbk
    igain     = 0.20:0.20     pbk
    ogain     = 1.00:1.00     pbk

fred@fred-T440pc /u/h/fred> kldstat

Id Refs Address                Size Name

 1  165 0xffffffff80200000  2751c70 kernel
 2    1 0xffffffff82953000   5d5648 zfs.ko
 3    1 0xffffffff82f29000     4330 snd_driver.ko
 4    2 0xffffffff82f2e000     7238 snd_vibes.ko
 5    2 0xffffffff82f36000     5b98 snd_via82c686.ko
 6    2 0xffffffff82f3c000     5c78 snd_t4dwave.ko
 7    4 0xffffffff82f42000     3238 snd_spicds.ko
 8    2 0xffffffff82f46000     75d8 snd_solo.ko
 9    2 0xffffffff82f4e000    12208 snd_neomagic.ko
10    2 0xffffffff82f61000     bf58 snd_maestro3.ko
11    2 0xffffffff82f6d000     47a8 snd_fm801.ko
12    2 0xffffffff82f72000     8c68 snd_envy24ht.ko
13    2 0xffffffff82f7b000     9f88 snd_envy24.ko
14    2 0xffffffff82f85000     5c38 snd_cs4281.ko
15    2 0xffffffff82f8b000     7c38 snd_atiixp.ko
16    2 0xffffffff82f93000     61a0 snd_als4000.ko
17    1 0xffffffff82f9a000    1c3a8 geom_eli.ko
18    1 0xffffffff82fb7000     af50 cuse.ko
19    1 0xffffffff83820000     73c0 linprocfs.ko
20    4 0xffffffff83828000     c2a8 linux_common.ko
21    1 0xffffffff83835000     440c linsysfs.ko
22    1 0xffffffff8383a000     3560 fdescfs.ko
23    1 0xffffffff8383e000    31b80 linux.ko
24    1 0xffffffff83870000    2de28 linux64.ko
25    1 0xffffffff8389e000    12e18 fusefs.ko
26    1 0xffffffff838b1000   1b3920 i915kms.ko
27    2 0xffffffff83a65000    7c050 drm.ko
28    1 0xffffffff83ae2000     22b8 iic.ko
29    3 0xffffffff83ae5000     3080 linuxkpi_hdmi.ko
30    3 0xffffffff83ae9000     6350 dmabuf.ko
31    3 0xffffffff83af0000     3378 lindebugfs.ko
32    1 0xffffffff83af4000     b360 ttm.ko
33    1 0xffffffff83b00000     41e0 acpi_ibm.ko
34    1 0xffffffff83b05000     3390 acpi_wmi.ko
35    1 0xffffffff83b09000     3250 ichsmb.ko
36    1 0xffffffff83b0d000     2178 smbus.ko
37    1 0xffffffff83b10000    93260 if_iwlwifi.ko
38    1 0xffffffff83ba4000    17314 if_iwm.ko
39    1 0xffffffff83bbc000     d200 rtsx.ko
40    1 0xffffffff83bca000     4d64 geom_uzip.ko
41    1 0xffffffff83bcf000    28450 ipfw.ko
42    1 0xffffffff83bf8000     2a68 mac_ntpd.ko
43    1 0xffffffff83bfb000     2278 pty.ko
44    1 0xffffffff83bfe000     4760 nullfs.ko
45    1 0xffffffff83c03000     4d20 ng_ubt.ko
46    3 0xffffffff83c08000     abb8 netgraph.ko
47    2 0xffffffff83c13000     a250 ng_hci.ko
48    2 0xffffffff83c1e000     2670 ng_bluetooth.ko

fred@fred-T440pc /u/h/fred>  cat /etc/rc.conf

zfs_enable="YES"
kld_list="linux linux64 cuse fusefs /boot/modules/i915kms.ko acpi_ibm snd_uaudio fuse"
#linux_enable="YES"
ubuntu_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
dbus_enable="YES"
lightdm_enable="YES"
webcamd_enable="YES"
cupsd_enable="YES"
avahi_daemon_enable="YES"
avahi_dnsconfd_enable="YES"
moused_enable="YES"
ipfw_enable="YES"
firewall_enable="YES"
ifconfig_em0="DHCP"
wlans_iwm0="wlan0"
ifconfig_wlan0="WPA DHCP"
keymap="us.kbd"
hostname="fred-T440pc"
linux_enable="NO"
powerd_enable="YES"
powerd_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1600"
# fred@fred-T440pc /e/pkg> service virtual_oss onestatus
# virtual_oss is not running.
# virtual_oss_enable to YES in /etc/rc.conf
virtual_oss_enable="YES"
virtual_oss_configs="dsp"

# virtual_oss_dsp="-T /dev/sndstat -C 2 -c 2 -S -i 8 -r 48000 -b 24 -s 8.0ms -f /dev/dsp3 -d dsp -t dsp.ctl"

# from Goran Mekac
# virtual_oss_configs="dsp dummy9"
# virtual_oss_dsp="-T /dev/sndstat -S -i 8 -C 18 -c 18 -r 48000 -b 32 -s 768 -f /dev/dsp0 -c 2 -w dsp.wav -d dsp -t dsp.ctl"
# virtual_oss_dummy9="-T /dev/sndstat -S -i 8 -C 2 -c 2 -r 48000 -b 32 -s

virtual_oss_dsp="\
 -T /dev/sndstat \
  -S \
  -i 8 \
  -C 2 -c 2 \
  -r 48000 \
  -b 24 \
  -s 8.0ms \
  -f /dev/dsp0 \
  -c 2 \
  -O /dev/dsp3 \
  -R /dev/dsp3 \
  -d dsp \
  -t dsp.ctl"

sndiod_enable="YES"
wlans_rtwn0="wlan1"
ifconfig_wlan1="WPA DHCP"

fred@fred-T440pc /u/h/fred> 

fred@fred-T440pc /u/h/fred> set virtual_oss_dummy9="-T /dev/sndstat -S -i 8 -C 2 -c 2 -r 48000 -b 32 -s 8.0ms -f /dev/dsp0 -d dsp -t dsp.ctl"

fish: Unsupported use of '='. In fish, please use 'set virtual_oss_dummy9 "-T /dev/sndstat -S -i 8 -C 2 -c 2 -r 48000 -b 32 -s 8.0ms -f /dev/dsp0 -d dsp -t dsp.ctl"'.


fred@fred-T440pc /u/h/fred [123]> sysctl dev.hdac.0.polling=1

dev.hdac.0.polling: 0

sysctl: dev.hdac.0.polling=1: Operation not permitted

fred@fred-T440pc /u/h/fred [1]> sudo sysctl dev.hdac.0.polling=1

Password:

dev.hdac.0.polling: 0 -> 1

fred@fred-T440pc /u/h/fred [124]> ls *.mp3

file_example_MP3_700KB.mp3

fred@fred-T440pc /u/h/fred> ls *.mp3

file_example_MP3_700KB.mp3

fred@fred-T440pc /u/h/fred> mpg123 file*.mp3

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.32.5; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes

Terminal control enabled, press 'h' for listing of keys and functions.
Playing MPEG stream 1 of 1: file_example_MP3_700KB.mp3 ...

MPEG 1.0 L III vbr 44100 j-s
Year:    2018

[src/libout123/libout123.c:out123_play():745] error: Error in writing audio, wrote only 4152 of 4608 (No error: 0?)!

[0:00] Decoding of file_example_MP3_700KB.mp3 finished.

fred@fred-T440pc /u/h/fred> kldload sound

kldload: can't load sound: Operation not permitted

https://www.youtube.com/watch?v=QGF2FJbiJ7A   Hans Peter Selasky 2010 USB protocol talk
https://bsdtalk.blogspot.com/2023/08/bsdtalk267-interview-with-hans-petter.html  Created from a 2008 recording that Michael Dexter had made.

URLs I used for learning about Virtual_OSS.    Thank you  H. Peter Selasky for creating Virtual_OSS.

Petre H. Selasky lost his life in June 2023 in a car accident.   Let us remember him, and use his Virtual_OSS to create and enjoy sounds in life with our computers.du

https://www.badland.io/freebsd-usb-headphones.md  This is web article that fixed the problem for me.   Just one line ( a magic incantation only known by BSD gurus)!
Must have all other items previously setup.

fred@fred-T440pc /u/h/fred [64]> cat /dev/sndstat
Installed devices:
pcm0: <Intel Haswell (HDMI/DP 8ch)> (play)
pcm1: <Realtek ALC292 (Analog 2.0+HP/2.0)> (play/rec) default
pcm2: <Realtek ALC292 (Internal Analog Mic)> (rec)
Installed devices from userspace:
dsp: <Virtual OSS> (play/rec)
fred@fred-T440pc /u/h/fred>
fred@fred-T440pc /u/h/fred> virtual_oss_cmd /dev/dsp.ctl -f /dev/dsp1
fred@fred-T440pc /u/h/fred>

pkg install mpg123       or use software-station  to  install mpg123 
fred@fred-T440pc /u/h/fred> mpg123 file*.mp3

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.32.5; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes

Terminal control enabled, press 'h' for listing of keys and functions.
Playing MPEG stream 1 of 1: file_example_MP3_700KB.mp3 ...

MPEG 1.0 L III vbr 44100 j-s
Year: 2018
[0:42] Decoding of file_example_MP3_700KB.mp3 finished.

 

Robonuggie FreeBSD Sound Video  https://www.youtube.com/watch?v=FY9FxEzUq64&t=10s

 Raspberry Pi 4B FreeBSD file  /boot/loader.conf


fred@Ghost14-selfbuilt-rpi4B-nginx-tst1:~ % cat /boot/loader.conf
kern.vty=vt
# Configure USB OTG; see usb_template(4).
# hw.usb.template=3
umodem_load="YES"
# Multiple console (serial+efi gop) enabled.
boot_multicons="YES"
boot_serial="YES"
# Disable the beastie menu and color
#beastie_disable="YES"
loader_color="NO"
security.bsd.allow_destructive_dtrace=0
kern.geom.label.disk_ident.enable=0
kern.geom.label.gptid.enable=0
# cryptodev_load="YES"
cryptodev_load="NO"
zfs_load="YES"
vfs.zfs.debug=0
# vfs.root.mountfrom="zfs:zroot/ROOT/default"
# vfs.root.mountfrom="zfs:arm64pool/ROOT/default"
vfs.root.mountfrom="zfs:arm64pool/ROOT/default"
kldload_list+="cuse snd_uaudio"
snd_uaudio_load="YES"





 Raspberry Pi 4B FreeBSD file  /etc/rc.conf 

#AUDIO
sound_load="YES"
snd_uaudio_load="YES"

Comments

Popular posts from this blog

FreeBSD 14.0 Compiling kernel for Raspberry Pi 4B

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.