Skip to content
Python code to generate sound on a Raspberry, using a distance-probe to generate the sound
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Circle Sound

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...

Wire the ultrasound probe

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

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.



LGPL Licensed, see license file.

You can’t perform that action at this time.