More information about round trip latency (RTL). First, the ASIO4All worked well and all Teensy USB 8 ins and 8 outs are addressable from VST Host (Cantabile).
My normal rig uses a Lexicon Alpha (obsolete but cheap and I admit slow...). The analog output was looped into the input and both the output and input were recorded to a single *.wav. An on/off 100 Hz 44.1kHz-16bit signal was sent to the output. The difference in the start of the output wave form compared to the start of the input wave form would be the round trip latency which is going through the DAC then back through the ADC (this is two digital/analog conversions). The same program and ASIO4All drivers were used for both the Alpha and the Teensy.
The Alpha is operated with a 256 sample ASIO buffer. The measured latency is 29ms or 1,280 samples. This is a dual conversion latency, so the one way latency is about 15ms which is above desired of 10ms. I can attest that whatever the actually latency is, I cannot hear it. This measurement is surprisingly high; I was expecting RTL of half of this, but this is a relative comparison, not an absolute. A "best in class" RME Babyface has an RTL of 12.2ms at 256 sample buffer, but this is measured under a better controlled real-time environment. My method is an old laptop with a converter laying on the carpet... Or it could mean that my obsolete interface is has 2.5 RTL of a modern interface. Probably a little of both.
To get the same loop latency out of the Teensy, the Software host has to be 128 samples (half) and the Teensy has to be complied with 16 audio block size. At these conditions, the round tip latency is 28ms. Thus, I'd say the latency of the Teensy system is double the latency of the Alpha because the Teensy ASIO buffer has to be halved to get comparable results. When the ASIO buffer is 128 and the Teensy Block size is increased to 128 samples, the latency increase to 38ms.
If listening, the Teensy high latency really doesn't matter. If performing, the higher latency might matter. I've not used the Teensy during performance, but I'll work toward that. Once gain, I'd say the Teensy Audio latency might be higher than desired for live performance. Maybe my code needs improvement? IDK... Maybe the latency through the Teensy combined with more latency through the digital converter chips is high? Maybe my measurement method needs to improvement, too.
The 256 sample block size never worked. The captured waves were quite broken. Upper two waves are stereo output; lower two waves are stereo input.
A typical recording looked like this. In this case, the output is the bottom wave and the input is the top wave. The difference is the RTL. This is a 100 Hz sine in a 44.1kHz sample rate. There area about 5.5 complete 100 Hz cycles in the output before the input registers. About 5.5 100Hz waves is about 55ms (this is a high latency). This case was the Teensy with 128 sample block size and 512 sample buffer (worst case).
Update: Was able to improve the RTL with modifications to two files in the library.
usb_audio_inteface.h
#define TARGET_RX_BUFFER_TIME_S 0.0005f
//targeted buffered time (latency) in seconds - Default is 0.0018f
#define TARGET_TX_BUFFER_TIME_S 0.0008f
//targeted buffered time (latency) in seconds - Default is 0.0035f
usb_desc.h
// LATENCY EXPERIMENT: force the high-speed audio polling interval instead of using the
// longest one that fits the bandwidth (which is 1 ms here: 8 ch x 2 bytes x 45 samples
// = 720 bytes/ms). Values: 1 = 125 us, 2 = 250 us, 3 = 500 us, 4 = 1 ms.
// Everything below (packet sizes, frames per second) follows from this value.
// Remove these two lines to go back to the automatic choice.
#undef AUDIO_POLLING_INTERVAL_480
#define AUDIO_POLLING_INTERVAL_480 1
These were suggested by Claude and they improve RTL. usb_desc.h lines are entered after the if/then to force usb polling to be 125us.
The original Teensy RTL was 33ms with 256 ASIO samples and 16 Audio Blocks
With above changes and same samples/blocks, RTL is down to 27ms (this is as good as the Alpha)
If the Teensy will run at 128 samples, the RTL will be at 22 ms
The sine wave captures look good (no glitches); however, long term stability has not been tested. Backup files before changes (also need to delete the Arduino cores to force a recompile if library files are changed):
Important: these constants are compiled into core files, so Arduino must rebuild the core after you change them. Clear Arduino’s temporary build cache (%TEMP%\arduino for IDE 2.x)