USB interface for multi channel outputs, not just stereo

That sounds good. We probably need to make sure there are some suitable examples, and a bit of documentation, but apart from that I’m pretty confident it’s ready to go.
 
I'm late to the party. I've been working on something similar. How far along is this? Is it available in a repo somewhere? Just need the TL;DR. :)
 
Yes, my general plan for 1.61 is to start mid-April, mainly merging this and many other things from the last couple years. Plan is to cut off new stuff by mid-June and make a 1.61 release before July.

Plan for 1.62 is a gcc toolchain update. That may go smoothly, or might involve a lot of pain. Difficult to know. General plan is to wrap up 1.62 late in 2026.

Does this mean that multichannel USB audio is going to be part of the new 1.61 release? If so that's huge!

What is the interface that is planned for this? Will there be 4x4 and 8x8 usb audio objects in the Audio Library?
 
Last edited:
Does this mean that multichannel USB audio is going to be part of the new 1.61 release?
Well…
Yes, my general plan for 1.61 is to start mid-April, mainly merging this and many other things from the last couple years. Plan is to cut off new stuff by mid-June and make a 1.61 release before July.
Obviously this is already a month adrift, and not sure if the target date is still the same.

But also
We probably need to make sure there are some suitable examples, and a bit of documentation
which we haven’t done. @alex6679 , are you OK if I pop together a suitable PR for Paul’s consideration? I’ll probably start with what we have now, plus maybe a couple of really simple examples, say 8 synth waveforms to PC, and 8 PC channels mixed to a stereo I2S output. There’s documentation for the Design Tool: not sure where I’d put more, or what I’d need to add, so maybe that could wait for guidance from @Paul.

What is the interface that is planned for this? Will there be 4x4 and 8x8 usb audio objects in the Audio Library?
Yes, we have added 4-, 6-, and 8-output and -input objects to the library. Just use as before.

In addition, because you need to add a Tools menu entry to select the number of supported USB audio channels, we took the opportunity to add entries for audio sample rate and block size. These obviously default to 44.1kHz and 128 samples, but we’ve tested up to 96kHz and 16 samples. A number of folk want one or both of these, for various reasons, but it does add some complexity so we’ll have to wait and see if Paul approves!
 
I've done a couple of PRs, one for the Audio library and one for cores. It's all still a bit messy because there's no way of doing a PR for the required Tools menu changes, but suitable examples are included as part of the cores PR, and I'm sure Paul will be able to figure them out, or ask if anything's unclear.
 
Just want to confirm I'm planning to merge this in 1.62 or 1.63.

Immediate plan is to wrap up 1.61 sometime next week.

My immediate plan for 1.62 is upgrading the gcc toolchain from 11.3 to 15.2. First beta for 1.62 will have the new toolchain update with zero library changes from 1.61. Depending on how the toolchain update goes and how much other stuff needs fixing to work with the new toolchain, a 1.62 release might feature only the toolchain and urgent bug fixes, with new features delayed until 1.63. Or if the toolchain looks good early, maybe I can start merging this and a number of other things into 1.62.
 
which we haven’t done. @alex6679 , are you OK if I pop together a suitable PR for Paul’s consideration? I’ll probably start with what we have now, plus maybe a couple of really simple examples, say 8 synth waveforms to PC, and 8 PC channels mixed to a stereo I2S output. There’s documentation for the Design Tool: not sure where I’d put more, or what I’d need to add, so maybe that could wait for guidance from @Paul.

If y'all need any help writing or testing examples I'd be open for this. 8-channel USB audio would be a huge help on an upcoming project.

I have CS42448 based 8x8 hardware I can test with as well as the Platypus 8-Channel.
I've done a couple of PRs, one for the Audio library and one for cores. It's all still a bit messy because there's no way of doing a PR for the required Tools menu changes, but suitable examples are included as part of the cores PR, and I'm sure Paul will be able to figure them out, or ask if anything's unclear.

Is it possible to build working Teensyduino from one of these PRs to get 8x8 audio working before teensy 1.63 release?
 
Is it possible to build working Teensyduino
Sure it is. It’s just a bit messy to get set up, but people have been doing it successfully over the couple of years it’s been in development.

The instructions for doing it the old way are in the ReadMe over at https://github.com/alex6679/teensy-4-usbAudio/tree/main, and involve copying a few files into cores, Audio and the Arduino IDE boards / platform files.

You could probably achieve the same effect by using the submitted PRs, which would only involve manually moving the IDE files. I haven’t tested this method, it’s possible I’ve missed something when making the PRs. One thing I do know is a gotcha is that the IDE files are slightly different between 1.x and 2.x; that’s not reflected in the PR files, because Paul will be wanting to make his own decisions on which changes he wants in the Tools menu. I’m hoping for all 3 (USB channel count, audio block size and audio sampling rate).

