Hello all,
I have just ordered a Teensy with Audio Board and am excited about programming with the Audio Library. This is my first foray into real-time programming, but I have done quite a bit of other programming. I have a couple of questions:
In looking at the explanation of AudioEffectTemplate, it seems that the audio data is read in blocks of 128 samples (by default). Naively, I had expected that real-time programs would read one sample at a time to minimize latency. I'm familiar with block reads/writes being useful in non-real-time systems because of latency issues requiring buffering to preserve an uninterrupted output stream--or with peripheral controllers that are block-oriented. But since we're in real-time here with A/D and D/A, what is the primary motivation for block I/O? Is there a lot of overhead per read?
Also, looking at some of the implementations it seems that if an audio block is required just for the duration of a method, it is dynamically allocated and freed at the end of the method rather than declaring it inside the method as a local(i.e. allocating on the stack). Is that just for tracking purposes, or is there some reason you can't or shouldn't use the stack for moderately-sized data? Is the stack defined in a limited memory space?
Thanks,
Rob
I have just ordered a Teensy with Audio Board and am excited about programming with the Audio Library. This is my first foray into real-time programming, but I have done quite a bit of other programming. I have a couple of questions:
In looking at the explanation of AudioEffectTemplate, it seems that the audio data is read in blocks of 128 samples (by default). Naively, I had expected that real-time programs would read one sample at a time to minimize latency. I'm familiar with block reads/writes being useful in non-real-time systems because of latency issues requiring buffering to preserve an uninterrupted output stream--or with peripheral controllers that are block-oriented. But since we're in real-time here with A/D and D/A, what is the primary motivation for block I/O? Is there a lot of overhead per read?
Also, looking at some of the implementations it seems that if an audio block is required just for the duration of a method, it is dynamically allocated and freed at the end of the method rather than declaring it inside the method as a local(i.e. allocating on the stack). Is that just for tracking purposes, or is there some reason you can't or shouldn't use the stack for moderately-sized data? Is the stack defined in a limited memory space?
Thanks,
Rob