Nyquist Plug-in: THE KRONx ECHO LOOPER


They say that imitation is the sincerest form of flattery, so here’s another plug-in.
What it does is very similar to the “KRONx ECHO LOOPER” described below - basically it is an echo type effect created by multiple delays but configured primarily with looping in mind.

The main differences from the KRONx are:
Works with any sample rate supported by Audacity.
Works with any bit depth supported by Audacity.
Works with mono or stereo tracks.
Has an extra control to incrementally change the gain of each repeat.
(and the effect itself is only 6 lines of code)

The extra gain control allows repeated loops to gradually fade. For example, a small amount of increased gain applied to a recording of footsteps can make them sound like they are approaching, or with a small amount of negative gain can sound like footsteps moving away.

Very short delays (small “loop period”) can be used to create echo or digital delay type effects.
Longer loops can be used for repeating musical phrases and similar applications.

How this differs from the “Repeat” effect is as described for the “KRONx ECHO LOOPER” and can easily be heard when making fairly rapid repeats to sounds that have a slow decay.
For example, looping a bell sound that has a 10 second decay with an echo delay of 1 second - using the Repeat effect will truncate the decay for each repeat except the final one, whereas the “Looper-Echo” will repeat the full 10 second duration on each repeat. In this respect it is more like the Echo effect.
However it differs from the Echo effect in that each repeat may be identical to the original, so it may be used as an alternative to the Echo effect, but also has many other creative possibilities.
looper.ny (912 Bytes)

This effect does basically the same as a delay effect (of which there are several varieties on the wiki http://wiki.audacityteam.org/wiki/Nyquist_Effect_Plug-ins#Delay_and_Reverb ).
The main difference is that it supports very long delay times (up to 100 seconds on the slider control, or longer by text entry).

The reason I first thought of that plug-in was the issue of cut resonance in loops,
but it had some problems as sequencers cut resonance when the same sample
plays, such as B16 to B01.

Thus, with mixed loops, the resonance might actually need to be cut, or might
be wrongly cut (which is the one I was trying to fix).

The solution to that would probably be a wav format where all channels could
be viewed, but as that is probably a long time away, I’ve switched to using
Stem Loops only (unmixed loops). These loops feature only one instrument
(such as Bass Drum) and are usually found in Kit Packs, such as “Dre’s Detoxed
Construction Loop Set” by Digg Audio.

The resonance problem isn’t as much, they’re easier to learn from, and you
can create more tracks by mixing/matching them than with “traditional”

Glad to see you boiled it down to 6 lines of code. There must be tiny tiny
elves in that code who run around doing things for that to work…

Fortunately Professor Dannenberg gave us some pretty neat tools.

This is the main function that does the work (slightly simplified):

(defun looper (sound-in period repeats gain)
  (simrep (var repeats)
      (at-abs (* period var)(cue (mult gain sound-in)))))

A major advantage of defining this as a function is that it makes it really easy to “expand” for multiple audio channels without the need to duplicate code. When it is defined as a function, all that we need to do for mono or stereo tracks is to call the function for each audio channel. So rather than:

If mono
do this ...
if left channel
do this ...
if right channel
do this ...

we can be much more economical and write:

(defun dothis (arguments)
  do this...

(multichan-expand #'dothis arguments)

How this works is described here: Missing features - Audacity Support
Functions are also a good way to “modularise” code which makes it easier to write and much easier to debug.
Nyquist includes a lot of built in functions and writing code as functions is really just extending the capabilities of Nyquist. If you need a function that does not exist in Nyquist, then you can write your own function and use it within the plug-in just like any of the built in functions. If you want to use a function that already exists, then there’s little point in re-inventing the wheel (other than perhaps as an exercise)

In the function “looper”, the iteration is handled by simrep
and the delay is created by specifying the absolute start position with at-abs
and that’s basically the code.

On the issue of resonance loss in stem loops, I might add that you can easily
minimize the loss by cutting the loop properly and ensuring that the end
resonance of the last sample is at the start of the loop.

This presents some issues about the first loop sounding bad, but it may
be better than all loops being without needed resonance (and can usually
be silenced out with the first loop if unmixed).

Here’s what I’m talking about
As you can see this (Snare Drum Stem) has the end resonance of the
last snare drum hit at the front of the loop (this Stem actually has
two snare drum samples in it btw).

I’m still waiting for someone to reinvent the wheel, btw. I really
detest the use of bearings in any product. It’s the “magnet” of
motion… :cry:

First you had the “wheel”, and now (fanfare- Ta Da!) the Tweel :smiley:

Yeah! - What will be next? - Look at this: http://www.youtube.com/watch?v=LgbWu8zJubo

Who needs wheels anyway http://youtu.be/sLOVdo_Qu3E

Great! - Can this thing dance?