Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 19 of 19

Thread: [queued] TSynth - Two Oscillator Polysynth

  1. #1

    [queued] TSynth - Two Oscillator Polysynth

    Hello. Another day, another Teensy synthesizer. TSynth is a two oscillator, four note polyphonic synthesizer with a large number of waveforms including user defined, state variable filter, two envelopes, PWM options, LFOs for oscillators and filter, effects, patch saving and recall. I went mad with the Audio Library really and cannot begin to express how fantastic it sounds and the possibilities it opens. The full spec is below and it fully utilises the USB host on the Teensy 3.6. It will receive MIDI via the client USB from a pc (which also provides digital audio appearing as a soundcard), the USB host port (I can connect my controller keyboard directly) and normal 5-pin DIN MIDI.

    Click image for larger version. 

Name:	20190829_173056.jpg 
Views:	97 
Size:	242.0 KB 
ID:	17379

    Click image for larger version. 

Name:	20190829_173110.jpg 
Views:	114 
Size:	209.9 KB 
ID:	17380

    Click image for larger version. 

Name:	20190829_173147.jpg 
Views:	69 
Size:	92.6 KB 
ID:	17381

    Most of the pots, switches, buttons, display and encoder are connected via two 16 channel MUXs, the rest to the Teensy pins directly. It is a mess of wires inside and a PCB would be fantastic. A demo video will follow soon.
    Click image for larger version. 

Name:	20190703_104741.jpg 
Views:	150 
Size:	191.2 KB 
ID:	17382

    Teensy 3.6 with Audio board - this shows how the USB host port pins were soldered.
    Click image for larger version. 

Name:	20190703_101229.jpg 
Views:	137 
Size:	172.1 KB 
ID:	17383

    Oscillators
    • Four voice polyphony (last note priority), two oscillators per voice, detunable with +/- 2 octaves range, Sine/Sample & Hold (like tuned noise)/Square/Sawtooth/Ramp/PWM/Var Triangle/User waveforms and level
    • Pulse Width/Var Triangle can be set for each oscillator with PWM by dedicated LFO or from the filter envelope
    • Pink noise with level
    • Dedicated LFO for pitch mod (can be retriggered by note on) , Sine/Triangle/Sawtooth/Ramp/Square/S&H waveforms
    • XOR ‘Ring Mod’ (creates lots of harmonics with certain waveforms)
    • Unison with all eight oscillators detunable from each other
    • +/- 12 semitone pitchbend range
    • Mod wheel controls pitch LFO amount

    Filter
    • State variable 12dB filter (SVF) with continuous mix between LP and HP (provides notch filter) and BP
    • Cutoff freq and resonance
    • Cutoff can be modulated by dedicated ADSR envelope, dedicated LFO and key tracking
    • LFO has same waveforms as pitch LFO (can be retriggered by note on) and rate can be set to match MIDI clock (tempo) with variable delay per bar


    Amplifier
    • Dedicated ADSR envelope
    • Glide (up to 1 octave range) with variable time
    • Volume for DAC output
    • Effect amount and mix - currently for stereo chorus but could be set up to allow choices in programmer


    Programmer
    • 160x80 IPS colour display
    • Encoder with button for data entry, Back button for menu navigation
    • Save and Recall buttons for storing patches, holding Recall initialises the current patch to match the panel controls
    • The programmer makes the synth very flexible with possibilities for changing User waveforms, alternative filters, alternative effects with further parameter settings.



    MIDI
    • USB HOST MIDI Class Compliant (direct connection to MIDI controller, no PC needed)
    • USB Client MIDI In from PC
    • MIDI In 5 pin DIN



    Audio
    • SGTL5000 Audio Shield 16 bit, 44.1 kHz Stereo out
    • USB Audio in/out—appears as 16 bit, 44.1 kHz audio interface on PC



    Hardware
    • Teensy 3.6 with SGTL5000 Audio Shield. Two 4061 multiplexers providing 32 channels from the pots into two ADCs. The rest of the pots and switches use remaining pins on Teensy.
    • Enclosure is laser cut acrylic with etched labels filled with yellow acrylic paint (this technique could be improved with experimentation), end cheeks are 3D printed.

  2. #2
    Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    46
    @UHF wow - that looks excellent and super functional, I bet it's been a labour of love for a few months!
    How does it sound ? I'd love to hear your 'Soild Bass' patch

  3. #3
    Hello, here's a demo of TSynth. Not quite Tangerine Dream... but the whole thing was originally inspired by Dave at Notes & Volts TS-1 synth building series. It's designed to show the range of sounds the Audio Library can produce when you take the time to design and try things out. All sounds are from TSynth with built-in stereo chorus, mixed on Ableton Live with volume, EQ and panning adjustments only. I think it could be pushed to 6 or 8 voice polyphony before the Teensy 3.6 cpu runs into problems - it is still running at 180MHz too. Solid Bass at 1:33!


  4. #4
    A screenshot of the Audio Design tool to answer a few questions. The modulation connections make it complicated but more voices could be added.

    Click image for larger version. 

