24 Analog Outputs

Status
Not open for further replies.
Hello,

I've got an idea for making a synth with the Teensy4.0. For it to work, I would need at least 24 continuous true analog signals to output from the Teensy.
It can't be a PWM signal, and it mustn't break off (like I assume a MUX/DEMUX would do).

They will be outputting CV signals (only from 0-3.3v instead of 5v)

What options do I have?
Could I use a bunch of I2C DACs?
Or I2S?
Something else?

Thanks in advance!
-Chime
 
Without knowing the bandwidth, resolution, DC accuracy, reference stability or other specs required, I'm going to guess you'll be happiest with "bunch of I2C DACs".

Then again, if you need full audio bandwidth on all outputs, TDM is probably your only realistic option. But with the code that exists today, you'll only be able to connect two CS42248 boards for 16 outputs.
 
Thanks for your reply Paul,

This idea is still in the thought stage... perhaps even more of theoretical stage for the moment, so I don't know all the specs I would be working with..
However I do think I would want at least 12 or 16 bit resolution and a bandwidth of more than 4 bytes per output per millisecond.. as in I'd like each output to be able to change at least once a millisecond.

I am unsure what DC accuracy and reference stability are.. or what other specs I should be considering, would you mind explaining them to me?
In the meantime, I'll start looking into I2C and TDM options.

Thanks again for your help I really appreciate it!
 
12 or 16 bit resolution and a bandwidth of more than 4 bytes per output per millisecond
16 bit = 2 bytes. so 4 bytes per millisecond are 2*16 bit per millisecond - or 1*16 bit per 500 microseconds. divide this by your 24 channels:
500/24 = 20 microseconds. 20us / 16 = 1.25 us per bit. 1/1.25us = 0.8Mhz = 800KHz.
Plus addressing.

Is this calculation correct?

