Advice on connecting multiple analog inputs to multiple Teensy4s via I2C

Status
Not open for further replies.
I am designing a polyphonic synthesizer that will generate 88 notes in parallel from multiple Teensy4s. Each note will have a separate pitch bend input via a slider potentiometer. In order to reduce the number of input pins used, I would like to connect the 88 potentiometers to the Teensy4s using I2C.

I was looking at 16 channel I2C ADCs. Can multiple I2C ADCs be chained up to get the 88 channels that I need, to make the equivalent of one 88 channel ADC?

If so can this output then be connected to many different Teensy4s?
 
If it is a cluster of Teensies handling 88 notes, does every note handler need to know every note being handled by every other note handler? IOW, what you are describing is a problem where you might have 11 Teenies each handling 8 notes. In such case one 16 input multiplexer on each Teensy will give you 16 inputs that can be scanned at least at 2kHz, maybe even 4k. This gives you 16 "generic" control inputs of reasonably latency, modules that can be replicated, and a pretty generic software setup where you'd only need to set one variable (note group, for example) for each individual "tone bank."
 
If it is a cluster of Teensies handling 88 notes, does every note handler need to know every note being handled by every other note handler? IOW, what you are describing is a problem where you might have 11 Teenies each handling 8 notes. In such case one 16 input multiplexer on each Teensy will give you 16 inputs that can be scanned at least at 2kHz, maybe even 4k. This gives you 16 "generic" control inputs of reasonably latency, modules that can be replicated, and a pretty generic software setup where you'd only need to set one variable (note group, for example) for each individual "tone bank."

The individual Teensy boards don't need to know what is happening on the other Teensy boards.

Someone else was telling me to use a multiplexer instead is I2C.

He also said I could use 1 Teensy to do all 88 notes by sending note information to peripheral timer chips. He suggested the TLC5940. It is a 16 channel LED brightness controller that uses PWM. Not sure how much control there is over the frequency. Perhaps there are other multi channel timers out there. It would be good to know what they are.
 
One Teensy 4.x+ Audio Shield (Rev D) should be able to do what you want

The individual Teensy boards don't need to know what is happening on the other Teensy boards.

Someone else was telling me to use a multiplexer instead is I2C.

He also said I could use 1 Teensy to do all 88 notes by sending note information to peripheral timer chips. He suggested the TLC5940. It is a 16 channel LED brightness controller that uses PWM. Not sure how much control there is over the frequency. Perhaps there are other multi channel timers out there. It would be good to know what they are.

Nick:

I've seen several posts where @Paul gives a conservative estimate for the Teensy 4.x + Audio Shield of 100 simultaneous waveform generators. That alone probably indicates that you should be able to use a single Teensy 4.x + Audio Shield for your project. In my recently completed TeensyMIDIPolySynth (https://forum.pjrc.com/threads/60690-queued-TeensyMIDIPolySynth?p=237404&viewfull=1#post237404), I am using the Teensy 4.0 + Rev D Audio Shield. I'd like to run thru some numbers supporting the suggestion that a single Teensy 4.x + Rev D Audio Shield should definitely allow you to provide the single-voice 88-note polyphony that I believe you are designing for.

My TeensyMIDIPolySynth supports 16-note polyphony, with two voices per note. There are 6 VFO waveform generators + 2 noise generators per voice, per note. There are also 2 LFOs (one for the filter & one for FMing the VFO waveform generators), with 7 waveform generators per LFO. Adding all of these waveform generators up (ignoring the noise sources) gives (16 notes x 6 VFO waveforms x 2 voices) + (7 LFO waveforms x 2 LFOs) for a total of 206 waveform generators. All of these are always running, & running simultaneously from startup !!

Using these numbers as a guide, I would think that you could design your project for at least 2 VFOs per note, & maybe even 3 VFOs per note if you desired. These would all be implemented using the built-in capability of the audio library. I will do my best help answer any other questions that you might have along these lines.

On the subject of analog MUXs, I am using 6 74HC4067 16:1 MUXs in my project. These are used to allow me to read 48 pots & 42 pushbuttons. Using this MUX is excellent for reading either analog inputs (like my pots) or digital inputs (like my pushbuttons). You can cycle thru these inputs very quickly & do many readings, consuming only a few dedicated pins on the Teensy. I will do my best to also answer any other questions that you may have on this subject as well.

As for your pitch bend input, it is as simple as reading your slider with an analog input (could be thru a MUX, but more likely thru a dedicated Axx pin on the Teensy), defining a DC generator (another audio library object/component named dc) to generate an appropriate DC level based upon the pot value read, & feeding that into the MOD input of the modulated waveform generator (named waveformMod) object/component. Very easily accomplished !! Again, all using built-in capabilities of the audio library !!

