better than v1, that's for sure!
ai "enhanced" instructions below
A headless MP3 player for Raspberry Pi with Bluetooth headphone control
- Raspberry Pi OS (Debian-based)
- Bluetooth headphones (tested with SIMOLIO)
- Basic terminal knowledge
cd /home/pi
git clone https://github.com/tails1154/tailsmusicv2 mp3player
cd mp3player
(Optional: Symlink instead of renaming)
ln -s /home/pi/tailsmusicv2 /home/pi/mp3player
-
Find your headphones’ MAC address:
sudo bluetoothctl scan le
- Note the MAC address (e.g.,
AA:BB:CC:DD:EE:FF
).
- Note the MAC address (e.g.,
-
Pair and trust the device:
sudo bluetoothctl pair AA:BB:CC:DD:EE:FF sudo bluetoothctl trust AA:BB:CC:DD:EE:FF
sudo apt update
sudo apt install -y pulseaudio pulseaudio-module-bluetooth espeak-ng evtest python3-evdev
-
Restart PulseAudio:
pulseaudio --kill && pulseaudio --start
-
Find your Bluetooth sink:
pactl list short sinks
- Note the
bluez_sink.XX_XX_XX_XX_XX_XX
address.
- Note the
-
Update
bashrc
in the repo:- Replace all
bluez_sink.XX_XX_XX_XX_XX_XX
references with your sink. - Update the
bluetoothctl connect
command with your headphones’ MAC.
- Replace all
-
Apply the new
bashrc
:cp ~/.bashrc ~/.bashrc.bak # Backup cp bashrc ~/.bashrc # Overwrite
-
Identify your headphone buttons:
sudo evtest
- Select your headphones from the list.
- Press buttons (Play/Pause, Next, etc.) and note the
(KEY_XXX)
codes (e.g.,KEY_PLAYCD
,KEY_NEXTSONG
).
-
Update
config.json
:- Replace the codes with the ones you noted down.
- Replace the "evtestname" field with the name of the device you selected in evtest. (example name below)
Example name:
$ evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Dell KB216 Wired Keyboard
/dev/input/event1: etc
/dev/input/event2: vc4-hdmi
/dev/input/event5: SIMOLIO (AVRCP)
^
| This is our bluetooth headphones. Yours will be different.
The config file checks if that json text is INCLUDED in the device name, so instead of putting SIMOLIO (AVRCP)
, I put just SIMOLIO
mkdir -p /home/pi/mp3player/songs
mkdir -p /home/pi/mp3player/playlists
- Place MP3 files in
songs/
. - Playlists are auto-generated or manually created via the script.
Your system should auto start tailsmusic when you log in (after a short delay)
-
Bluetooth not connecting?
Runbluetoothctl
and ensure the device is paired/trusted:connect AA:BB:CC:DD:EE:FF
-
No sound?
Check PulseAudio sinks:pacmd list-sinks | grep -e 'name:' -e 'index'
-
Buttons not working?
Double-checkevtest
codes and updateconfig.json
.
Your TailsMusic should now:
✅ Auto-connect to Bluetooth headphones.
✅ Respond to media buttons.
✅ Announce actions via eSpeak.
Button | Action |
---|---|
OK / OK2 | Play/Pause toggle |
Skip | Next track |
Back | Previous track |
Skip (when paused) | Open shutdown menu |
Back (when paused) | Speak current date and time |
- Button names (“okbutton”, “okbutton2”, “skipbutton”, “backbutton”) are mapped in your
config.json
and may correspond to your headphone/media controls.
Navigating: Use Back/Skip to move, OK/OK2 to select.
Option | Functionality |
---|---|
Playlists | Enter playlist management |
Random Song | Play a random track |
Update TailsMusic | Pull latest code updates and reload the app |
Manual Text to Speech | Compose a custom TTS message using the buttons |
Rescan Songs | Reload the music library |
Connect to WiFi | Configure WiFi connection (choose network, enter password with button navigation) |
Get local IP | Announce current local IP address |
Open App | List and launch .py apps from the apps/ directory |
Shut Down | Power off the system |
Back | Return to playback |
- Create: Make a new playlist
- [Playlist Name]: Manage an existing playlist
- Back: Return to shutdown menu
Option | Functionality |
---|---|
Play | Play all songs in playlist. Use Skip/Back to go to next/previous song in playlist. |
Delete | Remove playlist (requires confirmation via Skip/Back) |
Back | Return to playlist list |
- Skip: Next song in playlist
- Back: Previous song in playlist
- Select Add song
- Browse songs with Back/OK/OK2 (OK/OK2 moves up, Back moves down)
- Press Skip to add song to playlist
- Choose Finish (via Skip) to save playlist
- Select network with Back/OK/OK2 buttons
- Press Skip to choose
- Enter password using character selector:
- Navigate characters with Back/OK/OK2
- Select character with Skip
- space: Add space
- Done: Confirm and connect
Notes:
- Button assignments can be customized in
config.json
. - Long presses are not used; actions change depending on whether playback is paused or active.
- All menus, playlists, and WiFi setup are accessible/controllable via the defined buttons; no keyboard or mouse is required.