SuperDirt:
Filter:
SuperDirt/Classes (extension) | Live Coding

SuperDirt
ExtensionExtension

Synth and Sampler for the Tidal programming language

Description

This is a SuperCollider variant of Dirt, the sound engine for the Tidal http://tidalcycles.org/ programming language by Alex McLean. Most of SuperDirt can be rewritten at runtime: you can add and modify effects, synth defs, load samples incrementally, and spatialise to any number of channels. You can use SuperCollider as usual.

NOTE: This system is experimental.

Many examples can be found in the folders: hacks/ and scripts/

The examples suppose that environment variables are accessible. If you want to use ProxySpace or similar redirect environments, see below.

Using SuperDirt examples together with ProxySpace

All startup files and examples use the environment variables, like ~dirt. If you want to use ProxySpace or similar redirect environments, you should bind these to their respective file (which needs to be saved to disk):

Class Methods

.new

Return a new instance, ready to be started

Arguments:

numChannels

The number of channels of the internal bus (this is also the maximal number of output channels).

server

Server to play on.

.maxSampleNumChannels

Specifies the maximum number of channels your sound files have (default is 2: stereo samples)

.start

Convenience method that gives defaults for many situations. It configures the server and starts SuperDirt with a number of orbits. It allows you to pass a few parameters:

Arguments:

numChannels

The number of channels of the SuperDirt instance (see above).

server

Server to play on.

numOrbits

number of orbits to create on startup (see: DirtOrbit). You can add or remove them later.

port

The port to listen on (default is 57120)

senderAddr

The address to listen to (a String).

path

A path that is used to load some sound files. This is a string, a path pointing to a number of files, which usually contains a wildcard (*). E.g. "~/samples/special/*"

.postTidalParameters

Post a string with the tidal language parameter definitions for a number of SynthDefs. Duplicates are removed automatically. Note that these all use (Nothing), because defaults are defined in the SynthDef default arguments.

Example: let (freq, _) = pF "freq" (Nothing)

Arguments:

synthNames

A symbol or array of symbols of the SynthDef names for which to generate the tidal code.

excluding

The parameter names which should be excluded. Names already defined and used internally by SuperDirt will be excluded in additinon tho these.

Instance Methods

.orbits

A list of DirtOrbits. Orbits are the basic elements of dirt. Each has its own global effects and global settings. You can start any number of orbits any time. From tidal, you can direct sounds into an orbit by the parameter: # orbit "7" (this sends to orbit 7, if it exists, otherwise it'll wrap to whatever is available.)

.doNotReadYet

If set to true, any sound files are not read but only their paths registered, so that they can be read when needed. This may result in a missing sound when it is played first. It is useful when computer memory is limited.

.loadSoundFiles

Read a number of sound file from disk and load them into the server memory. The buffer information is also kept in buffers, a dictionary. You can do this any time while running, and incrementally add more files.

NOTE: The naming scheme works as follows:

Given a path like: "path/to/my/basedrum/*".

The dictionary will contain under the key 'basedrum' an Array of all the Buffers from the samples found in the folder.

From tidal, they can be accessed e.g. by d1 $ sound $ "basedrum:1 basedrum:4", or alternatively by the n parameter. Sample numbers below zero or above the number of samples in the folder will wrap, i.e. if you have a folder of 4 samples, 5 will play 0.

Arguments:

paths

Specifies paths for sound files. This is a string, a path pointing to a number of files, which usually contains a wildcard (*). E.g. "~/samples/special/*". For the glob syntax, see https://en.wikipedia.org/wiki/Glob_%28programming%29.

Alternatively, you can pass in an Array of full paths, e.g. ["~/samples/drums/", "~/samples/cats/"].

appendToExisting

If set to true, this will keep existing dictionary keys (see above) and add the new samples to any existing ones. This allows you to load different folders with the same name. Otherwise it will only keep those existing names which are not found in the new set of samples.

namingFunction

Provide a function to generate your own instrument names, which you call from tidal. The function is passed the folder path (a String). By default, this function is _.basename, which returns the folder name.

.loadSoundFileFolder

Read a single folder of sound files and add all of them under 'name' to the sample instruments. You can do this any time while running, and incrementally add more files.

Arguments:

folderPath

The path for the folder.

name

The name of the sample instrument as it will be used in tidal. Subsequent sound files can be addressed by passing the "n" parameter, e.g. "bd:1 bd:2".

appendToExisting

See: -loadSoundFiles

.loadSoundFile

Read a single sound file and add it under 'name' to the sample instruments. You can do this any time while running, and incrementally add more files.

Arguments:

path

The path for the file.

name

The name of the sample instrument as it will be used in tidal

appendToExisting

See: -loadSoundFiles

.loadOnly

Read a number of named folders. You can do this any time while running, and incrementally add more files.

Arguments:

names

An array of symbols or strings. These are folder names and at the same time instrument names for tidal.

path

The path in which the folders can be found.

appendToExisting

See: -loadSoundFiles

.freeSoundFiles

Remove sound files and free their memory.

Arguments:

names

An array of sample instrument names which to remove.

.freeAllSoundFiles

Remove all sound files and free their memory.

.fileExtensions

A list of valid sound file extensions, which can be extended (default: ["wav", "aif", "aiff", "aifc"]). In theory, all libsndfile formats should be supported http://www.mega-nerd.com/libsndfile/#Features.

.postSampleInfo

Post a list of all existing sample names, the number of variants, the range of durations, and memory requirement.

e.g.

circus (3) 0.17 - 0.52 sec (171 kB).

.loadSynthDefs

Load a number of files, usually containing SynthDefs.

Arguments:

path

This is a string, a path pointing as´file or a to a number of files, which then contains a wildcard (*). E.g. "~/synths/special/*"

.start

This method starts SuperDirt. It creates a number of DirtOrbits (each of which has global effects, output busses, and settings). It also opens a network connection.

Arguments:

port

The port to listen on (default is 57120)

outBusses

An (a Array) of audio output channels: it determines how many DirtOrbits there will be.

senderAddr

The address to listen to (a String).

.stop

End all audio processes and close network responder.

.free

End all audio processes, close network responder, and free sound file resources.