3

I have Raspian Wheezy running on my Raspberry Pi. I have set it up to run pifmplay and output the sound to HDMI - (Pin 4 on GPIO) so that the Pi is now working as an FM Transmitter. This part works fine and I can play sound that is stored on the SD card out to my radio using the following commands:

sudo sh /home/pi/pifmplay/pifmplay "/home/pi/music" 91.3

I tried the taking the next step and adding a bluetooth dongle following this process here:

http://www.instructables.com/id/Raspberry-Pi-Wireless-Bluetooth-Audio-FM-Radio-Tra/?ALLSTEPS

Bluetooth is working and I can connect my iPhone to the Pi. When I play music on the iPhone it doesn't play through the speakers on the iPhone but seems to transmit to the HDMI port and comes out through my monitor speakers.

Even though I have directed the output with the following command to the HDMI output:

amixer cset numid=3 2

It plays through the HDMI cable rather than the GPIO pin 4 as it did when playing directly using pifmplay command above.

Updating the question with the following steps and commands:

  1. Connect your Bluetooth device to the Raspberry Pi
  2. Run:

pactl list sources short

2a. It will output something like the following:

0 alsa_output.platform-bcm2835_AUD0.0.analog-stereo.monitor module-alsa-card.c s16le 2ch 44100Hz RUNNING 1 bluez_source.XX_XX_XX_XX_XX_XX module-bluetooth-device.c s16le 2ch 44100Hz RUNNING

2b. The bit I'm interested in is in bold italics and this is the bluetooth input source - in my case it is an iPhone 5s.

  1. Run:

pactl list sinks short

3a. It will output something like the following:

0 alsa_output.platform-bcm2835_AUD0.0.analog-stereo module-alsa-card.c s16le 2ch 44100Hz RUNNING

3b. The bit I'm interested in is in bold and italics above.

  1. Run:

pactl load-module module-loopback source=bluez_source.XX_XX_XX_XX_XX_XX sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo

4a. This links my bluetooth input to the audio output.

There are two problems. The audio quality is terrible - sounds like it is under water and there is stuttering because there seems to be a lag.

Any way to improve audio quality output?

How can I set the Pi up to run the above automatically when it boots up so because the audio bluetooth source won't exist at that point? (I want to use this in my car so it will be headless).

  • 1
    according to the github page for pifmplay this should not work (yet) "Things I would like to see pifmplay do in the future:Redirect all sound output to pifmplay (redirect all alsa sound output)." – rob Jan 29 '15 at 11:54
  • @rob Seems that I need to redirect the bluetooth audio input stream to the correct hdmi output stream but I don't know how to do that. It seems to work for other people on the link above. – motionpotion Jan 29 '15 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.