A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: Kent, Joe., luketeaford, lisa

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Wed Jul 22, 2020 7:03 pm

#########################################################
I figured it made sense to have the most up-to-date info here at the top, so here are the relevant links:
Currently (i.e. as of 23 Oct 2020) I have 3 sets of panels and boards from my second run still available.
#########################################################

Hello.

I'd like to share a project I've been working on for the last 2 months - A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library inspired by Euclidean Rhythms, and the Moog Subharmonicon (and standard subtractive synthesis). The Subharmonicon uses polyrhythms to selectively trigger across two 4-note sequencers. Very interesting musical patterns are created by the changing interleaving when the rhythms share no small common divisors.

I came across these two things at about the same time and thought the double sequencer idea could well be joined with a Euclidean rhythm generator to make an interesting synthesizer. Using a Teensy 4.0 and the Audio shield and library, I created "The Euclidean" - a 4-voice subharmonic synthesizer and polymetric sequencer.

I've attached some pics from while I was building it, and the final prototype (outside of its case still)
Euclid1.jpg
Euclid2.jpg
Euclid3.jpg
Euclid4.jpg
Brief specs are:
  • 2 primary oscillators supporting various waveshapes, each with an associated sub-oscillator with frequency determined by dividing the primary frequency by an integer from 2 to 16
  • frequency modulation, pulse width modulation, multiple frequency quantisation options
  • AD envelope when sequencing, ASR when playing
  • LFO (with multiple waveshapes)
  • Resonant low-pass filter with (positive and negative) envelope and LFO modulation
  • Chorus, Flanger, Delay effects
  • Three independent "Euclidean Rhythm" generators
  • Two independent 4 note sequencers - each driving one of the oscillators, and driven by various combinations of rhythm events.
    +/-24 semitone steps for each sequencer
  • MIDI and Serial integration
(Full specs are at the end of this post.)

Here's some videos of it running. There are some minor artefacts in the sound capture, and the quality is much better through an amp - especially in the bass which is really a significant aspect of the sequences.

Making a simple patch
https://youtu.be/EpbZltwllng
Demo of some presets
https://youtu.be/v3G87oQD6Rg
MIDI keyboard integration
https://youtu.be/SEoN5bkz9Ko

This is still very much a work in progress, but I'm really happy having reached a milestone where it is so usable and fun. :-)

Ken

Specifications:
  • Two independent oscillator units.
    • 2 unison primary voices (detunable - light, medium, heavy)
    • waveshapes: Sine, Triangle, Square, Sawtooth, Variable Width Pulse (bandwidth limited to minimise aliasing).
    • 2 unison sub-voices with frequency determined by dividing the primary frequency by an integer from 2 to 16
    • sub oscillator waveshapes: Sine, Triangle, Square, Sawtooth
    • independent level control of each oscillator (plus toggle for mute)
    • Optionally quantise the frequency to any one of:
      - 12 note chromatic scale,
      - 8 note diatonic major or minor scale,
      - 5 note pentatonic major or minor scale,
      - 8 note just intonation major or minor scale,
      - 8 note Pythagorean major or minor scale.
    • Transposable +/- 24 semitones via a panel control, or arbitrarily via a MIDI keyboard.
  • LFO
    • Optionally modulate any of:
      - oscillator frequency,
      - pulse width,
      - Filter cut-off
    • waveshapes: Sine, Triangle, Square, Sawtooth, Reverse Sawtooth, Sample and Hold
  • Low-pass resonant filter
    • adjustable cut-off frequency
    • adjustable resonance
    • positive and negative adjustable envelope response
  • Envelope
    • There are three independent Attack/Decay envelopes, one for each oscillator group, and one for the filter.
    • Although independent, their settings are common
    • When being played manually, the envelope becomes ASR
  • Effect presets (slow/medium/fast)
    • Chorus
    • Flanger
    • Delay
    • Chorus + Delay
  • Rhythm
    • Three independent "Euclidean Rhythm" generators
    • set the number of main beats, and the bar length for each
    • the maximum bar length is 32
    • the tempo ranges from 30bpm to 1200bpm
  • Sequencers
    • Two independent 4 note sequencers
    • Specify offset for each step from -24 to +24 semitones
    • Apply to main frequency, sub-frequency divisor or both
    • When applied to sub-frequency divider, the offset is divided by 3 (so from -8 to +8)
    • Sequencer 1 drives oscillator 1, and sequencer 2 drives oscillator 2
    • The sequencers can be set to progress on a beat from any of the 3 rhythms, offbeats, or both.
    • The sequencer play mode has three states:
      - Run - progress as specified according to the rhythm
      - Hold - play and hold a single step (useful for individual oscillator tuning)
      - Pause - repeat the current step until pressed again (useful for joint oscillator tuning)
  • Presets
    • Up to 64 presets can be saved on an SD card
  • MIDI
    • If any sequencer is inactive (either because stopped or not set to advance) then the corresponding oscillator (and sub-oscillator) will play according to an incoming MIDI note.
    • If both sequencers are active, played MIDI notes transpose the sequences.
    • <COMING SOON> incoming/outgoing MIDI clock
  • Serial connection
    • A serial connection allows some control from a computer
    • Presets can be queried and restored from backup using serial commands
You do not have the required permissions to view the files attached to this post.
Last edited by kallikak on Tue Oct 27, 2020 12:36 am, edited 2 times in total.

User avatar
col
Veteran Wiggler
Posts: 552
Joined: Tue Feb 04, 2014 3:47 pm
Location: Melbourne

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by col » Wed Jul 22, 2020 9:11 pm

nice work!

weasel79
Common Wiggler
Posts: 96
Joined: Mon May 06, 2019 7:42 am

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by weasel79 » Thu Jul 23, 2020 6:16 pm

hah pretty dope project and v impressive for only 2 months of work! congrats!

i think you could make this a quite popular diy kit and/or finished product?

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Thu Jul 23, 2020 8:47 pm

Thanks. Quarantine helps. :-)

I agree that this could work quite well as a kit. It's easy enough to do if there is interest.

I'm about to make version 2 and if all goes smoothly I'll post details.

User avatar
sduck
experimental use of gravity
Posts: 13977
Joined: Wed Feb 18, 2009 6:03 pm
Location: Vortepexaion, TN, USA

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by sduck » Thu Jul 23, 2020 10:05 pm

Very nice! I would have interest if you're up for a kit or sharing gerbers or whatever.
flickr cloud of sound touyube NOT A MODERATOR ANYMORE

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1702
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by devinw1 » Thu Jul 23, 2020 11:51 pm

Very cool man. Nice work. Agree on the timeline too. Impressive speed you work at! I've been told my productivity is good but I think you beat me lol!

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Fri Jul 24, 2020 3:00 am

Well my previous project was a controller to get a lot more knobs for my Blofeld and a lot of the control circuitry was very similar.
55DAA424-35E3-4F49-932D-696315E256E6.JPG
I'm going to rebuild this one too - spacing the controls a bit more and using a TFT LCD instead of the 4x20 one. Also I'm learning how to get the panels looking better as I go. :-)

A big time saver was sorting out most of the code beforehand by whipping up a javascript version here (much easier to debug than on the Teensy!)
http://thewessens.net/Euclid/Euclid.html
Euclidean_screenshot_small.png
I also made a mini-version that is useful for learning about a Euclidean rhythm and how it can interact with the two sequencers: http://thewessens.net/Euclid/Mini-Euclid.html
Mini_Euclidean_screenshot_small.png
I plan to use this one to make material for an interesting Maths lesson on Euclid's algorithm. :-)

Ken
You do not have the required permissions to view the files attached to this post.

User avatar
Randy
Super Deluxe Wiggler
Posts: 1891
Joined: Sat Sep 22, 2012 9:50 pm
Location: Mississauga, Ontario, Canada

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by Randy » Fri Jul 24, 2020 9:15 am

Wow, that's impressive. I'd also be curious about a kit.

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Fri Jul 24, 2020 7:23 pm

I'll soon have 5 new boards - this time with surface mount 74HC4067 and MCP23017s in place, and a reasonable supply of the LED switches. There was only one error on the board for this first effort (I accidentally routed the 74HC4067 output to a digital pin, but that was easily fixed with a single blue wire) so I'm pretty confident the new one will be fine. Of course the software (not sure I can call it firmware yet :-) ) continues to evolve.

The only thing that is delaying me sending off the gerbers to be fabricated is deciding on an enclosure. I could do the same as the first time - make a panel PCB and get an enclosure where it slides in. This is the one I used this time:
takachi.png
It's a lovely enclosure, but a bit pricey.

Alternatively, I have enquired about getting the panel drilled and silkscreened onto one of these
CD06.jpg
as a cheaper alternative, but I'm nervous about quality control.

Easiest of all is a desktop enclosure where a panel (PCB or aluminium) can simply be screwed on, such as this:
PT-8.jpg
At any rate, I'll make a choice and run with it, and should have 3 spare boards + panels + some parts available if anyone would like them (at cost).

Ken
You do not have the required permissions to view the files attached to this post.

User avatar
yan6
Ultra Wiggler
Posts: 977
Joined: Sat Jun 15, 2013 7:14 pm
Location: Ontario, Canada

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by yan6 » Sat Jul 25, 2020 6:13 am

Wow very cool, I'd be down if it ever turns into a kit or groupbuy

User avatar
DCDanno
Common Wiggler
Posts: 201
Joined: Sun Aug 04, 2019 3:47 pm
Location: Ozarks

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by DCDanno » Wed Jul 29, 2020 1:10 pm

yan6 wrote:
Sat Jul 25, 2020 6:13 am
Wow very cool, I'd be down if it ever turns into a kit or groupbuy
Me, too.

User avatar
BadPixel
Common Wiggler
Posts: 58
Joined: Tue Nov 06, 2018 8:23 am
Location: Stockholm, Sweden

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by BadPixel » Wed Jul 29, 2020 4:31 pm

DCDanno wrote:
Wed Jul 29, 2020 1:10 pm
yan6 wrote:
Sat Jul 25, 2020 6:13 am
Wow very cool, I'd be down if it ever turns into a kit or groupbuy
Me, too.
I’d also be interested. Dope work :tu:

User avatar
Flounderguts
Ultra Wiggler
Posts: 883
Joined: Thu Dec 07, 2017 5:56 pm
Location: SLC
Contact:

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by Flounderguts » Thu Jul 30, 2020 1:01 am

I'm in for one of these. Exactly the kind of thing I love.

Looks like you'll have to do a run of at least 10!!
----------------------

Flounderguts

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Thu Jul 30, 2020 7:21 pm

Thanks for the positive comments. I think I can guarantee some kits will be forthcoming. :-)

I haven't finalised the new boards yet though I'm very close. I settled on a 2 board option - a lower board for the teensy, the audio shield and the I/O, and an upper board for the controls with the panel on top of that. They can simply be stacked, but will also fit nicely into the PacTec PT-8 enclosure.
PT-8.jpg
Regarding functionality - I've used the spare memory to add some basic 808 style drum sounds (bass, 3 toms, snare, and open and closed hi-hat). Each rhythm generator can be associated with one of 4 choices of two-piece drum "kit", where one sound is triggered on any beat, and the other on the offbeat - toggled by the same settings as the sequencer (to keep everything still just simple front panel control). This means you can play drums + synth, just synth, or just drums (or play manually via MIDI on top of the drums).

I'll record and post a demo soon.

Ken
You do not have the required permissions to view the files attached to this post.

