I am creating a web controlled soundboard for halloween and will be sharing my progress here.
Show more @iayanpahwa
The idea: is to load multiple spooky sound effects like ghost voices, door creaking etc and play it over a webpage locally hosted or in a loop
Hardware selection: since I want this to be easily fitted in halloween decoration props I’m going with a raspberry pi zero w, surprisingly it’s bit powerful successor was launched a couple of days back, but I still don’t have it yet.
Since pi0 doesn’t have an audio out on-board i’ve picked up a pimoroni pirate audio line-out pHAT, so I can use any small speaker with aux support to play the sound effects. entire package is quite handy and can be fitted easily to halloween props for decorations.
For the software side I’ll be using python] with flask for the web framework exposing an API to play audio .mp3 files. to play audio I’ll be using gstreamer. Everything’s runs on balena OS and managed via balena cloud dashboard.
the good thing is there is an audio block which I can easily use to route audio in this project without having to configure alsa and pulseaudio which can be pain sometimes, so let’s not re-invent the wheel when we can reuse
talking about blocks, I’m also gonna add wifi-connect block which will make rpi behave as a hotspot in case it doesn’t connect to an access point automatically so you can manually configure the wifi, ease much?
to get the audio working, it took me some time to figure out how to add support for hifiberry DAC but it was quite straightforward from the docs, also had to add ENV variable to establish connection with the pulseaudio server running inside audio block. More details on same here
also got the display working, it’s 1.3" LCD, based on ST7789 driver and has a python library with example to use it, BUT when display is operational the sound is not working, gotta debug the hardware conflict, could it be shared pins b/w SPI for display and i2s for DAC?
okay so the backlight control pin was the culprit, an easy fix- start the display container first, display an image then kill the display container which will do the clean-up and then start the web-server, have to stay satisfied with one photo on the display over dynamic changes
made this simple webpage with couple of buttons for audio control,
ps: this is all the web dev I know , it uses python3-flask to expose an API for PLAYING sound on linux using streamer …
here’s the code repo → https://github.com/iayanpahwa/halloween-sound-board
the case won’t fit but it was a fun project altogether. Watch showcase during last IoT happy hour here