A basic granular plugin. It chops some input audio into little pieces, rearranges the pieces and plays them back.
Here’s how to use this one:
Apply to a selection of three or more audio tracks, the first two being monaural “control tracks” and the rest “input tracks”.
The first track is treated as a graph whose height is the length of time until the next grain starts. Negative heights are treated as zero.
The second track is treated as a graph whose height indicates where in the input tracks the grains are being sampled from: a height of zero means the grain is taken from the beginning of the input track, a height of 0.5 indicates the grain starts halfway through the track, and a height of 1 indicates the grain starts at the end of the track (this will result in silence). If “Normalize Sample Start Control Envelope” is set to “Yes”, this graph will be adjusted so that it spans from 0 to 1 exactly.
The remaining tracks are then grainimogrified according to the plugin’s inputs:
“Number of Grains” is the total number of grains.
“Grain Length (Seconds)” is the length of each grain in seconds, and
“Grain Envelope” controls the shape of an envelope applied to each grain, where
Triangle is the first half-period of a triangle wave.
Sine is the first half-period of a sine wave.
Exponential is a misnomer - it starts at full volume when the grain starts, and decays to zero during the Grain Length.
Rectangle is no envelope. May cause artifacts.
There’s a bug where the second track can’t be processed (argument stack overflow) if the number of grains is somewhere bigger than 1950, so for now I’ve limited that to 1750. GRAINIMOGRIFIER.ny (4.57 KB)
The problem is that the first track returns a list, which is an error because it is not a valid return value for Audacity (it is logged in Audacity’s debug window as: “Nyquist returned nyx_error:”)
The easiest solution to this problem is to return the unmodified track audio for the first two tracks. For example:
(cond
((= index 1) (process-gaps-env) *track*)
((= index 2) (process-place-env) *track*)
(T (process-sample-track)))))
Sounds good. There’s a shiny new parameter: “Minimum Grain Separation (ms)”.
It’s the minimum separation between grains, in milliseconds. Grain length is now also specified in ms.
Good to know. I’ve added the fix you gave, so hopefully it should work now. GRAINIMOGRIFIER.ny (4.74 KB)
Bad news! Try as I might, I couldn’t find a way to quickly, reliably reverse a sound in Nyquist. Arrays are really slow, shape is slow and cranky, and worst of all, snd-reverse does not exist.
Could you elaborate a bit on why the grains should be reversed? I don’t understand the logic here.
oops, I was totally thinking about it wrong, it didn’t occur to me you only need to compute the reversed track once (if that).
Try this on for size. GRAINIMOGRIFIER.ny (6 KB)
Yes, for now I’ve changed it so that it takes the absolute value of track 2 - I’m on the fence whether it’s worse to ignore the sign, or to sometimes produce silent grains. Any ideas on how those negative values should be interpreted?
Hi, sorry for the delay. This version reverses the grains whenever either the first or second track are negative. There was also a bug that caused the second track to be interpreted wrong, now fixed. GRAINIMOGRIFIER.ny (6.56 KB)