project name: sampswap
project url:
author: infinitedigits
description: swap samples within loops
discussion url:
tags: sampler


swap samples within loops to make new loops.


this script is forked from makebreakbeat. makebreakbeat worked by building the audio one piece at a time while sampswap copies and pastes to edit audio in-place. sampswap first repeats the original audio and then copies random regions, adds effects to that copy, and then pastes the effected copy to a random position along the loop (editing the file in-place essentially).

this script works best with loops (see notes below for reasons why). it can be used to generate material (especially “breakbeat” type things) but since it automatically tempolocks and syncs up to four tracks it can be nicely performed.

some may also find this script might be a framework to borrow from or extend (which I happily encourage!). in addition to the normal norns engine, it has a ‘non-realtime’ engine which effectively can be used to resample audio processed by any SuperCollider SynthDef. also there is a embedded lua library that wraps sox for easily creating effects+splices (more info about this on my blog). sox splicing works easily because sox can join with crossfades using wave similarity to find best locations. basically sox+scnrt = daw in a primordial form. this script is not trying to reinvent the daw, though. if anything I want this script to be a “raw” (“random audio workstation”) where all the operations are random and you only can define their probabilities.



see the parameters menu for all the parameters. most of the parameters are available on the front UI for quick navigation.

rundown of the screen

the title bar. this shows the current track loaded, and the current index of the generated track (in parentheses).

right below the title bar on the left is “Xqn Y” where X is the guessed number of quarter notes in the beat and Y is the guessed bpm. you can change the guessed bpm in the parameters menu.

the third line on the left shows also “Xqn Y” but here it is showing that it will generate X beats at tempo Y.

the fourth line that says “off: X” shows X beats from the down be to sync the current track.

the fifth line that says “repitch/stretch/none” is indicating how the re-tempoing will occur. repitch will simply speed it up/down. stretch will perform a timestretch. none will do nothing.

the seven bars specify the probabilities for adding any of the specified effects to the generated track (except the last bar which controls amplitude in realtime).

each effect is applied in order and can affect effects further down. basically all the editing happens “in place” in the file, so you end up with something along these lines:


happy to answer questions and if time permits I can make a little tutorial video.



install with


once you start the script for the first time it will install sox, and sendosc (~8 MB total).