User avatar
Bodo1967
Veteran Wiggler
Posts: 666
Joined: Wed Aug 10, 2016 2:27 pm
Location: Germany

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by Bodo1967 » Fri Jul 31, 2020 4:02 am

Whoa :eek: . I'm interested as well :guinness: .
... why buy it for $100 when you can build it yourself for $150?

BlinkyLights
Veteran Wiggler
Posts: 556
Joined: Wed Feb 13, 2019 12:16 am

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by BlinkyLights » Fri Jul 31, 2020 4:12 am

Fascinating.

Nice work.

User avatar
sixty_n
Wiggling with Experience
Posts: 314
Joined: Sat Nov 08, 2014 8:28 pm

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by sixty_n » Fri Jul 31, 2020 5:44 am

Interested in a kit too

User avatar
brawnywynn
Learning to Wiggle
Posts: 33
Joined: Tue Sep 16, 2014 12:55 pm

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by brawnywynn » Fri Jul 31, 2020 6:54 am

Another vote for a kit!

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Thu Aug 06, 2020 12:22 am

The drum machine additions have gone through a few variations as I've tried things out. I've ended up with the following approach where they are controlled by presses on the otherwise unused bottom row from the parameter control matrix:
  • Choose one of a predefined set of a 3 instrument kits, where each instrument is associated with the beats from one of the 3 rhythm generators
  • Choose a mode for the kit:
    • Off - do not play
    • Sel - play according to the beat selection buttons across both sequencers
    • R1 - play according to the first rhythm setting
    • 123 - play according to all 3 rhythm settings (regardless of the beat selection button states)
  • Choose an instrument for off beats
  • Choose a mode for playing off beats
    • Off - do not play
    • Sel - play according to the off beat selection buttons across both sequencers
    • R1 - play offbeats as determined by the first rhythm setting
    • 123 - play offbeats as determined by all 3 rhythm settings
    • All - simply play on every beat
To make this work better I have added an offset parameter to each rhythm generator. This is something I was considering doing originally anyway, but it's absence was a more significant issue for drum beat generation.

A couple of other features are:
  • The drum sounds go through the filter and as such also can be modulated, but they do not go through the amplitude envelope.
  • The volume of the drums can be controlled independently of the oscillators, and there is an accent on the first beat of each rhythm.
Here's a link to a quick demo to give an idea of how it works and how it blends with the synthesiser components.

EUCLID percussion demo

Finally - I sent off the gerbers to be manufactured last night. Fingers crossed... :-)

Ken

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Wed Sep 09, 2020 6:02 pm

Well I've progressed from the prototype stage to what I think is a shareable version. Putting together a webpage now with details.

It fits nicely in the enclosure I chose, and it's nice to have the connections robust instead of dangling wires. :-)
1. Euclidean - side view.jpg
2. Euclidean - top view.jpg
3. Euclidean - rear view.jpg
The LCD display is working well and showing some good detail - especially for setting the rhythm and the running beats.
4. Euclidean - top view running.jpg
5. Euclidean - LCD summary.jpg
6. Euclidean - LCD rhythm.jpg
All together I use 2 genuine boards and 2 boards that are just panels. These fit the Pactec PT-8 enclosure, but there are extra holes that align so that the boards can be stacked vertically. The lower board has a prototyping area since the Teensy 4.0 can be replaced with a Teensy 4.1 meaning there are many spare pins for expansion/experimentation. The control board has a number of SMT components in place which simplifies construction.
7. Euclidean - PCBs.jpg
8. Euclidean - SMT components.jpg
Here's a short demo showing a fairly straightforward polyrhythm and sequence and how you can interact with it musically via a MIDI keyboard:
Euclidean V2 demo

