The Tiangle, Part III
This post is part of a series of notes and exercises for a summer camp on making musical instruments with Arduino and Pure Data.
We now have physical control over the sound waves that are being produced. The only hitch is that a lot of the frequencies in [0, 255] are outside the range that we can hear, and 255 different frequencies is a pretty narrow range. Let’s modify the patch to emit a wider and more audible range of frequencies.
Fine Tuning the Frequencies
Right now, we’ve got this relationship between the potentiometer’s angle and the emitted frequency:
What mathematical function describes this relationship between angle and frequency?We must tweak this function in two ways to achieve a better range. First, we want to push the frequencies up the y-axis away from the inaudible 0.
How do you push a function up the y-axis?Second, we want to expand the range beyond a mere 255 values.
How do we widen the range of the function?We model our expanded function in Pure Data in this way:
See how the 0-255 reading leaves comport and goes through a gauntlet of arithmetic? First it gets scaled and then it gets offset.
Adjust your patch to reflect these changes. Then leave Edit Mode and test things out. Click and drag on the scale and minimum offset widgets in the patch to alter the function that maps the potentiometer’s angle to the emitted frequency.
Challenges
After you get your improved ranges working, answer the following questions on a piece of scratch paper.
- How can you adjust the parameters so that turning the potentiometer has no effect on the emitted frequency?
- What minimum frequency and scale factor do you need to produce frequencies in the range [261, 1047]? (This range roughly goes from middle C to C in the sixth octave.)
- How can you adjust the parameters so that the potentiometer works the opposite direction? That is, when you crank it clockwise, it behaves like it was being turned counter-clockwise?