dxinteractive
Member
I'm getting into writing audio effects for Teensy, and have been reading through the source code for many of the effects already in the library. I'm ok when it comes to much of the maths as I've done DSP stuff before on regular computers, but I've never had to optimise them much and could rely on floats for the most part.
Synth_dc.cpp (https://github.com/PaulStoffregen/Audio/blob/master/synth_dc.cpp) had some things in it that I didn't quite get.
Line 42:
Why is this done? I've read through https://github.com/PaulStoffregen/Audio/blob/master/utility/dspinst.h and get programatically what it does, but I don't know why you would do it.
Line 43:
Why is this done in blocks of 8? Why not 1, or 16 for example?
Line 60:
I guess I would have expected a simple magnitude += increment. Why do it twice and pack the top halves of each uint_32 together like that?
Also, is there a way to emulate the Teensy on a desktop or laptop based PC when developing audio effects? I feel like this might be easier to troubleshoot and log data. Or if there's a neat way of setting up value logging through Serial and somehow digesting hundreds of values then that might be helpful. It's useful to graph things sometimes.
Also also, if you have any reading material recommendations on fixed point optimisation / math techniques that might be helpful. Reading through dspinst.h made my head hurt a little!
Synth_dc.cpp (https://github.com/PaulStoffregen/Audio/blob/master/synth_dc.cpp) had some things in it that I didn't quite get.
Line 42:
Code:
val = pack_16t_16t(magnitude, magnitude);
Line 43:
Code:
do {
*p++ = val;
*p++ = val;
*p++ = val;
*p++ = val;
*p++ = val;
*p++ = val;
*p++ = val;
*p++ = val;
} while (p < end);
Why is this done in blocks of 8? Why not 1, or 16 for example?
Line 60:
Code:
magnitude += increment;
t1 = magnitude;
magnitude += increment;
t1 = pack_16t_16t(magnitude, t1);
I guess I would have expected a simple magnitude += increment. Why do it twice and pack the top halves of each uint_32 together like that?
Also, is there a way to emulate the Teensy on a desktop or laptop based PC when developing audio effects? I feel like this might be easier to troubleshoot and log data. Or if there's a neat way of setting up value logging through Serial and somehow digesting hundreds of values then that might be helpful. It's useful to graph things sometimes.
Also also, if you have any reading material recommendations on fixed point optimisation / math techniques that might be helpful. Reading through dspinst.h made my head hurt a little!