How to change sound using distance sensor - audio

I'm trying a project to simulate a brass trombone. The materials I'm using are a Seeed Studio Ultrasonic distance sensor, Raspberry Pi, and an Arduino. I'm going to connect the sensor to the Arduino, and the Arduino to the Raspberry Pi.
I'm looking to have the Raspberry Pi play one steady sound out of the audio jack. As the distance between my hand and the sensor get larger, the pitch of the emitted sound should get lower.
I'm not too familiar with using audio in programming, or too much of programming for that fact. Could someone help me write up some code (preferably in java or C#)? I'm very anxious to do this as I play trombone in school. Any help or suggestions are appreciated.

As not to recreate the brass trombone from scratch, use a Midi Synth on the Pi, such as TiMidity (apt-get install timidity) or alike. With this you can bridge between the Arduino's output and the note(s) sent to TiMidity to play out the Pi's speaker.

Related

Capture audio output from raspberry pi (for LEDs)

I have a Raspberry pi 4 and my goal is to connect it to some LEDs that will react to music that is playing through bluetooth (or AirPlay, ...). I've installed rpi audio receiver and so now I can stream music to it.
Now I need to write (or use some) code, that could parse what is being played to the audio output (via built-in 3.5mm jack), so the main question now is:
Is it better (or possible) to intercept the audio somewhere and analyse it with my own code, or does this require some deep modifications to the streaming program? Or do you know of a better solution that could point me to the right direction?
I saw a lot of people using an external mic, but the whole process is too different from mine.
Type of LED strip is not important right now, if I'm able to write my own code for it.
Thanks for any help!

Is it possible to stream video to raspberry pi from a webcam?

I am building a self driving car model using python(tensorflow). The architecture design of my project looks like the following. The CNN code will be in the raspberry pi, which is connected to a radio controller using wires from it's GPIO pins to send motion signals. The pi then controls the car. To "see" what's around it, the car uses a webcam that is mounted at the front center(this is the puzzle), which I wanted to stream the video to the pi; then the pi will use it's trained model(brain) to decide whether or not to move forward, make a left turn, a right turn and so on. The pi and rc radio controller are not mounted on the car, and I want them to remain that way for a reason. The car has the webcam and that is it. I am considering replacing the webcam with an android phone due to lack of alternatives, but I would hate to do that. If you would like more explanation on the structure of my project, please comment down there.
My question is how can I stream the video to my pi in real time?

Interface an ultrasonic sensor with Z-Wave

The task at hand is to integrate/interface an already existing ultrasonic sensor like this one to a Z-wave transceiver.
Here are the questions related to it:
Is it possible?
What all do I need for it? (Hardware + Software)
Are there any examples that i can follow?
If this sensor is Arduino compatible, you can have a look ar the Z-Uno project.
Their product is an Arduino compatible Z-Wave board, which you can program from Arduino IDE and use as a Z-Wave sensor/actor.

How to play MIDI input in Linux

I am sending serial data to my raspberry pi from my arduino then converting the serial data to MIDI using this program: link. Is there any program out there that will take the midi input from the converter program and send it out the pi's audio jack in real time?
I've been using fluidsynth as a softsynth. I haven't run any on the pi, though. There's also a lot of others like amsynth, hexter, xsynth-dssi etc and some of them might be more suitable than others.
You might try running apt-cache search with some suitable keywords and look for programs available on the pi.
TiMidity++ is a software MIDI sequencer and synthesizer that supports multiple audio and patch formats.

Arduino Piezo Knock Sensor Play Tones

I would like to hook up several piezos to an arduino so that, when they are activated each piezo plays/triggers a separate tone. For instance, I'll have five piezos connected to the arduino - when I apply pressure to each one they play a separate note, either through a software interface on a computer or from the piezos themselves. Basically an Arduino synth using piezos as keys.
I'm just not quite sure how to go about doing this. I'm sure its possible but just need a push in the right direction. Any ideas? Thanks!
The practical difficulty of using one device as both an input sensor and output device, is that once activated to output (a sound) you would have to disable using it as input for some fixed time. Something more responsive would be to use separate sensors for the keys, and just one speaker for all sounds. The good folks who came up the Arduino tutorials have a 3 key sensor player example here:
http://arduino.cc/en/Tutorial/Tone3
and another example of using a piezo as a sound sensor here:
http://www.arduino.cc/en/Tutorial/KnockSensor
I can Help you with the Software interface , You can use your smart phone to play sounds for each Piezo Sensor.
See this app : https://play.google.com/store/apps/details?id=ram.mere.DoDuino
You can connect arduino using Serial ( Android 3.1 and higher ) or Bluetooth to this app.
And to use the Sound Action follow this tutorial :
https://www.youtube.com/watch?v=RQhx6qBElVk
. So you specify what sound to be played on your android phone , and when you detect which piezo you send data to the android and then the Sound Specified will be played .
So for example if android App Received : #p1; then it will played the sound related to Piezo one
and when you send #s1; then it will stop playing that sound ..etc.
Hope this help someone :D .

Resources