How I did the transfer of sound on the Raspberry Pi


I recently needed the transfer of sound to the audio system through the raspberry, I want to share my experience in tuning.

Step 0. Preparation

We need:

  • Straight arms;
  • Raspberry Pi (If you buy the necessary Raspberry Pi without wi-fi or bluetooth);
  • 5V 2A charger to power the Raspberry Pi;
  • SD card at 8GB minimum.

Step 1. Installation

1. Go to the download section on the raspberry website and download Raspbian (Not Lite)

2. Unpack the archive

3. Format the SD card:

  • Delete all partitions (Mac - Disk Utility, Windows - Create and Format, Linux - gparted);
  • Create 1 primary partition.

4.1 Write to USB flash drive (Windows):

  • Download program Win32DiskImager ;
  • Open the Raspbian image in Win32DiskImager;
  • Select the letter of the carrier;
  • Click Write.

4.2 Write to USB flash drive (Mac / Linux):

  • Download Etcher ;
  • Open the image of Raspbian in Etcher;
  • Choose a carrier;
  • Click Flash.

5. We take out and insert the SD card into the computer and open a single partition (it should be called BOOT). Create an ssh file there.

6. Insert the SD card into the Raspberry Pi

Step 2. Setup

1. Find out the IP address of our Raspberry Pi

2. Connect to it via SSH. I prefer PuTTY

3. Log in, login: pi, password: raspberry

4. Write this to the console

sudo apt-get upgrade
sudo apt-get install bluez pulseaudio-module-bluetooth python-gobject python-gobject-2 bluez-tools
sudo usermod -a -G lp имяпользователя(если не меняли - pi)

5. Registering this

sudo nano /etc/bluetooth/audio.conf

and get into a text editor. Under the caption [General] add this


Press Ctrl + O, Ctrl + X.

6. Further we register:

sudo nano /etc/pulse/daemon.conf

here we are looking for the string “resample-method = speex-float-3”. If not at the beginning of this line; - add it.

After that we enter

 resample-method = trivial

Again we poke Ctrl + O Ctrl + X

7. And again we register:

sudo nano /etc/bluetooth/main.conf

Here we can change the device name to any other by editing the string "Name" if before this line there is # we remove it and edit the name we want, it should look something like this " Name=ТутИмяНаАнглийском".

Next, we are looking for the string " Class" and if it is in front of # we remove, we do to make it like this


8. Autostart

1. Create an OnBluetooth file (sudo nano /etc/init.d/OnBluetooth) in /etc/init.d/. In his
write this:

#Start systemctl service
sudo systemctl start bluetooth
sleep 1
#Start bluetoothctl with discoverable and pairable optionsecho -e 'power on\ndiscoverable on\npairable on \t \nquit' | bluetoothctl

2. Write to Konosl

 chmod 755 /etc/init.d/OnBluetooth

3. Write to console

 update-rc.d OnBluetooth enable

9. Choose where the audio will be displayed. To do this, we register sudo raspi-config, go to Advanced on Sound and choose what we need. After that click finish. Done!

Step 3. Connection

The bluetooth connection is working right away, now it’s time to set up an internet connection.

For Windows:

Download and unpack the archive in a convenient place for us
● Edit the audio.bat file:

  1. Your_IP change to your raspberry ip
  2. UserName change to login from raspberry pi
  3. Password change to password from login raspberry pi

● Run

Step 4. Verification.

  • Turn on Raspberry PI
  • We connect our audio system or headphones to the port that we selected in the raspi-config.
  • Turn on bluetooth on your phone or open a file on your computer
  • Turn on the music
  • Rejoice


I hope that at least someone this article was useful. Thanks for attention.

Also popular now: