fun with uninitialized variables

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

A couple days ago I was working on an oddball effects plugin that produces a value in the 0-1 range but then flips the sign to match the input value.

In processReplacing() I declared

Code: Select all

float out;
And then in my per-sample loop,

Code: Select all

out = // result of some processing;
if (*in < 0) { out = -out; }
*in = lerp(mix, *in, out);
But at some point I managed to accidentally delete the line where I assigned "out," so all I was doing was flipping its polarity for every negative sample, and leaving it alone for every positive sample.

The result was kind of hilarious. Running my plugin in Maschine, it produced some periodic bursts of noise when I didn't touch anything, crackles whenever I turned a knob on the hardware not even associated with a plugin parameter (I swear it sounded almost like a bad volume pot), a noisy but kind of fun distortion when audio was playing through it, and total silence if I hit "play" on the transport. Freaked me out until I realized what I'd done. :lol:

Obviously its behavior would be extremely dependent on the host, OS, build configuration, etc. Even so, I might release something like that just for the hell of it -- those knob crackle sounds could have been useful samples. :D

Post Reply

Return to “DSP and Plugin Development”