Kids can play their favorite music or learn using advanced talking flash cards. This service (plus a few goodies) turns your linux device into a toddler DJ station.
- Run
bin/yt-import <youtube url> <keycard id>
to download a youtube video, convert it to MP3 and copy it to the Tot Tunes device for playback. - Swipe your new music card.
- Enjoy your Tot Tunes!
npm install
- testing (requires
13012062.mp3
and21804289.mp3
in$PWD/tunes
)- macOS:
npm test
- other:
KEYBOARD_DEVICE=<path to a stream of events> node main.js
(requiresplay
in path, with an API likeplay -v 0.2 music.mp3
) - To see it running without actual events, set
KEYBOARD_DEVICE
tosample-data.bin
. (KEYBOARD_DEVICE=sample-data.bin node main.js
) - FIXME: Since audio playing was added, the instructions above are broken.
- WORKAROUND: Before testing place
13012062.mp3
and21804289.mp3
in$PWD/tunes
. You'll also need an executable in your path calledplay
which can be called likeplay -v 0.2 music.mp3
.afplay
works for macOS. A shim is available in the projectbin
directory, so a command likePATH=$PATH:bin KEYBOARD_DEVICE=sample-data.bin node main.js
should work.
- WORKAROUND: Before testing place
- macOS:
npm run build && npm run deploy
(FIXME: server ssh host is not configurable 😬)- deploy script depends on a
systemd
service calledtot-tunes.service
- deploy script depends on a
$ cat /etc/systemd/system/tot-tunes.service
[Unit]
Description=Tot Tunes
[Service]
User=pi
ExecStart=/usr/local/bin/tot-tunes
Type=simple
Restart=always
[Install]
WantedBy=multi-user.target
$ cat /home/pi/tot-tunes
#!/bin/sh
KEYBOARD_DEVICE=/dev/input/by-id/usb-Sycreader_USB_Reader_08FF20150112-event-kbd
TUNES_DIRECTORY=/home/pi/tunes
/home/pi/tot-tunes
In this example the tot-tunes
binary is located at /home/pi/tot-tunes
.
OS | Install Command |
---|---|
Raspbian | apt-get install sox libsox-fmt-mp3 |
To get the USB speaker working, I had to do quite a bit of digging. The winning combination seems to be configuring ALSA to use the usb audio interface by default and using the SoX player.