Some of you expressed interest in this as a kit. At the moment I have 3 spare panel sets and 6 or 7 spare boards. Just send me a PM. I'm more than happy to customise or extend the Teensy code to meet particular needs that I didn't think of or to help integration with other setups. Certainly adding MIDI CC support is close to the top of my list and quite straightforward (it already interprets serial input for managing settings so it's little more than simply
deciding on a mapping). If, incredibly, there is a lot of interest I will get more made. I'd also be prepared to build complete units. I'm finishing off the webpage with details of the parts now - but it's all Mouser/RS-components, Sparkfun (for the LCD), and there's a specific very good eBay seller who has the buttons I use (but you can also get from aliexpress).

Stay tuned. :-)

Ken
You do not have the required permissions to view the files attached to this post.

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Thu Sep 24, 2020 2:21 am

OK then. I've put together some documentation for this now - having a few "early adopters" have a go at building one certainly puts a bit of pressure on to sort stuff out. :-)

A User Guide describing the theoretical basis for the device, the specifications, and the available controls is here: The EUCLIDEAN - User Guide

A Build Guide for the kit version using the boards and panels shown in the above post is here:
The EUCLIDEAN - Build Guide

Finally, the source code and compiled firmware files are here: https://github.com/kallikak/Euclidean

I'm by no means a professional at this (entirely self taught when it comes to hardware), but prior to sending any boards out I did do a complete build from scratch and it went without a hitch, so I'm pretty confident everything is ok. (It's the build I photographed for the Build Guide.)

If anyone else wants to build one, I am out of the panels but still have a few boards available. I can provide gerbers for the panels, or if there is a group of say 3 or more people interested, I will get some new ones made.

Ken

p.s. I chose (and somewhat randomly named) 10 presets that are included in the firmware. Here are 30 second samples of them - all playing without any additional interaction on the controls.

Preset01-Wah.mp3
Preset02-Pluck.mp3
Preset03-SciFi.mp3
Preset04-Meditation.mp3
Preset05-Echo.mp3
Preset06-Funk.mp3
Preset07-Dance.mp3
Preset08-Stroll.mp3
Preset09-Flap.mp3
Preset10-Bells.mp3
You do not have the required permissions to view the files attached to this post.

User avatar
brawnywynn
Learning to Wiggle
Posts: 33
Joined: Tue Sep 16, 2014 12:55 pm

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by brawnywynn » Fri Sep 25, 2020 10:52 am

Fantastic! Great demos!

I started building mine yesterday, but I may not be able to really work on it until the weekend. So far the components, pcbs and panels look very nice.

Buster44
Learning to Wiggle
Posts: 8
Joined: Mon Sep 21, 2020 3:58 am

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by Buster44 » Wed Sep 30, 2020 4:54 pm

Hi,

Very nice, who did you use to produce the silkscreen front panel?

User avatar
Bodo1967
Veteran Wiggler
Posts: 666
Joined: Wed Aug 10, 2016 2:27 pm
Location: Germany

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by Bodo1967 » Thu Oct 01, 2020 3:12 am

brawnywynn wrote:
Fri Sep 25, 2020 10:52 am
I started building mine yesterday, but I may not be able to really work on it until the weekend.
I just received the kit half an hour ago, and I'll get the big Mouser packet probably by the end of next week :D. So I'll probably be able to start building it in about one and a half weeks :D.
brawnywynn wrote:
Fri Sep 25, 2020 10:52 am
So far the components, pcbs and panels look very nice.
Yep, I agree. Looks really nice :tu: !
... why buy it for $100 when you can build it yourself for $150?

kallikak
Learning to Wiggle
Posts: 20
Joined: Sat Jun 29, 2019 7:26 pm
Location: Sydney

Re: A subharmonic synthesiser and polymetric sequencer with Teensy 4 and audio library

Post by kallikak » Fri Oct 02, 2020 6:17 am

Buster44 wrote:
Wed Sep 30, 2020 4:54 pm
Hi,

Very nice, who did you use to produce the silkscreen front panel?
I used JLCPCB for the panels and some of the PCBs. They didn't have the MCP23017s I needed in stock so the main control board I did elsewhere.

Post Reply

Return to “Music Tech DIY”