Operating at the Sample Rate—A Smooth Windowing Controller

Anyone who’s done audio editing has probably learned that if you cut off the audio at a sample far from zero you create a pop at that point. Signals that instantly drop to zero or instantly rise to some value are called step functions, a waveform that theoretically speaking contains all harmonics, and practically speaking makes an awful pop sound. In audio editing, you can just pick a sample at or near zero and like magic, there’s no pop. The alternative is to quickly fade to or from zero.

In an effort to improve sound quality when capturing audio to delay nodes in Audulus, I decided I needed to create a fast windowing function to create crossfades and or fade outs at the endpoints. I learned a bit about using Audulus to manipulate values at the sample rate.

I started with a module I made a while back to slowly modulate a value from one value to another over a number of steps, with slope zero at the start and end. To accomplish this I’d made a counter to count up or down a value n, stored n in a S/H node, then feeding the n value into an expression involving the cosine function (which has slope zero at angle 0 and pi). That expression scales the ends of the curve to fit the desired start and stop values.

To get this to work at audio frequencies, I needed an audio-rate clock signal. This proved to be out of the realm of the Osc and Phaser nodes, so I tried putting together a circuit that might generate it naturally. This is what I came up with.

The timer node responds to a step at the input. Any value above zero is fed through the unit delay back to the node, retriggering it. The result is an impulse that repeats at the sample Rate. We can’t really visualize it in Audulus, but its frequency can be measured by the Zero Cross node.

To get my counter to operate at the audio sample rate, I replaced the Feedback Delay node with a Unit Delay node. Although is does work reliably at the audio rate, the counter ended up working a little differently from what I expected, because the translation occurs over twice the value of N it’s fed. I’m guessing this might have to do with the use of another unit delay in the counter, but whatever the reason, it’s been useful enough to work in my loopers to create quick crossfades (that’ll be coming out pretty soon, once I get some operational bugs worked out.) One application would have it drive the c input of a cross fade node, accomplishing a smooth cross fade between a and b inputs.

Here’s the experimental setup, which helps explain why I was trying to build an o-scope!


Sample Stepping Crossfade controller.audulus (1.2 MB)

In the setup in the attached patch, I’ve set up the module to translate from -2 to 1 (those values can be any value and don’t need to straddle zero).

6 Likes

Thanks for posting that! Just what I needed, before I even knew it!

1 Like

By the way, the “trig dir” on the o-scope trigger section does not currently work AT ALL, but I’m so in love with the idea I’ll keep the control and hopefully get the innards responding properly,

1 Like

This is an excellent piece of work. It’s always a challenge to manipulate individual samples in Audulus although to @Taylor’s credit it can be done. Since he has updated the unit delay to work in feed forward configurations, single sample manipulation has become much more practical. I’ve built some shift registers and such that happily operate at any audio frequency I’ve tried. I’ve typically used a 6 dB low pass filter (slew limiter) with a crossfade to remove objectional pops but this is an elegant solution. Hopefully we’ll have a better scope in A4.

1 Like

Thanks! As I’ve worked on this I’ve been astounded that Audulus was so flexible. I really expected this to fail in the beginning. Hats off to @taylor for making this so easy to do! This sort of flexibility and ease of use doesn’t happen by accident!

2 Likes

This is an amazing use for Audulus. Look forward to see how you use it in patches once you’ve ironed out the operational bugs.

1 Like