Problems with Bluetooth Audio on Rpi4

I have connected a Bluetooth speaker, Woxter DL-410 BT, to my new Raspberry Pi 4 8GB with OSMC.
I have had no problems pairing and connecting (BT in board, not dongle), both with Kodi and with the ‘bluetoothctl’ command.
The failures begin when trying with a music playlist, with mp3, aac, flac files.
The strange thing is that depending on the Player used, the failure is different:

mplayer: for a few minutes it goes well, after a while I have the sound choppy, more and more and there is even distortion
Music on Kodi: Same as with mplayer.
cmus and mpg321: sound remains stable, at least for a few hours, but songs play sped up,
at a speed approximately x1.1, x1.2

All these players work correctly if the output is via HDMI or even 3.5mm Jack.
Nor have I ever had problems with Woxter speakers with bluetooth sound with devices such as phones or tablets or laptops.

~/.asoundrc:

pcm.altavocesBT {
        type bluealsa
        device "08:EB:ED:08:5B:7C"
        profile "a2dp"
        hint { show on description "Woxter DL-410 BT"}
}

Does it depend on the samplerate? Try setting audio output to fixed with samplerate 48k.

1 Like

Yes, it depends on the sample rate. The vast majority of files the sample rate is 44.1k.
I’ve resampled some at 48K and they sound good.
Those with a sample rate greater than 48k do not play.
Audio output is set:

osmc@osmc:~$ bluealsa-aplay -L
bluealsa:SRV=org.bluealsa,DEV=08:EB:ED:08:5B:7C,PROFILE=a2dp
    Woxter DL-410 BT, trusted audio-card, playback
    A2DP (SBC): S16_LE 2 channels 48000 Hz

But I don’t know how this is changed. Or if in cmus there is an option asynchronous with the sampling rate.

On the other hand, I don’t understand why in mplayer there is no problem with the sample rate:

screen -dmSL musica -Logfile ~/.mplayer/mplayer.log mplayer -v -input file=/home/osmc/.mplayer/mplayerpipe -slave -ao alsa:device=altavocesBT -novideo -shuffle -loop 0 -quiet -playlist /home/osmc/ListaMusica.txt

If you want something that works with all players and all refreshrates, then an ALSA rate plugin should do it.

1 Like

With cmus it would be enough, I like it and from what I see it is more stable. But I don’t see any option to do the resampling.

dsp.alsa.device               altavocesBT
 dsp.ao.buffer_size            16384
 dsp.ao.device_interface
 dsp.ao.driver
 dsp.ao.wav_counter            1
 dsp.ao.wav_dir                /home/osmc
 dsp.jack.resampling_quality   2
 dsp.jack.server_name
 dsp.roar.role
 dsp.roar.server
...
 mixer.alsa.channel            PCM
 mixer.alsa.device             default
 mixer.pulse.restore_volume    1
...
 output_plugin                 alsa
 ...
 softvol                       true
 softvol_state                 100 100

I finally fixed the problem by modifying the .asoundrc file to do a 48k resampling.

osmc@osmc:~$ cat ~/.asoundrc
pcm.altavocesBT
{
        type plug
        slave
        {
                pcm
                {
                        type bluealsa
                        device 08:EB:ED:08:5B:7C
                        profile "a2dp"
                        hint
                        {
                                show on
                                description "Woxter DL-410 BT"
                        }
                }
                format S16_LE
                rate 48000
        }
}
1 Like