IFD:EAI SoS21/course material/Session 6: Getting Started with Teensyduino: Difference between revisions
From Medien Wiki
Line 34: | Line 34: | ||
We want to code a so called envelope follower, it tracks the peaks of our audio signal and gets the rough volume shape. With the help of the volume (~loudness) of our signal we can detect wether there is vibration on our piezo or not. In rough terms we get the volume envelope in two steps: | We want to code a so called envelope follower, it tracks the peaks of our audio signal and gets the rough volume shape. With the help of the volume (~loudness) of our signal we can detect wether there is vibration on our piezo or not. In rough terms we get the volume envelope in two steps: | ||
# get the maximum (peak) of the signal samples seen so far (this is also called a peak hold circuit [[File:peak_hold.png| | # get the maximum (peak) of the signal samples seen so far (this is also called a peak hold circuit [[File:peak_hold.png|800px]] | ||
# multiply this maximum with a decay factor (<1) for every new sample, or sample block (envelope follower) | # multiply this maximum with a decay factor (<1) for every new sample, or sample block (envelope follower) | ||