====== Example of using Konduktiva with SuperDirt through Helper Functions ======
**Overview: ** This tutorial will teach you how to use SuperDirt with Konduktiva. Installation instructions for SuperDirt is also provided here.
**Things To Note:** This tutorial assumes you have already installed Konduktiva successfully using the [[https://github.com/renickbell/konduktiva|Konduktiva installation]] instructions.
The link below will explain what SuperDirt is but following the installation instructions in the link is **NOT** recommended.
[[https://github.com/musikinformatik/SuperDirt|SuperDirt Explanation]]
====== Install Super Dirt Samples =====
One way is to run this inside supercollider:
Quarks.checkForUpdates({Quarks.install("SuperDirt", "v1.7.2"); thisProcess.recompile()})
Check if it has been installed at:
/home/user/.local/share/SuperCollider/downloaded-quarks/Dirt-Samples/
WARNING: Change user to your username.
OR
If that did not work you will have to go to download the zip from [[https://github.com/tidalcycles/Dirt-Samples|this github page]].
Unzip that and rename the unzipped directory as "//Dirt-Samples//"
then move it to:
/home/user/.local/share/SuperCollider/downloaded-quarks/Dirt-Samples/
WARNING: Change user to your username.
====== Inform Konduktiva of Super Dirt Samples Location =====
Check if //e.superDirtPath// is defined if it is not you will have have to manually define it with the step below. If it is defined move on to the **Update startup.scd file** part.
Manually update superDirtSamplesPath variable:
e.superDirtPath = "/home/user/.local/share/SuperCollider/downloaded-quarks/Dirt-Samples/"
WARNING: Change user to your username.
====== Update startup.scd file =====
Paste contents in ~/.config/SuperCollider/startup.scd
/*
This is an example startup file. You can load it from your startup file
(to be found in Platform.userAppSupportDir +/+ "startup.scd")
*/
(
s.reboot { // server options are only updated on reboot
// configure the sound server: here you could add hardware specific options
// see http://doc.sccode.org/Classes/ServerOptions.html
s.options.numBuffers = 1024 * 256; // increase this if you need to load more samples
s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages
s.options.numWireBufs = 64; // increase this if you get "exceeded number of interconnect buffers" messages
s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes"
s.options.numOutputBusChannels = 2; // set this to your hardware output channel size, if necessary
s.options.numInputBusChannels = 2; // set this to your hardware output channel size, if necessary
// boot the server and start SuperDirt
s.waitForBoot {
~dirt = SuperDirt(2, s); // two output channels, increase if you want to pan across more channels
~dirt.loadSoundFiles; // load samples (path containing a wildcard can be passed in)
// for example: ~dirt.loadSoundFiles("/Users/myUserName/Dirt/samples/*");
// s.sync; // optionally: wait for samples to be read
~dirt.start(57120, 0 ! 12); // start listening on port 57120, create two busses each sending audio to channel 0
// optional, needed for convenient access from sclang:
(
~d1 = ~dirt.orbits[0]; ~d2 = ~dirt.orbits[1]; ~d3 = ~dirt.orbits[2];
~d4 = ~dirt.orbits[3]; ~d5 = ~dirt.orbits[4]; ~d6 = ~dirt.orbits[5];
~d7 = ~dirt.orbits[6]; ~d8 = ~dirt.orbits[7]; ~d9 = ~dirt.orbits[8];
~d10 = ~dirt.orbits[9]; ~d11 = ~dirt.orbits[10]; ~d12 = ~dirt.orbits[11];
);
};
s.latency = 0.3; // increase this if you get "late" messages
};
);
====== Playing music With Supercollider =====
Open Supercollider and ensure you have Konduktiva loaded to K and any example MusicalEnvironment. Next run this code to hear some drumb noises:
K.setupSuperDirtPlayer(e,'kick')
K.simpleSamplePattern (e, 'kick', '808bd', 4)
K.simpleRhythmPattern (e,
{
voice: 'kick',
patternName: 'testKick',
patternLength: 4,
IOIs: [1,1,1,1],
bools: [true,false,true,false]
}
)
e.players.kick.rhythmMap = 'testKick'
e.players.kick.maskMap = 'testKick'
e.play('kick')
It should sound something like this:
{{ :superdirt-supercollider-testkick-audio.mp3 |}}
Next to hear more sounds run this code:
K.setupSuperDirtPlayer(e,'hat')
K.simpleSamplePattern (e, 'hat', 'electro1', 0)
testHat = new K.RhythmPattern('hat',4,[0.5,1,1,1,0.5],[false,true,true,true,true])
testHat.add(e)
e.players.hat.rhythmMap = 'straight'
e.players.hat.maskMap = 'hat'
e.play('hat')
This sound should be added:
{{ :superdirt-supercollider-testhat-audio.mp3 |}}
Run this to hear 2 more sounds:
K.setupSuperDirtPlayer(e,'clap')
K.simpleSamplePattern (e, 'clap', 'drumtraks', 1)
testClap = new K.RhythmPattern ('clap',4,[1,1,1,1],[false,true,false,true])
testClap.add(e)
e.players.clap.rhythmMap = 'straight'
e.players.clap.maskMap = 'clap'
e.play('clap')
K.setupSuperDirtPlayer(e,'tom')
K.simpleSamplePattern (e, 'tom', 'made', 0)
testTom = new K.RhythmPattern ('tom',4,[0.5,1,1,1,0.5],[true,false,true,false,true,true])
testTom.add(e)
e.players.tom.rhythmMap = 'straight'
e.players.tom.maskMap = 'tom'
e.play('tom')
These two sounds should be added.
{{ :superdirt-supercollider-testclap-audio.mp3 |}}
{{ :superdirt-supercollider-testtom-audio.mp3 |}}
All four together shoulkd sound like this:
{{ :superdirt-supercollider-together-audio.mp3 |}}