[Bluetooth-audio] How to connect and use Bluetooth headphones on FreeBSD

I am using oss for firefox and I enabled sndio
I followed the instructions but ran these
  1. hccontrol -n ubt0hci create_onnection BT_ADDR
  2. virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/BT_ADDR -d dsp
My Bluetooth speaker works, when i quit the virtual_oss and disconnect bluetooth, The sound does not work for my pc speaker any more. How can i reroute the sound to system default ?
mixer -a
pcm0:mixer: <Sigmatel CXD9872RD/K (Analog)> on hdaa0 (play/rec) (default)
vol = 1.00:1.00 pbk
pcm = 1.00:1.00 pbk
speaker = 1.00:1.00 pbk
mic = 0.00:0.00 rec
rec = 1.00:1.00 pbk
monitor = 1.00:1.00 rec src
pcm1:mixer: <Sigmatel CXD9872RD/K (Left Analog Headphones)> on hdaa0 (play)
vol = 1.00:1.00 pbk
pcm = 1.00:1.00 pbk
Thank you so much
 
I am using oss for firefox and I enabled sndio
I followed the instructions but ran these
  1. hccontrol -n ubt0hci create_onnection BT_ADDR
  2. virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/BT_ADDR -d dsp
My Bluetooth speaker works, when i quit the virtual_oss and disconnect bluetooth, The sound does not work for my pc speaker any more. How can i reroute the sound to system default ?

Thank you so much
Does it work for some application or you don't have sound at all? Usually you need to restart / reload the application. For example Audacious (audio player) needs just Stop + Play to use different sound device. Some applications need full restart and in some cases you need to restart sndio or Pulseaudio if it is in use.
 
Does it work for some application or you don't have sound at all? Usually you need to restart / reload the application. For example Audacious (audio player) needs just Stop + Play to use different sound device. Some applications need full restart and in some cases you need to restart sndio or Pulseaudio if it is in use.
I do not have sound at all. I restart all the apps. I did not install pulseaudio, I restart sndio. Mpv showed error message error opening /dev/dsp no sound
Thanks
 
I'm doing it by setting
Code:
sysctl hw.snd.basename_clone=1
after disabling bluetooth and hcsecs daemons. Here is my Bluetooth script: https://github.com/thindil/blues/blob/trunk/blues.sh#L86
It works by using sysctl hw.snd.basename_clone=1
Thank you so much.
I am new to FreeBSD. Tried it few years ago on old laptop Sony sz330p.
Just installed 14.0 release last week. I am switching all my workflow to FreeBSD from void Linux.

It is almost perfect. The system default is minimal and light on the resource.
It revives old PC. I could use most of same apps and tools from Linux.

Just missing docker support. Just lacking some WiFi and new hardware support like new video card.
As a complete OS, FreeBSD is consistent and more organized. Linux is a mess.
 
It works by using sysctl hw.snd.basename_clone=1
Thank you so much.
I'm just going to ask you if setting up `sysctl hw.snd.basename_clone=1` would help. I'm glad it works for you! :)
Bluetooth sound on FreeBSD is still not user friendly. But once you get it working, you don't have to touch it for years.
I have BT speaker as my main sound device for a desktop with a small shell script running as root on boot to automatically connect to it and do all the required work. I just power up BT speaker, boot FreeBSD with KDE and the sound is on.
 
I'm just going to ask you if setting up `sysctl hw.snd.basename_clone=1` would help. I'm glad it works for you! :)
Bluetooth sound on FreeBSD is still not user friendly. But once you get it working, you don't have to touch it for years.
I have BT speaker as my main sound device for a desktop with a small shell script running as root on boot to automatically connect to it and do all the required work. I just power up BT speaker, boot FreeBSD with KDE and the sound is on.
Thank you so much for your help. Yeah, everything with bsd is organized and consistent, You setup one time and last for decades. :)
 
virtual_oss -T option got removed
this is no longer working
video do not play, youtube or even avi files
It happens if the output device isn't available (or not exists).
my working config line:

Code:
virtual_oss_enable="YES"
virtual_oss_configs="blued"
virtual_oss_blued="-S -C 2 -c 2 -r 48000 -b 16 -a o,-6 -s 10ms -R /dev/null -P /dev/bluetooth/headphones -d dsp -t vdsp.ctl"
Works fine, i just can't control the volume at all, neither with virtual_oss_cmd :(
My only option is to change the amplification (-a o,-6) then adjust the volume in the current player.
 
I have got this to work with AVSL (https://avsl.com) av:link soundshots mini-speakers and a thinkpad X201 which has an intel centrino 6300-N wifi bluetooth adapter. Sadly these little speakers are no longer made but they can still be found for sale online.

initial setup was:-

pkg install iwmbt-firmware virtual_oss
service devd restart
kldload cuse
sysrc kld_list+="cuse"

and in /etc/bluetooth/hosts make an alias 'soundshots' to the BDADDR for the speakers.

Then I run the following commands in a script.
service hcsecd onestart
service bluetooth start ubt0 # it always fails the first time it's run
service bluetooth start ubt0
hccontrol -n ubt0hci create_connection soundshots
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/soundshots -d dsp &

... which connects to the speakers and hooks them up to freebsd's oss sound system.

The two speakers operate as a true stereo pair. Sound quality is surprisingly good for such small speakers, of course the bass is limited in this form factor. I find placing them on two windowsills or a long table helps. Both mpv and mpd play in stereo, and mpv streams movies with stereo audio over these speakers. I haven't fudged around trying to get firefox to play through them yet, maybe later. The sound plays clear, smoothly and stable with no stuttering.

It would be nice if there was a way to put the commands into rc.conf to be run automatically at startup.
 
I have tried out many configurations, the winner was kind of weird.
Had to create a main device, and 1-1 for the speakers and bt devices... then I "route" them "on-the-fly" with a shell script (from dwmblocks :D )

Also have to mention btavctpd, this was the only way for me to get volume/media control via my airpods, it works like a charm.
 
Back
Top