Name:	Annotation 2019-09-06 001358.jpg 
Views:	344 
Size:	108.6 KB 
ID:	17512

  5. #5
    Junior Member
    Join Date
    Sep 2019
    Posts
    2
    Very nice project I listened demo on YT and it sounds for me like good VA - some thin, metallic sound, and some good basses.

    But indeed, routing in design tool is kinda messy. In my first thread I asked about merging audio objects into bigger class, hope somebody will help

  6. #6
    There are quite a few improvements that could be made and it would probably end up looking like it's main rival, the Axoloti. A major improvement to the quality is anti-aliasing the waveforms and better control of the effects. Running polyphonically on a T4, you could blow away a few sub $500 synths.

  7. #7
    @UHF What a super project! Are you planning to make the code available for others? I'm really interested in building one.

  8. #8
    Hello, yes I'll publish the code sometime. The sound creation and the control of it is finished. All the front panel controls have MIDI CC numbers set up. Patch saving and recall isn't finished (it needs a way to handle these properly and allow naming with the encoder) and the TFT display will show parameter values as they're being changed and reverts back to the patch name after a time delay - but not totally reliably (threading). I don't like coding in C and am tolerating it. The code isn't too difficult to change for different hardware, such as display, choice of MIDI inputs.

    If you decide to build something like TSynth, the wiring is the worst aspect and you either need a proper pcb or come up with a way of neatly soldering very flexible wires to every control and routing them to MUXs and the Teensy. I used stiff DuPont wires and had to solder a pin header to each control. You can disassemble it, but it's not something you would ever want to do. It is a one-off prototype.

  9. #9
    Very, very nice. If this is what your prototype looks like, I would love to see your production design.

  10. #10
    Quote Originally Posted by UHF View Post
    A screenshot of the Audio Design tool to answer a few questions. The modulation connections make it complicated but more voices could be added.

    Click image for larger version. 