With SPI, it is possible (but you need 24 chipselect signals if you use single-channel DAs).
I2C maybe not (you would need multiplexers because I don't think I2C chips with 24 different adresses exist)
If you find chips with FAST I2C (1..4MHZ) und use two IC buses it might work..
 
Last edited:
I'm not sure about the math... here is how I figure it..

Let's say I go with 16bit resolution, that means I need to send out 2 bytes of data per channel in a millisecond. 16 bits/ms * 24 channels = 384bits/ms.. or 384KHz (plus addressing and/or start/stop bits.)
Does that make sense?

Unrelated to that exactly... I found a 12 channel I2C/I2S/TDM (ADAU1962AWBSTZ, links below). If I wrote the interface code myself (since I'm guessing nothing in the audio library quite fits that description) could I use 2 of these to get 24 channels?

I'll also take a look into SPI and FASTI2C options.

ADAU1962AWBSTZ:
 
I looked at the ADAU1962A datasheet briefly. I didn't see good drawings for the TDM waveforms (figure 20 leaves much to be desired). But TDM16 mode looks promising, for use with the 16 channel TDM output from the audio library.

However, ADAU1962 appears to be designed for audio usage. Look at the example output circuits on page 13. They all have DC blocking capacitors in their signal paths. Maybe not quite what you want for synth control voltage?

On the plus side, the audio lib does have TDM2 support for Teensy 4.0, even though it's not (yet) shown in the design tool. So if ADAU1962's TDM16 mode works, you could use TDM and TMD2 to send two 16 channel streams to 2 of those chips.
 
@Frank, Just an FYI that Microchip has a 12-bit quad output I2C DAC, the MCP4728 that can have up to 8 different I2C base addresses. Only the -0 and -1 address versions are available at DigiKey or Mouser, but Microchip will sell direct from their factory store in Malaysia for not much more than DigiKey. No minimum and they take credit card as payment. Shipping is very prompt. They can set them to the desired address dash option to allow one to have a 32-output DAC if so desired.

I'm not connected with Microchip. Just a lab guy that had a need and found out they could deliver.
 
Thanks everyone for all the great info!
Up until last year I'd mostly messed only messed with programming and simple circuits, so a lot of this info is new to me. Right now, I can look at a circuit diagram, and tell what each individual symbol is/does, but can't say what exactly the circuit does as a whole without an explanation (like the DC blocking capacitors). Thank you for your patience.

@PaulStoffregen, if I could get the chip to work with TDM and TDM2 that sounds like a great option. I've used the audio library directly before, so I should be able to figure out how to get at the TDM2 stuff. I may have to pick up a ADAU1962A and see if I can make it tick. I am worried about about the capacitors you mentioned though.. I might have to experiment a bit and see what happens..

@grease_lighting, cool, I'll have to take a look and see if that would be a good fit. I would prefer to minimize the number of chips needed, but I'm not above getting tons of I2C DACs if that's how it has to be.

@bacteria, I was under the impression that when you set a value on a DE/MUX chip that it only keeps that value as long as that line is selected. I'm only used MUXs for input so far though, not output.
So if I do an AnalogWrite() to one line, then switch to another, the first line will hold it's value?
That seems wrong somehow..
 
@bacteria, I was under the impression that when you set a value on a DE/MUX chip that it only keeps that value as long as that line is selected. I'm only used MUXs for input so far though, not output.
So if I do an AnalogWrite() to one line, then switch to another, the first line will hold it's value?
That seems wrong somehow..

Yes you are right the (de-)multiplexer such as 4067/4051 type, will not hold its analog voltage value - for that you will need either some of the old-fashioned (output) sample and hold circuits or a DAC
 
Last edited:
Obviously you don't depend on donations but i'd love to sponsor a dev board for you or anybody else seriously looking into writing teensy drivers for the 19XX series or even this AD5370 https://www.analog.com/en/design-ce...tion-boards-kits/eval-ad5370.html#eb-overview
what all teensy boards as well as the new daisy board or axoloti platform lack for use in analog audio systems is a bunch of convenient, possibly flexible CV i/o. and with "a bunch" i mean 16+
 
This weekend I've committed I2S quad, hex and octal output. Code is on github, and will be in 1.52.

I believe it should theoretically be possible to also transmit 4 TDM16 streams from SAI1, instead of 4 stereo I2S streams. To test this crazy idea, I started a PCB with the ADAU1966 chip. It will have stacking headers, so 4 of them can stack up. I'm still not 100% sure if it can be made to really work, but perhaps 64 outputs could be possible. We'll find out....
 
64 outputs would be incredible!

Would it be possible to configure the maximum voltage it sends? I know the Teensy 4.0 is limited to 3.3v, but it would be pretty cool to send real 0-5v CV signals to other devices.
 
I'm having a little trouble understanding what is meant here in this thread by "CV" signal. I understand CV signals to typically modulate the parameters you would otherwise manually change with a Potentiometer, and these typically range from DC to perhaps 2kHz, depending on what is being modulated (obviously there is no strict rule to that, as audio rate modulation is fundamental to AM and FM synthesis techniques).

What do you plan on controlling with 24 voltages? Do those voltages need to periodic, and if so, what is the maximum frequency, (and range) you want them to be able to swing?

This is important, and depending on the answer, you may not actually need an expensive DAC to reach your goals. PWM work just fine for CV signals if filtered, If that's not adequate, there are inexpensive ICs like MAX11300 which will get you 20 DAC outputs at +-5V or +10V, addressable via SPI, if you can live with the 40us settling time. Perhaps you could share a little more detail about what your are trying to achieve?

On a side note, the ADAU1966 DAC looks really interesting. It is an audio CODEC so it's not really optimal for producing CV signals, but 16 (or 64) audio rate outputs, and an MCU that can drive it - there is a lot of creative potential in that.
 
Control Voltage (as I understand it) is a loose standard for sending signals (like Low Frequency Oscillators, Gates, and Triggers) between different synth modules using patch cables. It was created in the 40s and uses differing voltages to send this info. For my project, I would like it to align with the Eurorack standard(invented in the 90s) as much a possible, though I understand that might not be possible.

With the 24 voltages, I'd like the user to be able to use patch cables to route output CV to input CV as they see fit. For range.. 0-5v or -5v to 5v would be nice, but I'd be okay with 0-3.3v since that's what the teensy is capable of. Frequency... I'd like it to be able to change faster than a human would be able to detect, does that help answer that?

The idea behind my original question was to see if it would be possible to make an all-in-one digital modular synth using a Teensy4.0 as the brains, something like the Behringer Neutron which has lots of inputs and outputs for CV. I'd like to see how far I can push the Teensy in this direction.
NeutronMod-large.jpg

Filtered PWMs may work.. but I'd still need a way to control all of them while using as few pins as possible, since I would need those other pins for other stuff. I couldn't just DE/MUX them since the signal would break.. so I'd need external PWM chips to keep the signal going.. and if I'm going to use an external chip, might as well get one that does exactly what I want, right?

I'll look into the MAX11300 It might be close to what I am looking for, though I might just have to settle on a bunch of MUXd DACs..


On a side note... why would something made for audio output be un-optimal for CV output? They are both rapidly changing analog voltages.. and audio can be used to control CV.. so I'm afraid I don't quite understand the problem..
 
why would something made for audio output be un-optimal for CV output?

Audio bandwidth is approx 20 Hz to 20 kHz. Many circuits designed for audio do not have accurate or consistent performance below 20 Hz, especially at 0 Hz (DC).

Full scale output change (or "gain error" in audio lingo) better than 0.1 dB to 0.01 dB is usually considered good for audio. As a result, audio DACs almost never are designed for an external voltage reference. Their built in reference is fine. It if varies slightly with time (much lower than 20 Hz) and temperature, usually not an issue. What matters for audio is relative resolution, and keeping noise low.

But for instrumentation usage, you probably want much better accuracy. DACs made for controlling devices almost always offer a way to connect an external voltage reference chip. For high accuracy, either very accurate chips or circuits with calibration are used. Or often the voltage is very accurately measured during product testing and correction factors are stored in non-volatile memory.

Those sorts of techniques are almost never needed for audio, because the accuracy under 20 Hz doesn't matter at all, and even moderate errors in the full scale voltage are the equivalent of changing the volume by an insignificant amount. But when you use voltages to control parameters, especially the frequency of tones, small errors and offsets at DC or low frequencies matter. They can cause frequencies to be generated out of tune, or effects to be applied not exactly as intended. Often small errors don't matter, but sometimes errors manifest in very noticeable ways.
 
Last edited:
i currently use the maxx11300PMB dev board in a similar application. the configurable voltage ranges really lend themselves to eurorack use. you can supply it external 12v or it can generate up to 70mA from the controlling MCU 3.3v internally.

that beeing said i did have some (digital) noise issues with it every now and then. might be causedd by something else in my system though.

so while i guess on teensy it wouldn't be a big deal to chain 2 or 3 of those via SPI, i'd still be very interested in any of these higher resolution audio codecs llike the ADAU1966, externally scaled up to 10vpp.
because other than the refresh rate that's been discussed here, something like the max11300 12bit resolution are really borderline for precise pitch tracking over a wide range following the 1V/oct standard. iirc, on the standard 10v/octaves range, 12bit leave you with around 3ct per bit? in an ideal world that is, so realistically probably 6-12 cent per bit. which is why a lot of "cheap" digital controlled CV generators are limited to 5 octaves...

i never though about the low frequency limitations, how would you guys (paul?) assume the 1966 or others that have been discussed perform in that regard? for LFOs you surely want to be able to go below 1Hz.
 
I have no idea about any of this, but I would imagine from a physical angle that when you get above a certain number of connections, that it may be time to break into smaller parts, say one Teensy doing 8 outputs, and having one master Teensy to control them. Even assuming a Teensy can handle 24 or more, you have the issue that you have to check (and recheck) each of the connections to make sure things are ok, and if things get messed up, having to redo the whole thing.

In addition, you can use wire colors to indicate which connection is which if you have 8-10 connections. My wife tells of a time when her dad (at the time of the story, he was an electrician at Con Ed. in New York) had to rewire one of the oldest bars in the city (while the bar was still operating), and it was just a mess trying to figure which wire connected where (all wires were brown).

When a Teensy with 8 connections gets messed up, it is tedious but doable to rework the connections. If a Teensy with 24 connections gets messed up, it will take a much longer time to recover. And once you have the split the load among multiple Teensys, make a few extras for when you need to replace them.

So you might spend a few minutes to think is there a way to make things more modular, and easier to debug in the future.

Or not, remember I am not an expert (in this area). But I've had to deal with a lot of messes barely held together with bailing wire and twine (mostly software, but a few circuits). Even if I laid things out originally, I might not remember the details 6 months later.
 
With the 24 voltages, I'd like the user to be able to use patch cables to route output CV to input CV as they see fit. For range.. 0-5v or -5v to 5v would be nice, but I'd be okay with 0-3.3v since that's what the teensy is capable of. Frequency... I'd like it to be able to change faster than a human would be able to detect, does that help answer that?

OK, so you'd like to programmatically produce CV voltages at Eurorack levels. I have a Behringer Neutron, so perhaps I can point you a bit in the right direction.

0-3.3V CVs are not going to get you very far in Eurorack. If modulating a V/Oct parameter, you will logically only be able to control a range of 3.3 Octaves. The VCA in the Neutron needs +9V DC to fully open, the VCF frequency expects +-5V DC. With a 0-3.3V range, or even a 0-5V range, you will not be able to fully modulate all of the parameters of the Neutron (and most other Eurorack modules as well). So, to effectively interface with Eurorack gear, your project should be able to produce voltages in the range of -10V to +10V DC (see this guide from Doepfer for more info). You will find information and examples of how to scale the output of a Teensy pin or DAC to Eurorack voltage levels all over this forum and the Internet.

On a side note... why would something made for audio output be un-optimal for CV output? They are both rapidly changing analog voltages.. and audio can be used to control CV.. so I'm afraid I don't quite understand the problem..

If I might expand a bit on the excellent explanation from Paul with some basics... Unlike audio signals, CV signals do not necessarily rapidly change, or even change at all. V/Oct CV signals typically control the frequency (pitch) of an oscillator, which will also output an analog voltage, possibly changing at a rate we can hear (>20Hz) if amplified and attached to a speaker. Because V/Oct CV signals control the oscillator frequency, they need to be stable and accurate DC voltages, otherwise the oscillator it is modulating will sound wobbly, and out of tune. That is why DC accuracy in V/Oct CV signals is so important, a few millivolts of error can actually result in a pitch difference that can be heard by the human ear.

That being said, there are a number of other uses for CV which do not require such a high level of DC accuracy. For example, when modulating a VCA, a few millivolts of error cause no audible volume difference, or as is often the case in Eurorack, modulating some knob with CV (LFOs are often used for this) almost never requires V/Oct level accuracy.


i'd still be very interested in any of these higher resolution audio codecs llike the ADAU1966, externally scaled up to 10vpp.
because other than the refresh rate that's been discussed here, something like the max11300 12bit resolution are really borderline for precise pitch tracking over a wide range following the 1V/oct standard. iirc, on the standard 10v/octaves range, 12bit leave you with around 3ct per bit? in an ideal world that is, so realistically probably 6-12 cent per bit. which is why a lot of "cheap" digital controlled CV generators are limited to 5 octaves...

I own a Polyend Poly 2 - a MIDI to CV converter module based on the MAX11300. They claim <5mV error throughout most of the 10 octave MIDI range on 8 of the "factory calibrated" outputs and <20mV error on the rest. In practice the module tracks as good as any other V/Oct CV sources I have. Having more than 12 bits of resolution available is only as useful as the DC accuracy of the DAC itself, plus whatever scaling circuitry follows it - The MAX11300 does not need any scaling circuitry, which removes that source of error from the equation.

i never though about the low frequency limitations, how would you guys (paul?) assume the 1966 or others that have been discussed perform in that regard? for LFOs you surely want to be able to go below 1Hz.

I can't speak to the ADAU1966 since I don't have one, but looking at the datasheet, it's speced similar to the CS42448 which I have tested quite a bit. To give you an idea of how these audio codecs perform with DC signals, have a look at my measurements:

Screenshot from 2020-03-04 12-40-57.png

Notice that the output error increases significantly as the DC voltage approaches full scale. Now for this test, I was passing a DC voltage to the ADC, through the Audio library, and back out of the DAC where it was measured, so it is possible that a synthesized DC signal would have less error. Nevertheless, the error you see in the table is before scaling the output signal to +-10V, and may also vary with temperature. While it might be possible to compensate for the error in software, it probably won't be easy.

To summarize I'd suggest separating potential CV signals into two categories:

1.) V/Oct, where DC accuracy affects something noticeable, like pitch.
2.) The rest. where DC accuracy affects something that is not noticeable.

When considering using an audio codec for CV signals, keep in mind that it will likely be most useful for the latter.
 
Status
Not open for further replies.
Back
Top