Using a Contact Mic to Turn Any Object Into a Musical Instrument
Clickbait titles aside, this is a simple concept that I am having fun playing around with. But first let's rewind a bit...
Contact Mic
A contact mic is something you can clip onto an object and it senses vibrations from that object. In the video above I had it connected to a glass. The unmodified sound coming directly out the mic would sound something like this:
Synthesizer
A software synthesizer makes sounds depending on what "key" is being pressed. You can generally modify the tone and qualities of this sound over time in a lot of interesting ways. An example of what that might sound like if I played one note and held it is shown below:
Putting them together
I connected the mic to a glass and used chopsticks to hit the glass (just like in the video at the start of the article).

Let's call the sound coming out of the synth the "audio signal" and the sound coming out of the contact mic the "control signal". I made it so that the volume of the audio signal follows the volume of the control signal. The synth is constantly being played in the background, but how loud the signal from the contact mic is determines how loud the synth is playing.
But if we did just that, we would only have the same note playing again and again, just at different volumes.
It would be good to modify the pitch of the sound. Most commonly this is done by just playing a different key on your keyboard, but most synths also have a pitch modifier control.
Again, I can take the amplitude of the control signal and this time make it modify the pitch. The problem is the amplitude isn't something I can control very well because that would mean I have to hit the glass with extreme precision. If I just use the amplitude to control the pitch (with the volume constantly at 100% just to make the pitch modifying effect easier to discern), it sounds something this:
And the exact pitch changes look like this:
I'd say it actually sounds okay and sort of interesting, but because the pitch changes are all over the place, you would have a hard time playing other melodic instruments like guitars or pianos with it because it's not following any particular key.
Instead, when controlling the pitch of the synth, I discretized the output so that it would only apply the pitch modification at certain levels.

This is what that sounds like:
And this is what the exact pitch changes look like:
Next step is to turn on both volume and pitch control, which sounds like this:
To be honest the previous audio of discretized pitch with constant volume sounds better to me, but I think this is really cool and has some interesting potential.
Conclusion
This is a pretty limited set-up: the volume of the hit controls both the pitch and the volume of the output. Regardless, it was still fun to play with.
There is a really interesting way this might (should!) be extended:
The signal coming in from the contact mic is an audio signal. That means apart from volume, it also contains pitch/frequency information. Right now we only use the volume to control other variables in this system, but also using the pitch information would make this much more interesting and flexible as a way of making music. Additionally right now we are just controlling the pitch and volume of the synthesizer: but controlling some other parameters like the filters could also be quite fun!
P.S. I've seen similar stuff done with capacative sensors too but I thought a contact mic would be worth exploring!