Name:	Annotation 2019-09-06 001358.jpg 
Views:	344 
Size:	108.6 KB 
ID:	17512
    Really nice design and clean finish. Hope you made it possible to add a few more oscillator controls. It's very similar to the one I have been building off and on. With similar complexity I have gone to 8 note poly as 3 modulated waveform objects as the core oscillators with 1 PWM, 1 FM and 1 pseudo ring modulator each fed the outputs from the original 3 waveforms in combination changing switch arrangement. Each channel goes to it's own filter and all feed to a delay loop. At the moment I can switch in a LFO modulation setup with its own filter. With the code compiled to 192MHz It all just fits in without crashing and the memory usage is about 50%. At times I have thought about going to 6 or 4 note poly but the fat chords from 8 notes are too tempting. At the moment I'm idling on this one and waiting for the development of the T4.0 to move ahead.

  11. #11
    Hello, many thanks for the front page feature. Just an update - TSynth is just about completely nearly finished . The synth part hasn't changed except key tracking works individually for each note as you would expect and the new stereo ensemble chorus sounds fantastic thanks to @quarterturn Also I need to thank @KurtE and everyone who worked on getting the frame buffering working on the latest releases of Teensyduino. Just two lines of code cut a whole load of complexity that never really worked properly. Display updates are now rapid and smooth - it was an 'oh thank god' moment when I tried it and it all just worked. Patch save, recall, delete and renaming also works now. All controls work via MIDI including program change commands. One thing I would have liked to add is a control for pitch modulation amount by the filter envelope. I'll do another video demo of some sounds and general use soon.

    I've released the code here github.com/electrotechnique/TSynth You'll see quite quickly that I'm not a fan of c programming. Please feel free to do something about any bad practice and wrongness. The synth does work very reliably however. If you want to try it out for yourself, it isn't too difficult to remove any hardware specific code. This is written for a Teensy 3.6 with USB Type: USB + MIDI + Audio.

    I am playing with the idea of designing a PCB and a PCB-based front panel (for the first time). However, I want it to use a Teensy 4 in 3.6 form factor as I need USB host and extra IO pins. Perhaps next year if Teensy 4.x goes ahead! An alternative to the micro USB connector or pins on the PCB to connect to it, would also be welcome.
    Last edited by UHF; 12-03-2019 at 01:33 PM.

  12. #12
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,452
    Quote Originally Posted by UHF View Post
    I am playing with the idea of designing a PCB and a PCB-based front panel (for the first time). However, I want it to use a Teensy 4 in 3.6 form factor as I need USB host and extra IO pins. Perhaps next year if Teensy 4.x goes ahead! An alternative to the micro USB connector or pins on the PCB to connect to it, would also be welcome.
    If you aren't afraid of a little soldering (both through hole and surface mount), you might want to check out this board designed by trainer4edu/frdm4236. Note for USB host, there will be extra pins for the host pins, so you have to carefully plan how to place the board if you want to connect the USB host pins to the prototype board (or just design it in):


    Or there are two other designs going on, but don't use the Teensy 3.6 form factor:


    Note, be sure to check the boards, as sometimes the PCB foundary misses creating the castellated cuts.

    For USB host, you would typically use a cable like this.

  13. #13
    Hello, I've seen the breakout boards. My intention is to simply make a PCB and front panel and the rest is up to the individual to get the components and solder them. I want to make this as easy as possible, although the 4067 MUXs are surface mount only. The front panel will be attached above the PCB with spacers. I will probably design an enclosure similar to the prototype with laser-cut and 3D printed parts, if anyone wanted to use those. Other problems are the longevity of the micro USB on the Teensy's for long-term use to power the synth. And the audio board which will be mounted on the Teensy with the 2.5mm jack as the audio output.

  14. #14
    Junior Member
    Join Date
    Nov 2019
    Posts
    3
    @UHF Congrats, very nice project and build. It sounds great, could be tempted to build one as all my synth are analog mono, a nice Teensy poly synth would complete my setup perfectly

    @RogerD What are you exactly waiting for about T4 ? I use one T4 with audio shield Rev D for a multi FC and it works perfectly.

  15. #15
    Junior Member
    Join Date
    Nov 2019
    Posts
    7

    Brilliant Synth

    Quote Originally Posted by UHF View Post
    Hello. Another day, another Teensy synthesizer. TSynth is a two oscillator, four note polyphonic synthesizer with a large number of waveforms including user defined, state variable filter, two envelopes, PWM options, LFOs for oscillators and filter, effects, patch saving and recall. I went mad with the Audio Library really and cannot begin to express how fantastic it sounds and the possibilities it opens. The full spec is below and it fully utilises the USB host on the Teensy 3.6. It will receive MIDI via the client USB from a pc (which also provides digital audio appearing as a soundcard), the USB host port (I can connect my controller keyboard directly) and normal 5-pin DIN MIDI.

    Click image for larger version. 

Name:	20190829_173056.jpg 
Views:	97 
Size:	242.0 KB 
ID:	17379

    Click image for larger version. 

Name:	20190829_173110.jpg 
Views:	114 
Size:	209.9 KB 
ID:	17380

    Click image for larger version. 

Name:	20190829_173147.jpg 
Views:	69 
Size:	92.6 KB 
ID:	17381

    Most of the pots, switches, buttons, display and encoder are connected via two 16 channel MUXs, the rest to the Teensy pins directly. It is a mess of wires inside and a PCB would be fantastic. A demo video will follow soon.
    Click image for larger version. 

Name:	20190703_104741.jpg 
Views:	150 
Size:	191.2 KB 
ID:	17382

    Teensy 3.6 with Audio board - this shows how the USB host port pins were soldered.
    Click image for larger version. 

