A music player for toddlers
The simplest user interface. Just press a button to listen a song.
- Raspberry PI 1 B+ (v1.2)
- Speakers USB powered
- Powerbank with 2 outputs
- Buttons with Leds (11)
- Resistors 330 (11)
- Box
- DietPi for armv6l
- MPD
- Toddler Music Player
OS Config
systemctl disable dietpi-postboot # fast boot
Packages
apt install build-essential python-dev python3.9-dev python-pip python3-pip
apt install vim git mpd mpc # nothing works without vim
apt install openssh-sftp-server # for trasnfering songs
export CFLAGS=-fcommon;
pip3 install RPi.GPIO # python access gpio pins
Test
alsamixer
speaker-test
aplay aplay /var/lib/mpd/music/Dj_Goja_-_Cause_Im_Crazy.mp3
Install
apt install mpd
Configure
๐พ
/etc/mpd.conf
music_directory "/var/lib/mpd/music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
user "mpd"
bind_to_address "localhost"
input {
plugin "curl"
}
decoder {
plugin "hybrid_dsd"
enabled "no"
}
decoder {
plugin "wildmidi"
enabled "no"
#config_file "/etc/timidity/timidity.cfg"
}
audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0"
mixer_control "Headphone"
}
filesystem_charset "UTF-8"
ixer_control "Headphone"
}
Enable
systemctl status mpd
systemctl start mpd
systemctl enable mpd
Test MPD
# create playlist
ls -1 /var/lib/mpd/music/*.mp3 > /var/lib/mpd/playlists/main.m3u
# test playlist
mpc load main
mpc play
Install
git clone https://github.com/vaidis/Toddler-Music-Player.git
mkdir /opt/tmplayer
cp Toddler-Music-Player/tmplayer.py /opt/tmplayer.py
chmod +x /opt/tmplayer.py
Startup
๐พ
/etc/systemd/system/tmplayer.service
[Unit]
Description=TMPlayer
ConditionPathExists=/opt/tmplayer.py
[Service]
Type=forking
ExecStart=/opt/tmplayer.py
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
EOF
Enable
systemctl daemon-reload
systemctl status tmplayer
systemctl start tmplayer
systemctl enable tmplayer