Lab 2: Embedded Audio DSP with Faust and the Teensy

By the end of this lab, you should know how to synthesize and process sound on the Teensy using Faust!

Assembling the Teensy and the Audio Shield

To assemble your Teensy and your audio shield, take the following elements from your lab kit (the Teensy 4.0, the Teensy Audio Shield, and the stackable header sets):

Take a small wire cutter (e.g., the one provided with your 3D printer) and cut all the stackable pin headers on their 15th pin (the Teensy and the audio shield both have 14 pins on both sides). Warning: the cut should be carried out on the 15th pin input itself and not on the junction of the pin! You do not want to damage the neighboring pin as this could prevent your audio shield from working properly! If you’re not sure about that, you can re-watch the video tutorial made in class.

Place 2 of the stackable header sets on the Teensy as shown on this picture:

Put your assembly on a table and make sure that it is reasonably stable. Note the orientation of the Teensy! The male pins of the headers should come out on the opposite side of the USB port on the Teensy. Make sure that the headers sets are fully perpendicular to the Teensy (90 degrees)! We’re about to solder them and they will need to perfectly align with the female headers on the audio shield!

Start by soldering one pin (any of them) on each header. That should be enough to hold the header on the Teensy. Your soldering point should have a nice “dome/conic” shape covering the hole on the Teensy. After making these 2 solder points, verify that the headers are still perpendicular to the Teensy. A good way to do this is to place the Teensy on your breadboard without pushing it into it. If everything looks straight and square, then you should be good to go ahead with the next step. On the other hand, if one of the headers is not perpendicular, try to adjust it by gently bending it.

Solder all the remaining pins of the headers to the Teensy. After this, your system should look like this:

Once again, note the nice conic shape of the solder points. Be careful not to put too much solder to prevent neighboring pins to connect to each others as this could potentially be harmful for your Teensy. Inversely, not having enough solder on the pin might prevent it from working properly.

Take the two remaining headers sets and insert them on the male headers of the Teensy:

Place the audio shield on top of the Teensy as shown here:

The headphone jack on the audio shield should be on the same side as the USB port on the Teensy! You can now solder all the pins of the audio shield. Recommendations are the same as for the Teensy. After this step, your system should look like this:

If you didn’t make any mistake, you should be ready to rock’n’roll with your Teensy!

Making Sound

The Teensy is programmed using the Arduino software. Install Teensyduino on your system using the following instructions:

Follow the DSP on the Teensy with Faust tutorial on the Faust website. Skip the section on “Audio Effect” (it is slightly outdated and we’ll do that later in this lab). Since Faust is probably not installed on your system, you should use the export (truck) function of the Faust Web IDE to generate Faust Teensy DSP objects (select Teensy as platform and Teensy as architecture). For now, use the headphone jack output on the Teensy as the main output.

Don’t forget to read the section on audio latency of the tutorial! This is important stuff!

Assignment: Music Box/Sound Generator (Due on April 21, 2021)


Note how delays here (in ms) are used to control the “rhythm,” etc. One more thing: controlling pitch with a frequency is not necessarily convenient so you might want to use the ba.midikey2hz Faust function.