I’ve gotten myself Bluetooth Headphones and a USB Bluetooth dongles, and I want to hear sounds through my new headphones.
Since the headphones are a Bluetooth device, they should be discovered and paired. In the famous manual, FreeBSD Handbook , there are two sections in which to find instructions on Bluetooth and sound:
- 33.5 Bluetooth – in chapter 33 – Advanced Networking.
There is also a useful utility named bluetooth-config you can use to create or modify the files ‘/etc/bluetooth/hcsecd.conf.; and ‘/etc/bluetooth/hosts‘
- 8.2.3. Setting up Bluetooth Sound Devices – in chapter 8 – Multimedia
Having configured Bluetooth and installed virtual_oss. All you have to do each time you want to listen through your Bluetooth headphones is to run the following commands replacing BT_ADDR by your device name:
- hccontrol -n ubt0hci create_onnection BT_ADDR
- virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/BT_ADDR -d dsp
Now, if you use VLC to listen to audio, all you have to do is select the ‘dsp’ output device. But, if you want to hear the sounds plyed by Firefox, you should have to add a module to PulseAudio. I haven’t found any Bluetooth modules I can install on my FreeBSD, but have found that module-sndio can do the job for me,, to add it, run the command:
pkg install pulseaudio-module-sndio
And add the following line to ‘/usr/local/etc/pulse/default.pa‘
load-module module-sndio device=snd/0
To start the service sndio at boot time, add the following line to ‘/etc/rc.conf‘:
To hear sounds from the Firefox browser, make sure PulseAudio stream it to ‘/snd/0‘ My display manager is XFCE4, and I use the plugin ‘xfce4-pulseaudio-plugin’ to view my output devices. In the following image, you can see that firefox sounds are streamed to that device:
Now, if everythiing is set correctly, but you cannot hear the sound, type the follwing shell command as a regular user: