How do I connect proximity data from an ultrasonic sensor to audio playback volume in python on a Raspberry Pi?

31 views Asked by At

I'm pretty new to coding, but through a combination of fumbling, bumbling, online tutorials, and guides I've managed to successfully get distance data from an ultrasonic sensor (reference here). Now I am trying to take that information and translate it so that the closer someone is to the sensor the louder a tone is, not disimilar to a theramin just without pitch.

Any guidance or ideas are welcome!

I followed this tutorial here for the code portion. I've gotten some simple media playback through commands as well but honestly I'm not sure where to even start with the volume control for the playback. An issue that I have with this code is that there will be occassional spikes in value from the distance sensor. So it will read 20cm, 20cm, 50cm, 15cm, 15cm.

Thanks in advance

0

There are 0 answers