Building and learning synthesis with Teensy - a resource I've made

kallikak

Active member
I've always been into teaching and have written a lot of things for learning maths, so given the fun I've had (re)learning synthesis, coding with web audio and building synthesiser tools with Teensy, and also the number of people who want to use the Teensy to do similar things, I thought it might be good to put together something covering what I consider the foundations.

The first draft is here: http://thewessens.net/synthbook/

It's a website including over 30 webapps to allow visual/interactive learning of the important principles, 10 Teensy + Audio Shield projects, and a bit of history. I also discuss & demonstrate patch creation using a simple open source synth kit, Mentor, a 16-voice polyphonic Teensy-based synth, designed for learning subtractive synthesis.

I'd be very happy to hear of any errors or confusions that you might notice, or for any constructive suggestions. I've got several ideas for additions - mostly relating the content to specific synths, but I'm happy for now with the coverage and depth.

The contents are as follows:
Preface
1 Sound Waves and Oscillators​
1.1 Properties of Sound Waves, 1.2 Wave Types, 1.3 Harmonics, 1.4 Pulse Waves, 1.5 Playing Notes and MIDI, 1.6 Summary​
2 Combining Oscillators​
2.1 Mixing Wave Types, 2.2 Phase, 2.3 Detuning, 2.4 Noise, 2.5 Summary​
3 Audio and the Teensy​
3.1 The Teensy Pinout, 3.2 Setup on a breadboard, 3.3 Project 1: One oscillator - control pitch and amplitude,
3.4 Project 2: One oscillator - control pitch and wavetype, 3.5 Project 3: Three oscillators - control pitch and wavetype mix,
3.6 Project 4: Two oscillators - control pitch and detune, 3.7 Project 5: MIDI input, 3.8 Summary​
4 Filtering​
4.1 Low Pass Filtering, 4.2 Resonance, 4.3 High Pass Filtering, 4.4 Project 6: Teensy Filtering, 4.5 Key Tracking. 4.6 Summary​
5 Envelopes​
5.1 Attack and Decay, 5.2 Sustain and Release, 5.3 Project 7: Teensy ADSR Envelope, 5.4 Linking the Envelope and the Filter,
5.5 Inverting the Filter Envelope, 5.6 Summary​
6 Modulation​
6.1 The LFO, 6.2 Pitch Modulation, 6.3 Filter Modulation, 6.4 Project 8: LFO Modulation, 6.5 LFO Wave Shapes,
6.6 Pulse Width Modulation, 6.7 Sample and Hold, 6.8 Project 9: LFO Shapes, 6.9 Summary​
7 The Amplifier​
7.1 LFO Amplitude Modulation, 7.2 Ring Modulation, 7.3 Summary​
8 Effects​
8.1 Portamento, 8.2 Reverb, 8.3 Delay, 8.4 Chorus, Flanger, Phaser, 8.5 Distortion, 8.6 Project 10: Delay Effect, 8.7 Summary​
9 Introducing Mentor​
9.1 Specifications, 9.2 Firmware. 9.3 The Control Encoder, 9.4 The Control Matrix, 9.5 Oscillator Settings, 9.6 Filter Settings,
9.7 Envelope Settings, 9.8 LFO Settings, 9.9 Amplifier Settings, 9.10 Effects Settings​
10 Mentor Patch Presets​
10.1 INIT, 10.2 Strings, 10.3 Brass, 10.4 Solo Brass, 10.5 Wobble, 10.6 Smooth Bass, 10.7 Dirty Bass, 10.8 Alien, 10.9 Pulse,
10.10 Pad, 10.11 Piano, 10.12 Squash​
11 Other Kinds of Synthesis​
11.1 Additive Synthesis, 11.2 Wavetables, 11.3 FM Synthesis, 11.4 The Mathematics of FM, 11.5 Exploring FM,
11.6 FM Algorithms, 11.7 Samplers​
12 A Brief History​
12.1 Synthesiser Prehistory, 12.2 Evolution of Synthesisers, 12.3 Timeline​
Appendix — All the Apps
Index​

