

Note that an analog input could have been used as in the previous examples, but since we’re retrieving a discrete signal it doesn’t really make sense. You should add a pull-down resistor to this pin too. Then connect one of the 2 pins to power and the other pin to the digital input 0 of your Teensy. Place the button as follows on the breadboard:

The buttons provided in your kits have 4 pins (2 sets of 2 pins connected to each other).

For that, you’ll have to integrate the photoresistor or the FSR (depending on your initial choice) to your circuit and plug it to one of the available analog inputs of the Teensy.Try to use the FSR and the photoresistor together to add gain control to your synth.Shading the photoresistor/pressing on the FSR should now change the frequency of the generated sawtooth.Įxercise: Controlling Multiple Synth Parameters.sensorValue is used to compute frequency (that’s what we call the “mapping”) which in this case will be a value between Hz.Reuse the Faust sawtooth oscillator program from the Faust-Teensy tutorial ( ), compile it as a Teensy audio object and import it your Arduino/Teensy program as such:ĪudioConnection patchCord0(faustSawtooth,0,out,0) ĪudioConnection patchCord1(faustSawtooth,0,out,1) įtParamValue("freq",frequency) We now want to control the parameter of a Faust-generated sound processing object with the photoresistor/FSR.If nothing is plotted, make sure that the right port has been selected in Tools/Port Note that the output value is a 10 bits integer (value between ).
#Sound normalizer arduino serial#

Note that we pause the loop for 30ms at every cycle to not overload the serial output.Int sensorValue = analogRead(A0) // retrieving sensor value on Analog pin 0 Serial.begin(9600) // initializing serial port Let’s now retrieve the photoresistor/FSR signal on your computer and plot it in the debugger! First, upload this program to your Teensy:.Notice the use of a 10k pull down resistor which is used to stabilize power readings on the A0 pin of your Teensy.FSRs and photoresistors don’t have a polarity so you don’t need to respect a specific orientation to plug them to the breadboard. The FSR in your kit is smaller than the one shown on the picture here.Make a circuit connecting a photoresistor or a FSR (they work the same way) to the analog input 0 (A0) of the Teensy:.In the breadboard distributed with your kit, power pins (2 leftmost and 2 rightmost black/red strips) are connected in groups of 5 pins.You want to use the 3.3V pin (third pin from the top on the right hand side) for this task. WARNING: do not use the “Vin” pin (top right pin) that could potentially fry your Teensy.Connect your Teensy to your breadboard as follows (GND to the blue/black - strip and 3.3v to the red + strip):.You’ll have to refer to it relatively often in this lab so make sure to save it somewhere. Briefly review the Teensy 4.0 pins map (scroll down to the “Pins” section of this page).Microcontrollers such as the Teensy can be used to digitize the signal delivered by a sensor in a circuit (which is the same as measuring the amount of current in the system at regular time intervals).A wide range of sensors act as resistors (e.g., Force Sensitive Resistors, photoresistors, SoftPots, flex sensors, etc.) and can be used to dynamically change the amount of current circulating in a circuit.Review this brief introduction to electronics on the CCRMA Wiki.Various mapping strategies are also introduced. The goal of this lab is to control Faust synthesizers with sensors connected to the Teensy. Lab 3: Sensors and Physical Interface Design
