Effects of Serial / Serial+Midi compilation on the Audio library

Baloran

Active member
Hi,

I'm finalizing the development of a big project using several Teensy 4.1s. I'm using this component to manage the analog part (lots of VCOs VCF etc...) but also to add a digital part that completes the instrument's functionalities.

https://baloran.com/store/blog/project-pool

I'm going round in circles on a question. The voice cards don't use any instance of usbMidi. However, when I compile in "Serial" alone, I get interruptions with certain audio sets, a continuous beep, as if I were using too much CPU ( AudioProcessorUsageMax() < 30...) and the audio couldn't handle all the streams. The Teensy seems to hang for a few moments. If I don't use the audio lib, no more blocking....
If I compile Serial+Midi, everything works perfectly.

I don't see where the problem could be, possibly between the chair and the keyboard?

Otherwise, I'm crazy about my Teensys. With a simple PCM5122, you get a nice digital generator. If you're not too fussy about the documentation (I'm running out of time), I can put all the devs I've made on this subject online (wavetable with morphing, additive synthesis with morphing, FM etc....).
 
The Teensy seems to hang for a few moments. If I don't use the audio lib, no more blocking....
If I compile Serial+Midi, everything works perfectly.

That is very strange. I don't know what's causing this behavior. Could be you've found a subtle bug in the USB Serial code. Could be a subtle issue with the Audio library, or something in your program. Sometimes very subtle and difficult to find problems, like buffer overwrite, can be sensitive to what other code is complied... which makes troubleshooting quite a challenge.

Best I can recommend is try paring down your program to much smaller code which can still reproduce the problem. If your program reads input from pins or other hardware, try replacing that stuff with fixed numbers using things like elapsedMillis to simulate the input. The main idea is to be able to reproduce the problem with a smaller program in a consistent way. Then of course post that program here! I would really like to investigate, but without a way to reproduce the problem I can't even guess what the true cause really is.
 
That is very strange. I don't know what's causing this behavior. Could be you've found a subtle bug in the USB Serial code. Could be a subtle issue with the Audio library, or something in your program. Sometimes very subtle and difficult to find problems, like buffer overwrite, can be sensitive to what other code is complied... which makes troubleshooting quite a challenge.
Thanks ;) I'll also take a look at the possible interactions between "Serial" and "usbMidi", an overflow for a phantom stream.
 
Baloran said:
...possibly between the chair and the keyboard?....
Yes ;)
The problem was in my code, an array index that went too far (shame on me...). It's funny to see that the compilation options made the problem more observable, as if they significantly affected the organization of variables in memory.
 
Back
Top