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:
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:
- Connect your Bluetooth device to the Raspberry Pi
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.
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.
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).