BaReinhard / a2dp_bluetooth

Bluetooth Repo to setup your Raspberry Pi (Jessie) to connect to Bluetooth Speakers/Headset
GNU General Public License v3.0
27 stars 5 forks source link

I cannot hear any sound from my bluetooth speaker. #2

Closed searock closed 6 years ago

searock commented 6 years ago

I have downloaded Raspbian Jessie and I am able to connect to my bluetooth speaker, thanks for your efforts. I tried all 3 OS of raspberry pi and none of it worked before.

But I am not able to hear any audio when I play wav files using omxplayer. Am I missing some of the settings?

BaReinhard commented 6 years ago

The piece missing is how you play the music, what is it set to output to? I’ve used aplay and output to the alsa pulse plugin, from there I have been able to move the pulseaudio sink to the new bt device.

What is the output of the following:

sudo pactl list sinks

BaReinhard commented 6 years ago

I have found that omxplayer plays directly to hardware so it won’t work with pulseaudio, something like aplay should work for wav files though.

I can’t remember exactly the command but something like

sudo aplay -D pulse /file/path.wav

in the event that that doesn't work what you can do is make an adjustment or ensure the ~/.asoundrc file looks as follows

# .asoundrc file

pcm.!default{
    type pulse
}
ctl.!default{
   type pulse
}

Then simply run the command

sudo aplay /path/to/file.wav&

Then, move the input to the output via

sudo pactl move-sink-input `sudo pactl list sink-inputs | grep "Sink Input" | sed "s/Sink Input #//"` SINK_NUM

where SINK_NUM is the bluetooth device found via sudo pactl list sinks

EDIT:

For sudo aplay -D pulse /file.wav to work you need to ensure you have a PCM device named pulse

they should look as follows:

# ~/.asoundrc

pcm.pulse{
    type pulse
}
ctl.pulse{
    type pulse
}
searock commented 6 years ago

Thanks for your quick reply. I am able to play audio on the bluetooth speaker.

BaReinhard commented 6 years ago

Awesome, glad it works!