Name:	20190703_101229.jpg 
Views:	137 
Size:	172.1 KB 
ID:	17383

    Oscillators
    • Four voice polyphony (last note priority), two oscillators per voice, detunable with +/- 2 octaves range, Sine/Sample & Hold (like tuned noise)/Square/Sawtooth/Ramp/PWM/Var Triangle/User waveforms and level
    • Pulse Width/Var Triangle can be set for each oscillator with PWM by dedicated LFO or from the filter envelope
    • Pink noise with level
    • Dedicated LFO for pitch mod (can be retriggered by note on) , Sine/Triangle/Sawtooth/Ramp/Square/S&H waveforms
    • XOR ‘Ring Mod’ (creates lots of harmonics with certain waveforms)
    • Unison with all eight oscillators detunable from each other
    • +/- 12 semitone pitchbend range
    • Mod wheel controls pitch LFO amount

    Filter
    • State variable 12dB filter (SVF) with continuous mix between LP and HP (provides notch filter) and BP
    • Cutoff freq and resonance
    • Cutoff can be modulated by dedicated ADSR envelope, dedicated LFO and key tracking
    • LFO has same waveforms as pitch LFO (can be retriggered by note on) and rate can be set to match MIDI clock (tempo) with variable delay per bar


    Amplifier
    • Dedicated ADSR envelope
    • Glide (up to 1 octave range) with variable time
    • Volume for DAC output
    • Effect amount and mix - currently for stereo chorus but could be set up to allow choices in programmer


    Programmer
    • 160x80 IPS colour display
    • Encoder with button for data entry, Back button for menu navigation
    • Save and Recall buttons for storing patches, holding Recall initialises the current patch to match the panel controls
    • The programmer makes the synth very flexible with possibilities for changing User waveforms, alternative filters, alternative effects with further parameter settings.



    MIDI
    • USB HOST MIDI Class Compliant (direct connection to MIDI controller, no PC needed)
    • USB Client MIDI In from PC
    • MIDI In 5 pin DIN



    Audio
    • SGTL5000 Audio Shield 16 bit, 44.1 kHz Stereo out
    • USB Audio in/out—appears as 16 bit, 44.1 kHz audio interface on PC



    Hardware
    • Teensy 3.6 with SGTL5000 Audio Shield. Two 4061 multiplexers providing 32 channels from the pots into two ADCs. The rest of the pots and switches use remaining pins on Teensy.
    • Enclosure is laser cut acrylic with etched labels filled with yellow acrylic paint (this technique could be improved with experimentation), end cheeks are 3D printed.
    Hi there UHF,
    absolutely amazing synth, I am keenly following this as my first Teensy synth and have built my own version of the front panel (pics to follow) but have a couple of questions which I hope will help me figure out the wiring:
    Firstly - can you tell me how the rotary switches are wired - are they just wired up with Resistors in serial to supply a variable voltage to the board, if so do you have the values of resistors you used to get the particular voltages to translate into the needed midi number?
    secondly - what is the small black board just below the display in the photo from the rear (red, white Grey and black wires)
    I am attempting to port it over to the Teensy 4.0 but would be grateful if you know of any possible points that might trip me up.
    All the best.
    Archie

  16. #16
    Hello Archie. That's great! Have you got just the basic Teensy + audio board producing sound with a MIDI keyboard?
    Yes, the rotary switches have resistors (all about 1k5) between each pole in series - so they just act like potentiometers with fixed resistance at each pole and are read by an ADC via the MUX. In checkMux(), the 10 bit value is bit-shifted by 3 to convert the value down to 7 bits which correspond to 0-127 MIDI CC values. You could just use a potentiometer instead of rotary switches without changing the code, which is what I'm intending to use in future - see below.

    The small black board is the PCB on the cheap, mass-produced Keyes KY-040 encoder. I would recommend using a nice ALPS or Bourns one instead with detent and push switch.

    I haven't got a Teensy 4.0 yet and am waiting for the large version that's being planned for next year. I had problems with trying to connect the SPI for the display to the same SPI bus used on the audio board, so I moved it to different pins. I can't think of any problems specifically using a T4.0. I'm still working on the code. It now has six voice polyphony (maxing 81% cpu and 44 audio memory on T3.6), pitch mod by filter envelope, white and pink noise level choice on one pot and various other improvements, particularly to the display.


    Future plan
    If anyone's interested, I'm currently working on a PCB plus a PCB-based front panel (my first). It will have the two surface mount MUXs and the MIDI In opto components already on it (courtesy of possibly JLC PCB). The rest is up to the individual to buy and solder the Teensy, audio board, connectors, 33 10k pots, display and encoder, plus hardware for a case (I'll provide a design for a laser cut/3D printed one). A step further is having the Teensy and audio components already on it like the recent Kelpie synth. I'm planning to get rid of all buttons/switches and will replace them with capacitive touch switches on the front panel to make assembly easier, although whether these will work sending a signal from the front panel back to the Teensy, I'll find out. It will look something like this and be promoted as a DIY $99 12(16?) voice polyphonic programmable synth :

    Click image for larger version. 

Name:	Asthetic Mockup.jpg 
Views:	22 
Size:	223.3 KB 
ID:	18544

  17. #17
    Junior Member
    Join Date
    Nov 2019
    Posts
    7
    Quote Originally Posted by UHF View Post
    Hello Archie. That's great! Have you got just the basic Teensy + audio board producing sound with a MIDI keyboard?
    Yes, the rotary switches have resistors (all about 1k5) between each pole in series - so they just act like potentiometers with fixed resistance at each pole and are read by an ADC via the MUX. In checkMux(), the 10 bit value is bit-shifted by 3 to convert the value down to 7 bits which correspond to 0-127 MIDI CC values. You could just use a potentiometer instead of rotary switches without changing the code, which is what I'm intending to use in future - see below.

    The small black board is the PCB on the cheap, mass-produced Keyes KY-040 encoder. I would recommend using a nice ALPS or Bourns one instead with detent and push switch.

    I haven't got a Teensy 4.0 yet and am waiting for the large version that's being planned for next year. I had problems with trying to connect the SPI for the display to the same SPI bus used on the audio board, so I moved it to different pins. I can't think of any problems specifically using a T4.0. I'm still working on the code. It now has six voice polyphony (maxing 81% cpu and 44 audio memory on T3.6), pitch mod by filter envelope, white and pink noise level choice on one pot and various other improvements, particularly to the display.


    Future plan
    If anyone's interested, I'm currently working on a PCB plus a PCB-based front panel (my first). It will have the two surface mount MUXs and the MIDI In opto components already on it (courtesy of possibly JLC PCB). The rest is up to the individual to buy and solder the Teensy, audio board, connectors, 33 10k pots, display and encoder, plus hardware for a case (I'll provide a design for a laser cut/3D printed one). A step further is having the Teensy and audio components already on it like the recent Kelpie synth. I'm planning to get rid of all buttons/switches and will replace them with capacitive touch switches on the front panel to make assembly easier, although whether these will work sending a signal from the front panel back to the Teensy, I'll find out. It will look something like this and be promoted as a DIY $99 12(16?) voice polyphonic programmable synth :

    Click image for larger version. 

Name:	Asthetic Mockup.jpg 
Views:	22 
Size:	223.3 KB 
ID:	18544
    Thanks very much for the info - very much appreciated. I have decided to go the route of using a 3.6 and audio board ( why run before I can walk eh ) so will follow your project more easily - could I ask one more question please? - what breakout board did you use or can I use any commercially available one?
    I would be very interested if you start manufacturing kits - the reason I am attempting this one is that I want to start a music tech/electronics enrichment class at the school where I teach electronics and this would be a brilliant project for them if the pcb and panel are already done. Please let me know when kits become available.
    I would just like to show you how far I have come with my version so far. The front panel is two layer - the bottom layer 3mm black acrylic and the top layer 5mm clear acrylic laser etched on the rear in reverse and it will be then lit by blue led's all around to highlight the etching - sounds weird but I got the idea from pub signs where they are clear acrylic but with glowing letters. I will post some more pics when I have finished drilling and installing the led's and fitted it into the case ( I am thinking of aluminium end panels as I have access to waste I can use) I have ordered knobs just waiting for them to arrive so they will change in the final version and I have used slider pots with led's built in and a rotary encoder with a clear plastic shaft which again will have an led fitted so the knobs and buttons you see are just for a mock up for proportions.
    Hope you like my efforts. Sorry for the dark picture, I will post some better ones soon.
    I also have to cut the panel for the display (doh! missed it on the original 2D design)
    Click image for larger version. 

Name:	Tsynth 1.jpg 
Views:	13 
Size:	79.4 KB 
ID:	18548

  18. #18
    Wow it's coming on! I didn't use a breakout board, just a normal 5x7cm protoboard. The Teensy is mounted on pin sockets and all the pins broken out to right-angle pin headers. As mentioned, I use Du Pont connectors - don't do this, they are too stiff and awful to solder. Use very flexible wire and some other scheme. I used this mass-produced display. All the rest of the pots, switches and knobs were similarly the cheapest. The sliders are decent ALPS ones. I built the whole thing for my own amusement and didn't anticipate going any further with it. You might find the following useful when referring to the pin connections in the code, it's what worked for me:
    Click image for larger version. 

Name:	Annotation 2019-12-27 095859.png 
Views:	21 
Size:	27.8 KB 
ID:	18550

    As mentioned, I am still working on the code and will make an attempt at proper commenting when uploading to Github now. The README has more information about using it too.

  19. #19
    Junior Member
    Join Date
    Nov 2019
    Posts
    7
    Brilliant, thanks very much for this, great help.
    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •