Floating-Point Audio Library Extension

I haven't been the one maintaining the OpenAudio library...I haven't been the maintainer for years and years, so its examples look quite different than I remember them. I'm having difficulty finding an example that uses AudioSettings to change the sample rate or block size. That's unfortunate.

Back when I wrote the original version of the library, you had to pass your AudioSettings to each audio class via its constructor when you were instantiating it. I am assuming that this is still true for the OpenAudio library, but I could be wrong.

Looking at your code, I see that you create the AudioSettings but that you do not pass it to your other audio classes when creating them. So, I would suggest changing your two instantiating lines to be:

Code:
AudioOutputI2S_F32 i2sOut(audio_settings);
AudioSynthWaveformSine_F32 sine(audio_settings);

If that alone doesn't work, I would also suggest that you try adding the I2S input block, even if you don't connect it to anything. My memory from long ago is that it sometimes it is involved with certain timing events. So, try adding:

Code:
AudioInputI2S_F32 i2sIn(audio_settings);

Good luck!

Chip
 
Looking at your code, I see that you create the AudioSettings but that you do not pass it to your other audio classes when creating them. So, I would suggest changing your two instantiating lines to be:
Thank for pointing it out, but it's a code which illustrated a different problem. Later I corrected it as you suggested, yet it did not work.

As for getting rid of these direct references to AUDIO_BLOCK_SAMPLES in F32, it makes sense, but I have one doubt. Small values may evidently cause considerable overhead. However, for small AUDIO_BLOCK_SAMPLES like 4, a compiler may tend to unroll loops, which may at least partially alleviate that overhead.

Thus, I would suggest first testing this by modifying #define AUDIO_BLOCK_SAMPLES 4 to extern int AUDIO_BLOCK_SAMPLES; and assigning 4 to the latter somewhere in the code. Then, profile both variants in order to compare the CPU usage. If the difference is small, that seems ok, as F32 may evidently come with some overhead in exchange for precision and flexibility.
 
Back
Top