Mike Wilson's Blog

I was a MA/MST student at Stanford's Center for Computer Research in Music and Accoustics.

This is my weblog.

Click here for my main page.


I was working on Wilsynth a bit more today.  I usually would "idle" at
about 10%; that is, qjackctl would report about 10% load when I just
had the application running with the default patch selected and no
notes being played.  That includes a FDN reverb, a limiter, and
anything else running at the time (the default DSP load seems to stay
around 0-1%).

It's generally not an issue, but it's always nice to optimize.  Every
so often I'll compile the program with the -pg option selected and use
gprof to profile the code.  It reported that a lot of time was spent
in reading from and writing to the delay lines in the FDN.  These are
very simple functions (literally just array accesses) so I put them in
the header file so that the compiler could inline them.

Idle dropped to 3.5%.

Great!  Wouldn't it be nice if there was a way to potentially inline
everything, but maintain the nice code and mental organization of
keeping things in separate files?

It turns out gcc has an option which does something like this, called
link-time optimization.  I turned it on, and although I'm not sure if
I'm using it correctly it seems like it helped a bit.  I'll have to
keep tabs on this going forward.

For reference, here are my current architecture and optimization flags
for wilsynth:

ARCHITECTURE_CC_FLAGS = -march=native -mfpmath=sse -mmmx -msse -msse2
-msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -mpclmul

OPTIMIZATION_CC_FLAGS = -Ofast -flto -fuse-linker-plugin

I'm not sure if the instruction set architecture flags are redundant
with the -march flag; it seems like they should be but I'm keeping
them in there anyway.  And -Ofast includes the -O3 flags (such as
-ftree-vectorize) in addition to -ffast-math.

Now it seems like the heaviest function is the nonlinear distortion.
It's doing 8x oversampling, which might be part of the reason.  But
I'll have to analyze it in more detail to be sure.

I still have to finish one of my Modulations pieces.  Part of the fun
of building your own instrument is tuning it, but it's important to
play it too!

email mwilson@alumni.caltech.edu
Disclaimer: the views herein are my own and do not represent the views of Stanford University. All material copyright Michael J. Wilson.