I really can't say enough about the complex & versatile capabilities that are built into the audio library, yet it is all very easy to use !!

Good luck & have fun !!

Mark J Culross
KD5RXT
 
Nick:

I've seen several posts where @Paul gives a conservative estimate for the Teensy 4.x + Audio Shield of 100 simultaneous waveform generators. That alone probably indicates that you should be able to use a single Teensy 4.x + Audio Shield for your project. In my recently completed TeensyMIDIPolySynth (https://forum.pjrc.com/threads/60690-queued-TeensyMIDIPolySynth?p=237404&viewfull=1#post237404), I am using the Teensy 4.0 + Rev D Audio Shield. I'd like to run thru some numbers supporting the suggestion that a single Teensy 4.x + Rev D Audio Shield should definitely allow you to provide the single-voice 88-note polyphony that I believe you are designing for.

My TeensyMIDIPolySynth supports 16-note polyphony, with two voices per note. There are 6 VFO waveform generators + 2 noise generators per voice, per note. There are also 2 LFOs (one for the filter & one for FMing the VFO waveform generators), with 7 waveform generators per LFO. Adding all of these waveform generators up (ignoring the noise sources) gives (16 notes x 6 VFO waveforms x 2 voices) + (7 LFO waveforms x 2 LFOs) for a total of 206 waveform generators. All of these are always running, & running simultaneously from startup !!

Using these numbers as a guide, I would think that you could design your project for at least 2 VFOs per note, & maybe even 3 VFOs per note if you desired. These would all be implemented using the built-in capability of the audio library. I will do my best help answer any other questions that you might have along these lines.

On the subject of analog MUXs, I am using 6 74HC4067 16:1 MUXs in my project. These are used to allow me to read 48 pots & 42 pushbuttons. Using this MUX is excellent for reading either analog inputs (like my pots) or digital inputs (like my pushbuttons). You can cycle thru these inputs very quickly & do many readings, consuming only a few dedicated pins on the Teensy. I will do my best to also answer any other questions that you may have on this subject as well.

As for your pitch bend input, it is as simple as reading your slider with an analog input (could be thru a MUX, but more likely thru a dedicated Axx pin on the Teensy), defining a DC generator (another audio library object/component named dc) to generate an appropriate DC level based upon the pot value read, & feeding that into the MOD input of the modulated waveform generator (named waveformMod) object/component. Very easily accomplished !! Again, all using built-in capabilities of the audio library !!

I really can't say enough about the complex & versatile capabilities that are built into the audio library, yet it is all very easy to use !!

Good luck & have fun !!

Mark J Culross
KD5RXT

That is all very helpful, apart from the fact that I need all my notes out on separate pins. The idea is to used the Teensy as an accurate pitch source in a mostly analog synthesiser. There will be a separate VCA VCF... for every note. Do you know of any multi channel timer chips that can receive frequency information via a serial out from the Teensy and output square waves?
 
That is all very helpful, apart from the fact that I need all my notes out on separate pins. The idea is to used the Teensy as an accurate pitch source in a mostly analog synthesiser. There will be a separate VCA VCF... for every note. Do you know of any multi channel timer chips that can receive frequency information via a serial out from the Teensy and output square waves?

So do you really need the mad scientist stuff of having 88 knobs and 88 channels all playing tones at once? If that's the point then I get it, but for all that you really need only about three or four Teensy, or perhaps even one depending on if you just need square waves or you need something better. I'm curious, are you planning to have 88 LFO oscillators as well, to modulate the 88 VCFs and 88 VCAs? One LFO for each? That's like 6 knobs per note already! How many knobs will this thing have? sounds like fun but a LOT of soldering if you don't make pc boards at least for the sliders and muxes.

A single teensy could generate 32 square waves on its digital pins. That's three for almost 100 tones and pretty easy. That would mean two 16 input muxes for your sliders and a Teensy for 32 notes. But if you want an analog signal chain with polyphonic capabilities, a single Teensy with an 8 channel DAC will give you 8 polyphonic streams of any signal you like sent to 8 separate, controllable analog processing chains. Combine that with one 16 channel PWM controller and you have 8 multiphonic signal outputs and 16 control voltage outputs from three chips. You could essentially build your own Prophet 5 with its own digital synth to model the waveform from each oscillator. That would allow full polyphony per voice with up to 8 analog processed voices. A lot more manageable and your entire digital section is only 3 chips plus however many analog input muxes you choose.

The Teensy can do a LOT of work.
 
Last edited:
So do you really need the mad scientist stuff of having 88 knobs and 88 channels all playing tones at once? If that's the point then I get it, but for all that you really need only about three or four Teensy, or perhaps even one depending on if you just need square waves or you need something better. I'm curious, are you planning to have 88 LFO oscillators as well, to modulate the 88 VCFs and 88 VCAs? One LFO for each? That's like 6 knobs per note already! How many knobs will this thing have? sounds like fun but a LOT of soldering if you don't make pc boards at least for the sliders and muxes.

A single teensy could generate 32 square waves on its digital pins. That's three for almost 100 tones and pretty easy. That would mean two 16 input muxes for your sliders and a Teensy for 32 notes. But if you want an analog signal chain with polyphonic capabilities, a single Teensy with an 8 channel DAC will give you 8 polyphonic streams of any signal you like sent to 8 separate, controllable analog processing chains. Combine that with one 16 channel PWM controller and you have 8 multiphonic signal outputs and 16 control voltage outputs from three chips. You could essentially build your own Prophet 5 with its own digital synth to model the waveform from each oscillator. That would allow full polyphony per voice with up to 8 analog processed voices. A lot more manageable and your entire digital section is only 3 chips plus however many analog input muxes you choose.

The Teensy can do a LOT of work.

It will not have as many knobs as you think, only the pitch bend will have per note control. Everything else will have one global control per effect.

Each note will need 2 square waves, one phase modulating in relation to the other. Also each note will need a DC reference voltage to represent the amount of pitch bend. This is because the square waves will be converted to triangle waves using an integrator. The amplitude of the triangle wave will decrease as the pitch increases. The DC voltage will be used via a VCA to compensate the amplitude change.

The triangle wave will then be converted to a saw wave by inverting only one half of the triangle. The saw will be converted to PWM modulated by the LFO or DC from a knob.

I like to do true polyphony. It is more components, but easier to understand and keep track of.

I don't know how to use the digital pins for pitch outputs. I assume you can't just specify a frequency with one command like you can with the PWM outputs.
 
You can't convert a square wave to triangle over a ten octave range using a simple integrator - you need a tracking filter for that. Your two square waves mixed down represent basically three states: 00, 01 and 11. That's essentially a triangle or sine hacked to two bits. So now you need TWO pins to mix for each output? Now you're down to 16 tones from a chip.

I don't understand why you're using Teensies. What you want to do can be done in pure analog with 88 knobs and 176 555 timers and it might still be less soldering than the alternative you're proposing. It might help if you gave a better idea of why you want this pure analog chain but are trying to use a microprocessor?

I like to do true polyphony. It is more components, but easier to understand and keep track of.

Much more expensive the way you are proposing. You can do awesome things with 8 dac outputs and 8 analog processing chains. Solving problems like this is part of being an engineer.

I don't know how to use the digital pins for pitch outputs. I assume you can't just specify a frequency with one command like you can with the PWM outputs.

You create a main loop() of 20uS or so that runs 32 digital oscillators and each time through the update you output the MSB of an oscillator to a pin. The Teensy4 has plenty of oomph to do this with a simple c function. But going the 176 oscillators route is very labor and money intensive.
 
I'm also curious: why 88? Is it because a piano has 88? There are an infinite number of notes, why be arbitrary? You only have two hands and maybe 11 or twelve fingers at best. Just curious.
 
You can't convert a square wave to triangle over a ten octave range using a simple integrator

The integrator only needs to track 2 octaves of pitch bend plus one octave of semitone offset (explained below). The capacitor and resistor values are set separately for each note to produce the correct amplitude for the note at zero pitch bend.

I don't understand why you're using Teensies.

I need some form of digital square wave starting point for pitch accuracy. If there was no pitch bend or semitone offset I would use Hartley oscillators from old organs. The Teesny4 seems powerful and easy to program.

It might help if you gave a better idea of why you want this pure analog chain but are trying to use a microprocessor?

I built a version of this synthesizer already using purely analog. It sounds beautiful. It needs remaking to a higher standard as it is very unreliable. I would like more control over the pitch this time.

Solving problems like this is part of being an engineer.

I am more of an instrument designer than an engineer. There are some advantages to having full polyphony when there is sustain on the note and with the tuning system I am using.

I'm also curious: why 88?

It has 22 notes per octave using just intonation. There will be a rotary switch to select the starting note in semitones, this will change the pitch of every note by an equal number of semitones.
 
Status
Not open for further replies.
Back
Top