Here is a list of the webaudio apps:
1 Sound Waves and Oscillators
Wave Types, Adding Sines, Wave Type Harmonics, Pulse Waves, Four Tone Organ​
2 Combining Oscillators
Mixing Wave Types, Detuning, Noise​
4 Filtering
Low Pass Filter, Resonant Low Pass Filter, High Pass Filter, Key Tracking​
5 Envelopes
AD Amplitude Envelope, ADSR Amplitude Envelope, Filter Envelope, Inverting the Filter Envelope​
6 Modulation
LFO Pitch Modulation, LFO Filter Modulation, LFO Shapes, Pulse Width Modulation, Sample and Hold​
7 The Amplifier
Amplitude Modulation, Ring Modulation​
8 Effects
Portamento, Reverb, Delay-Chorus-Flanger, Phaser, Distortion​
11 Other Kinds of Synthesis
Drawbar Organ, Wavetable Synthesis, FM Synthesis

And here is a list of the Teensy Projects
Project 1: One oscillator - control pitch and amplitude​
Project 2: One oscillator - control pitch and wavetype​
Project 3: Three oscillators - control pitch and wavetype mix​
Project 4: Two oscillators - control pitch and detune​
Project 5: MIDI input​
Project 6: Teensy Filtering​
Project 7: Teensy ADSR Envelope​
Project 8: LFO Modulation​
Project 9: LFO Shapes​
Project 10: Delay Effect​

Finally, here are some snapshots to give an idea of how things are presented:

Filter.jpg
TeensyProject.jpg
Effects.jpg
 
Expanding upon what I said above, which was a little minimal, I liked the way you posted whole code examples, which work.

There were several instances where I thought "Hey! That's better than my method!".

I also liked the interactive apps. A useful tool for visualising the synthesis process on the go.
 
I definitely hope it helps people get started - and helps them understand things within a broader context.

Much of what I wrote I already knew, but there were still a good few places where I realised I had gaps in my understanding, and others where my "understanding" was just plain wrong! :D
 
Hi there, The link to supporting Github resource is a little broken.

"This site can’t be reached githu.com refused to connect."

Needs another 'b'... :)
 
Exactly what I need to learn for my new project, a Teensy based MIDI controller and Lissajous image generator for laser projectors.
Thanks for sharing. I'm sure that this documentation will reduce lots of frustration and greatly improve my artistic endeavors.
 
Yes looks great, there is much to learn, as I'm new to doing synth stuff, and have mostly done simple experiments on myself without knowing what I'm doing, your "manual" explains it with good examples.

My biggest usage so far is for my homemade piano keyboard and the teensy is mostly used because of the wave table object.


One thing that got my attention was the wave table example where you can customize the waveform, this could be used to generate "datasets" for the AudioSynthWaveform(modulated) abitrary waveform type, there could be two variants one standalone and one that integrate in my tool++, and together with the new OSC implementation it could be updated live to test the waveforms directly in the teensy, maybe later also to generate complete wave tables.
 
Yes looks great, there is much to learn, as I'm new to doing synth stuff, and have mostly done simple experiments on myself without knowing what I'm doing, your "manual" explains it with good examples.

My biggest usage so far is for my homemade piano keyboard and the teensy is mostly used because of the wave table object.


Please be careful with "experiments on myself without knowing what I'm doing":rolleyes:
There's a great free dev app, called PureData, which 'your pal, Dave' covers in Part 2 of his Teensy synth tutorial series on his 'Notes and Volts' YT channel, which helped me to get started. The best thing about Pure Data is that it provides a user friendly GUI to develop MIDI controls, without breaking the bank on hardware. But, once the coding is finished, a DAW can be added and the finalized Pure Data controls and layout can easily be replaced with only the required hardware.
 
Yes have tried pure data but the sliders don't allow to be controlled by the mouse scroll, instead I did some improved sliders in c# and did the rest of the interface in there as well.
Now I have made it possible to do the interface in my design tool instead.
 
Thank you for the info.
I'm only using PD as a dev tool, as well. IMHO, analog sliders lose their appeal in the MIDI DAW environment. The pot says one thing and the DAW says something different. I've seen folks overcome this by having level indicators, then physically moving the slider to match the DAW, before becoming active. Yeah, nahh.
Instead, I'm resurrecting my idea from my first laser desk, back in 1980. Instead of analog sliders, I'm using rotary encoders with wheels, just like pitch wheels on synths. Along the front edge of my desk will be a row of oscillator gain wheels. Above that will be detune wheels for phase shifting (image movement). Level indicators might be LED arrays, my existing multi-touch PC display, or both. Still debating with myself over that one. But, I'll know by the time I'm ready to cross that bridge.
BR
 
Oh this looks great, thanks. I love the examples and the tests to recreate the same sounds. I'm looking forward to going through it all. :)
 
Last edited:
Back
Top