Best way to generate multiple analog waveforms for polyphonic synthesizer?

leif

New member
Hello,

I am currently working on a project using a Teensy 4.1 that involves creating a polyphonic synth. My idea is to use a Teensy 4.1 to do most of the work (oscillators, envelope generators, LFO, etc.) and then feed the analog output of each voice into analog filter ICs to give it more unique sound capabilities. I am aware that the Teensy Audio Library would be a great resource for doing this sort of thing, however I have also tried a more barebones approach using timers that trigger ISRs to generate samples from waveform lookup tables that are then sent to a SPI DAC. The main issue I have run into with this is when I have multiple timers running at once (since I would need a timer for every oscillator) the interrupts seem to interfere with each other and make the notes play out of tune (I am using the TeensyTimerTool library).

The main reason I haven't looked into using the Audio Library more was because in order to use analog filter ICs I will need a separate analog output for every voice (preferably at least 6). I wasn't sure if there would be a way to do this easier than the more barebones approach since I2S DACs seem less geared towards this sort of thing and there also just seem to be less simple and low cost options than SPI. I might be wrong since I have looked into the Audio Library and I2S DACs less, or maybe there is a good way to use SPI DACs with the Audio Library? Basically, is there a good way generate multiple analog waveforms without the Audio library that I haven't thought of, or is there a good way to do it with the Audio Library, and which path should I take?

Thanks!
 
Definitely go for the Audio library, unless you have some use case you've not mentioned that requires you to re-invent the wheel...

There are various options for multi-channel audio output: you can currently buy boards from AliExpress based on the obsolescent CS42448 6i8o part; there's work being done on a multi I/O board using TLV320AIC3104 parts; I've got the PCM3168 6i8o part working, though there's no production board available. It's even technically possible to hack 3½ audio adaptor boards onto a Teensy 4.x, though that's not the easiest thing to do ... I've never bothered to try it!

If you're only interested in outputs, I think the maximum achievable is 40 right now, and 80 when the TLV320AIC3104 project materialises. Should be enough.

Bear in mind that Teensy audio processing is usually 16-bit, though floating point support is available if you search - not sure if every module has been ported, though.
 
Definitely go for the Audio library, unless you have some use case you've not mentioned that requires you to re-invent the wheel...

There are various options for multi-channel audio output: you can currently buy boards from AliExpress based on the obsolescent CS42448 6i8o part; there's work being done on a multi I/O board using TLV320AIC3104 parts; I've got the PCM3168 6i8o part working, though there's no production board available. It's even technically possible to hack 3½ audio adaptor boards onto a Teensy 4.x, though that's not the easiest thing to do ... I've never bothered to try it!

If you're only interested in outputs, I think the maximum achievable is 40 right now, and 80 when the TLV320AIC3104 project materialises. Should be enough.

Bear in mind that Teensy audio processing is usually 16-bit, though floating point support is available if you search - not sure if every module has been ported, though.
Awesome thanks for the tips, I will begin exploring the Audio Library more.
 
For only 6 audio outputs, just using 3 stereo I2S DAC chips is probably the simplest way. Teensy 4.1 has 2 I2S ports. The 1st port has 5 data pins, where up to 4 can be outputs. Each I2S data pin gives you 2 audio channels. The 2nd I2S port has only 2 data pins, 1 for input and 1 for output. So if you go with I2S, the most you can get is 5 data pins for 10 audio channels. If you want more, then you'll need TDM.

If this is for something like modular synth, you should probably also keep in mind I2S/TDM audio DAC chips are designed for AC sound (above ~10 Hz) but not for DC accurate control voltage. SPI DAC chips vary in capability, but most are DC capable and have a VREF input pin you can use for accurate DC level. If you're sure you only need a DAC for sound output, normal I2S DAC chips are your best option. Good quality ones have features like built-in oversampling, and even the really cheap ones still give very good sound. But if you also need to use your outputs as CV, best to design for DC accuracy from the start because it's virtually impossible to get from normal audio DAC chips.

Software-wise, definitely explore the audio library. This 31 page (45 minute video) tutorial is the best place to start.

 
For only 6 audio outputs, just using 3 stereo I2S DAC chips is probably the simplest way. Teensy 4.1 has 2 I2S ports. The 1st port has 5 data pins, where up to 4 can be outputs. Each I2S data pin gives you 2 audio channels. The 2nd I2S port has only 2 data pins, 1 for input and 1 for output. So if you go with I2S, the most you can get is 5 data pins for 10 audio channels. If you want more, then you'll need TDM.

If this is for something like modular synth, you should probably also keep in mind I2S/TDM audio DAC chips are designed for AC sound (above ~10 Hz) but not for DC accurate control voltage. SPI DAC chips vary in capability, but most are DC capable and have a VREF input pin you can use for accurate DC level. If you're sure you only need a DAC for sound output, normal I2S DAC chips are your best option. Good quality ones have features like built-in oversampling, and even the really cheap ones still give very good sound. But if you also need to use your outputs as CV, best to design for DC accuracy from the start because it's virtually impossible to get from normal audio DAC chips.

Software-wise, definitely explore the audio library. This 31 page (45 minute video) tutorial is the best place to start.

Great, thanks for the guidance Paul! Seems like the Audio Library is the way to go.
 
Back
Top