Hi All,
I've created a patch that allows USB audio rate to track the AUDIO_SAMPLE_RATE. This lets you defined AUDIO_SAMPLE_RATE at compile time, and stream USB audio from the computer a rate matching AUDIO_SAMPLE_RATE.

I have done some cursory tests at 8000, 16000, 32000, 48000, and they *seem* to work. It's a long way from being verified, but I wanted to post this sooner rather than later to get feedback on it.

Why, you might ask? My next step is to be able to set the USB channel count to an arbitrary number (up to the ISOC limits), and allow different number of input vs. output USB channels. Again... why? you ask? Well, we design and build microphone arrays, and I've built 64 channel PDM microphone interface board around the teensy 4.1. I'd rather spend my time leveraging all the great work that the community has done here, and contribute to it, rather than start from scratch with the NXP SDK directly. We want to bring in as many of those 64 channels as possible into a host computer for processing.

Things on my punchlist are:
1) arbitrary (standard) audio rates. Maybe support literally arbitrary rates at some point, but 16khz is my main target to allow .
2) arbitrary USB IN and USB OUT channels, and let them be different counts (i.e. 30 microphones, 2 speakers)
3) change the TDM interface to a allow 32-bits/slot, and perform some scaling before going to 16-bits at the output.
4) change the TDM interface to allow using all of the pins available to TDM1 (i.e. 4 data pins, which allows 16 slots/pin * 4 pins = 64 channels).

My changes are at https://github.com/ccrome/cores/tree...sb-audio-rates. Specifically, you can view just the changes here: https://github.com/PaulStoffregen/co...rates?expand=1

so far, I'm targeting only TEENSY 4.x

If i'm not crazy, this patch might well work for Item #1. It at least gets in the ballpark.

Any feedback would be greatly appreciated.