Using well known s
function names like "bd", "sn" and "hh" but with a twist: I am experimenting with a multi-sample drum pack in TidalCycles and I made a mapping in SuperCollider to control Drums hosted in Kontakt.
For this, I intercept a Tidal event in SuperCollider and transform it before playing it through SuperDirt.
The goal is to reduce the mental model when using a MIDI device (or plugin) so that you can write your code both quickly and safely during a performance.
And I think this could be useful in general.
In TidalCycles the interface was transformed in these steps:
-- Original pattern for playing a base drum
d1 $ n "[-36*3]" # s "midi" # amp 1.0 # midichan 0
-- First transformation
-- Transform 0 to -36 under the hood
d1 $ s "drums" <| n "0*3"
-- Second transformation
-- Transform `bd` to a midi event with midinote -36
d1 $ s "bd*3"
SuperCollider code:
(
var eventmapper = { |event, result|
event.putAll((\type: \dirt, \dirt: ~dirt), currentEnvironment);
if (event.at('n').isNil, {event.add(\n -> 0.0)});
event.add(\type-> \dirt);
event.add(\dirt-> ~dirt);
event.add(\s -> \midi);
event.add(\midichan -> 0);
event.add(\amp -> ~gain);
result.putAll(event);
result
};
var notemapper = { |event, result, tidal, kontakt, mod|
if ((event.at('n') % mod) == tidal, {
result.add(\n -> kontakt);
result.add(\freq -> (kontakt + 60).midicps );
});
};
// Example for sn
~dirt.soundLibrary.addSynth( \sn, (play: {
var event = ();
var result = ();
eventmapper.value(event, result);
notemapper.value(event, result, 0, -34, 5);
notemapper.value(event, result, 1, -33, 5);
notemapper.value(event, result, 2, -32, 5);
notemapper.value(event, result, 3, -31, 5);
notemapper.value(event, result, 4, -30, 5);
result.play;
}));
)
Here you can see it in action:
This is hopefully useful for someone