The way I’ve worked is to fork cores and Audio, and then clone my forks over the top of cores and into the Arduino library folder. That way I can always check out the older branches (or other development branches) as needed.

If y'all need any help writing or testing examples I'd be open for this
That’d be great. I’ve done a couple of super-simple ones for the PRs, assuming nothing but an audio adaptor, but TDM ones would also probably be welcome. I think @alex6679 also implemented mute and volume controls - examples for those would be useful, if so. I currently have a bunch of non-audio stuff overflowing my workspace, so no space or time to set up and test that myself.
 
Regarding merging the new usb interface into the core and audio library:

At the new interface, I separated the more complex USB audio functionality from the audio library:

- USBAudioInInterface and USBAudioOutInterface of usb_audio_interface.h/cpp contain the more complex implementation details and do not depend on the audio library. For example, USBAudioInInterface computes the feedback. This means that anyone who wants to use the Teensy USB audio interface without the audio library can directly use these classes.

- AudioInputUSB and AudioOutputUSB, implemented in usb_audio.h and usb_audio.cpp, are intentionally very small and simple. They act only as adapters between USBAudioInInterface / USBAudioOutInterface and the audio library.

Because of this separation, we could move usb_audio.h and usb_audio.cpp from the core to the audio library, keeping the core library leaner.
The compiler will complain that usb_audio.h is missing, but that can easily be fixed by including usb_audio_interface.h instead of usb_audio.h.

@PaulStoffregen @h4yn0nnym0u5e What do you think about that idea?
 
I tend to be of the opinion that "if it ain't broke, don't fix it"! I agree it's messy as-is, but it conforms to the old structure so it looks as close as possible to a simple pull request rather than a re-structuring.

The other major reason to leave it is that this is what multiple users have tested pretty thoroughly by now. Any changes, however minor, make that testing slightly less valid.

On another note, I saw the PR for the incorrect boards.local.txt; this doesn't require any changes to the cores PR, as I made a somewhat improved on which has a 44117.65Hz setting for Teensy 3.x emulation, and also includes settings for the MicroMod.
 
Is that going to cause issues with Teensy 3.x which also uses the classes in the audio library on top of its own core files?
 
That's a good point against moving stuff from cores to Audio! All the "real" changes made have been in Teensy 4 cores, so will not impact Teensy 3, though of course Teensy 3 users won't be able to benefit, either. The only change within Audio is to implement and document the additional multi-channel USB objects; it'd possibly be worth editing usb_audio.h in the Teensy 3 cores to throw an error if a user tried to make use of them.
 
Just as all the other audio headers usb_audio.h would be included in Audio.h. Here it can be included only for the T4.0/T4.1 by means of preprocessor conditional. So it would not affect the other Teensys.
I suggested it because there is just no reason for usb_audio.h to be part of the core. Having it in the core is similar to putting e.g. input_spdif3.h in the core instead of the audio library.
But of course, I admit, it's not high priority.
 
On another note, I saw the PR for the incorrect boards.local.txt; this doesn't require any changes to the cores PR, as I made a somewhat improved on which has a 44117.65Hz setting for Teensy 3.x emulation, and also includes settings for the MicroMod.
I checked the boards.local.txt file in the PR and saw that it had already been fixed there. Otherwise, I would have let you know.
 
It's been four months since any updates on this thread. Has the final solution for 8x8 USB Teensy audio been PRed? Any more updates?

I've a need for compact 8x8 USB audio in a <1U rack and have the Platypus boards on the way from Down Under; however, I don't want to reinvent the wheel to get it going if this development is complete.
 
It's been four months since any updates on this thread. Has the final solution for 8x8 USB Teensy audio been PRed? Any more updates?
Well, the previous updates were…
I've done a couple of PRs, one for the Audio library and one for cores. It's all still a bit messy because there's no way of doing a PR for the required Tools menu changes, but suitable examples are included as part of the cores PR, and I'm sure Paul will be able to figure them out, or ask if anything's unclear.
…then…
Just want to confirm I'm planning to merge this in 1.62 or 1.63.

Immediate plan is to wrap up 1.61 sometime next week.
It didn’t get merged in 1.62 (released in June), and the 1.63 beta campaign hasn’t even started yet.

I can see that in the last 4 months the PR has acquired one conflict - I’ll aim to fix that when I get a moment. That, unfortunately, is the kind of thing that occurs when there’s no rolling maintenance and update - even the worthiest of PRs go stale and take more effort than they should to get pulled in. (I did one PR for the Audio library; 9 months later it’d got a conflict, pointed out by Paul; I fixed it that same day; 4½ years after submitting the PR, it still hasn’t been either pulled in or rejected.)

