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.mp3and21804289.mp3in$PWD/tunes)- macOS:
npm test - other:
KEYBOARD_DEVICE=<path to a stream of events> node main.js(requiresplayin path, with an API likeplay -v 0.2 music.mp3) - To see it running without actual events, set
KEYBOARD_DEVICEtosample-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.mp3and21804289.mp3in$PWD/tunes. You'll also need an executable in your path calledplaywhich can be called likeplay -v 0.2 music.mp3.afplayworks for macOS. A shim is available in the projectbindirectory, so a command likePATH=$PATH:bin KEYBOARD_DEVICE=sample-data.bin node main.jsshould work.
- WORKAROUND: Before testing place
- macOS:
npm run build && npm run deploy(FIXME: server ssh host is not configurable 😬)- deploy script depends on a
systemdservice 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.