This repo holds code that has been originally developped for the event Les Digitales, La Chaux-de-Fonds, August 20th 2017. The idea is to play sounds from a Raspberry Pi based on a distance it measures with an ultrasound distance probe.
All the code is python based, relying on FluidSynth to generate and play sounds.
More instructions on the assembly to come...
The ultrasound probe was wired as explained on this webpage, using two resistors as a dividing bridge to measure the output voltage.
You need to install FluidSynth on the raspberry, and install the Python wrappers.
sudo apt-get install python-pip fluidsynth alsa
pip install fluidsynth
In order to start the project, just run (assuming you have the code in a folder called circleSound)
cd circleSound
./circleSound.py
There is a text file called config.txt that you may modify, to run different parameters :
- dist_max : the maximal measured distance
- dist_min : the minimal distance. When something is placed in front of the sensor at a lower distance than dist_min, it will change the played instrument.
- note_min : the lowest played note watch out, this HAS to be between [0-127]
- note_max : the highest played note watch out, this HAS to be between [0-127]
- bins_number : discretization of the measured space. If bins_number = 2, there will be 2 different notes played.
- instrument : the first played instrument.
- The project originated from the FabLab in Neuchatel
- This project was inspired by A.Grove's project Ultrasonic Pi Piano.
- A big shout out to the creators and maintainers of FluidSynth
LGPL Licensed, see license file.