The USB stuff all seems to work very well, so you shouldn’t need to reinvent that particular wheel, just make use of the existing PRs (cores and Audio). You’ll need to dive in and add the Tools menu stuff; the various repos give instructions on how to do that.
 
No worries. I've resolved the PR conflict, for now. Time will tell whether it gets pulled before other changes cause further conflict...

Do ask here if you have any issues getting it going. As long as you keep a few backups in case you mess up, it should be fine.
 
I was able to follow the steps outlined in https://github.com/alex6679/teensy-4-usbAudio and upload to the teensy. I don't have the DAC/ADC board to test analog IO, yet; but Windows and VST Host recognized the board as a digital audio device with multiple channels. Audio Design Tool showed the new USB choices, but picking the choices in the IDE Tools menus worked instead of constructing within the Design Tool GUI. The hardest task was locating and confirming where the files to replace are located.

The test sketch was USBMultiChannelTest.ino which is a little more than what I'll need. My only need it to have 8 USB Digital Signals to Analog Outs and 8 Analog Ins to USB; basically a passthrough and conversion. All the mixing, effects, etc. will be done within the VST Host (Cantabile, BTW).
 
Got the 8 USB channels out of VST host at least to Teensy as it's showing on the display input meters. Still have to build the XLR IO boards to test if the signals are coming out of the DAC chips. Playing wave file peaks match the level bars exactly and stereo field moves as expected.

With a multimeter, the peaks are measuring 1.38Vrms which agrees with the DAC spec sheet of 1.414Vrms for full scale differential output. There is the -1.5Vdc offset which needs the caps or isolation transformer before output capture and oscilloscope tests.

1792101088260.png
1792101167112.png

Input appears to be noise until the isolation caps are installed. When the input pins are shorted on the board to simulate 0 voltage, the input bar drops to the bottom.
 
Last edited:
A little update... The analog outs from CH1/2 (stereo) were tested over -30dBFS to 0dBFS. The AC rms-voltage is taken across the (+) and (-) pins on the board. Testing is with a multimeter.
1792249583090.png

Best fit in excel is base e, but converted to base 10 the formula is Vrms = 1.375 x 10 ^ (dBFS/19.861). Based on the chip spec, this differential output is most likely

Vrms = 2^0.5 x 10 ^ (dbFS/20)

2 ^ 0.5 = 1.414 and matches the Ti3104 datasheet for a differential channel. 0dBFS = 1Vpeak per each side of the differential (dual) is probably the specification. Divide by 2^0.5 to go from peak to rms.

For reference, an Apogee Rosetta 200 is calibrated for -16 dBFS = 4 dBU = 1.228 Vrms. The calibration curve for the Rosetta is

Vrms = 7.75 x 10 ^ (dbFS/20)

dBU is defined such that 20 dBU = 7.75Vrms (Recording Industry)
dBFS definition are sometimes variable any can change from DAC/ADC manufacturer

The conclusion from the measurements is the output from the Ti3104 DAC is about 15dB less than a typical professional audio DAC. This is not a problem, but note that this lower output may have to be made up somewhere in the signal chain.

For the Ti3104, the output calibration is

-16 dBFS = -10.8 dBU = 0.2241 Vrms

Testing the recording levels is turning out to be engaging. The differential output of Ch1/2 (stereo) is output through two line level isolation transformers that have measured to have only 0.2 dB loss from input coil to output coil. The other coil in the transformers is sent to the input of Ch1/2 (stereo). The output and inputs are isolated from each other and the only signal that jumps the coils is caused by voltage variations.

I was expecting a -5dBFS sent to the board to be converted to 0.80Vrms (it is), then the input of this same 0.80Vrms to be captured as -5dBFS. The captured signal is 7dB lower. A Programmable Gain Amplifier (PGA) is mentioned in the datasheet which is probably the way to reconcile the play/record dBFS if needed. I will need to figure out how to adjust the recording levels and the chip. Then again, I may want to leave the captured levels low dBFS-wise when interfacing with higher output analog gear. But the input levels need to be adjustable.

Another issue I noticed during recording was a DC Offset. The output of the transformer does not have any DC offset (physically impossible); yet, there is a sizeable DC offset in the recorded file (-40 dBFS which is high). The DC Offset was removed with the chip's HPF at 10Hz (aic.adcHPF(10)). Claude found that little tool... But, removal of the DC at the analog stage would be best and that might be why Palmer's Wing Boards have 470k resistors to ground at each input/output along with the isolation caps (Isolate and bleed the DC to ground).

So that's my two problems so far:
1. Adjusting the recording levels to match input voltages (possibly use the PGA)
2. Removing the DC Offset before hitting the ADC (add the resistors and caps instead of X-former)
 
Back
Top