A collection of noisy, fun, cool, geeky, techy, wired or just plain wierd stuff for your consideration!

Posts tagged “Supercollider.

IxiLang percussive SynthDefs

(more…)

Advertisements

Pgeom normalization

When using a Pgeom, it can be rather difficult to tie it in with our time signature. Julio has shown me how to ‘normalize’ the Pgeom so that we can ensure that the pattern it creates will fit in with the structure of our piece. For example, to get our Pgeom pattern to last 4 beats we have to use the normalizeSum function. However we discovered that we cannot simply put this into our Pbind as below because our pattern will return one value at a time, and the normalizeSum needs to know all values before the pattern is played, if it is to perform its function.

Pdef(\synth,
(Pbind(\type,\midi,\midiout,m,\chan,0,
\midinote,Pseq([49,52,59,60,61,62,63,64]-1, inf),
\dur, Pgeom(1/8,0.8,10).normalizeSum*4,
\db,-3
)));

So we have to get the series of values from the Pgeom and create an array from it. This can then be normalized and the new values be used to control our pattern.

Array.geom(10, 1/8, 0.8).normalizeSum*4; // CREATE AN ARRAY OF VALUES USING GEOM PARAMETERS, BUT NORMALIZE THEM TO BE 4 BEATS LONG.

We can create this array as a variable and then enter it into our code. (Pn is a basic pattern class, that repeats the enclosed pattern for a user defined number of repeats, Plazy evaluates a function which returns a pattern, then embeds it in a stream)

Pdef(\synth,
(Pbind(\type,\midi,\midiout,m,\chan,0,
\midinote,Pseq([49,52,59,60,61,62,63,64]-1, inf),

\dur, Pn( Plazy{ \\EVALUATE FOLLOWING FUNCTION, THEN EMBED IN Pn STREAM
var axDur; \\CREATE VARIABLE axDur (ACCELERATING DURATION)
axDur = Array.geom(10, 1/8, 0.8).normalizeSum*4; \\ASSIGN ARRAY TO axDur
Pseq(axDur, 10); \\PLAY SEQUENCE USING VALUES FROM axDur 10 TIMES
},2) \\COMPLETE Pn PATTERN TWICE

\db,-3
)));

Pdef(\synth).play;

The Pgeom creates an effect that, to me, sounds more like a human musician – it can sound more like an improvised solo than a rigidly structured piece of code that is tied into a uniform time structure. By normalizing it is easier to control the length of Pgeom patterns and incorporate these into our work to create a much more interesting piece.


New discoveries!

Having written the main structure for my Laptop Musicianship task 1 i’m now experimenting with various patterns and nesting Pdefs for different effects. Pgoem is a fantastic pattern command, which i have used to introduce a harp solo into the piece, it allows values to be repeated whilst increasing the ouput value geometrically. The first argument is “start”, the second is “grow” (multiplication factor) and the third is “length” (number of values produced) e.g Outputs for Pgeom([1,1.5,3]) would be 1, 1.5,2.25. Used to control duration produces a very nice effect, especially when placing different Pgeoms into a Pseq. I have, as yet, not tried using it in other parts of the code.
I have also been experimenting with Pdefs to control transposition. Instead of writing several identical pieces of code over and over again i wrote it once, but as a Pdef –

e.g Pdef(\transposition, Pstutter(12,Pwrand([10,5,0,-2],[0.1,0.2,0.5,0.2],12)));.

Now every pattern i want to use this code in, can simply have the new Pdef nested within it –

e.g Pdef(\harps,
(Pbind ( \type, \midi, \midiout, m,\chan, 0,
\scale, [ 0, 3, 7, 12, 15, 20, 22,]-24,
\degree, Pseq([ 2,3,6,5,4,7]-1, 4),
\dur, Prand([Pstutter(2,Pseq([12/8,2/8, 2/8]/2, 4)), Pseq([12/8,2/8, 2/8], 4),],1),
\db, -3,
\mtranspose, Pdef(\transposition) //NESTED PDEF
)
)).quant_(4);

This is very handy, when you know you will be repeating sections of code, for reducing the amount of code that need to be written, and unless i’m mistaken, all patterns containing this nested Pdef will return the same value simultaneously. Each piece using Pdef(\transposition) in its code will transpose to the same note, whereas if i had written the code individually to each element they would transpose to different notes at each ‘return’ of the transposition code .
I hope this doesn’t sound too complicated, and that you do actually understand what i’m talking about, but if not then feel free to come and find me at uni and i’ll try and explain it in a better way.


Why Supercollider?

So i’ve got the basics of Supercollider pretty firmly wedged in my head, but why use it when i could sequence in Logic more easily? For a start Supercollider allows the introduction of randomness – simply add the correct pattern class (Prand, Pxrand, Pwrand etc) and it will decide for it self the sequence to be played, obviously to the parameters specified by the user, but it adds an element of improvisation on it’s own. This creates a more interesting flow to pieces composed. Also by defining patterns using Pdef, once triggered, it grants the ability to amend and edit the patterns live, without stopping the piece, which is invaluable. The track will be playing away, and you can alter the parameters you have given it in real-time. These changes can be faded in over a period of time, or quantized to start at the beginning of the next bar (or whatever you specify). It also lets you synthesize your own sounds, or route midi to an external source (Logic, Cubase, Reason etc) making it a very versatile program
Supercollider allows a more flexible approach to the construction of music, and makes live performances more intricate. Logic is great for many things, but it seems to me to be more aimed at the sequencing side of things. Logic requires all parameters to be firmly set, it does not think for itself, it will not improvise using randomness – once you have sequenced your melody, for, example, changing it ‘on-the-fly’ is not quite so easy.
Yes, the coding can be very complicated (and I’m only just starting out!) but as long as you understand the syntax and input the required information then it is very flexible. So do i prefer Logic or Supercollider? I really like them both, they just have their different uses, they excel in different ways, and link them together and you have a rather magical combination.


1st recording of Supercollider Live track

Here is a piece i’m composing, in the Locrian mode, through Supercollider. Please be aware this is a rough draft of the piece, i have loads more work to do before this is finished, but it’s starting to get there. The code is shown below, and then the audio is playable through the embedded player at the bottom, again the actual performance side of this is in very early stages. I have failed at getting the different parts to quantize as i would like, but with more practice i’ll have that sussed soon, this is merely so you can have a listen to the initial ideas, the finished piece should be alot more polished! I have kept the percussion simple to begin with so i can concentrate on the melodic content, and i will be trying to keep it as traditionally orchestral as possible.

(
Pdef(\harps,
(Pbind ( \type, \midi, \midiout, m,\chan, 0,
\scale, [ 11, 12, 14, 16, 17, 19, 21,]-24,
\octave, Prand([4,5], inf),
\degree, Pseq([ 2,3,6,5,4,7]-1, inf),
\dur, Pseq([12/8,2/8, 2/8], inf),
\db, -3
)
)).quant_(4);
)
(
Pdef(\harp2,
(Pbind ( \type, \midi, \midiout, m,\chan, 0,
\scale, [ 11, 12, 14, 16, 17, 19, 21,],
\octave, Prand([4,5,], inf),
\degree, Pseq([ 2,\rest,3,\rest,6,\rest,5,\rest,4,\rest,7,\rest,]-1, inf),
\dur, Pseq([3/8,1/8, 2/8, 1/8, 1/8], inf),
\db, -3,
\legato, 2
)
)).quant_(4);
)
(
Pdef(\cello,
(Pbind ( \type, \midi, \midiout, m,\chan, 2,
\scale, [ 11, 12, 14, 16, 17, 19, 21,]-36,
\degree, Pseq([2,3,6,5,4,7]-1, inf),
\dur, Pseq([24/8,4/8, 4/8], inf),
\db, -3
)
)).quant_(4);
)
(
Pdef(\glock,
(Pbind ( \type, \midi, \midiout, m,\chan, 1,
\scale, [ 11, 12, 14, 16, 17, 19, 21,]+12,
\octave, Prand([5,6,], inf),
\degree, Pseq([ 2,3,6,5,4,7]-1, inf),
\dur, Pseq([1/8, 2/8, 1/8, 2/8,2/8,], inf),
\db, -3
)
)).quant_(4);
)
(
Pdef(\glock2,
(Pbind ( \type, \midi, \midiout, m,\chan, 1,
\scale, [ 11, 12, 14, 16, 17, 19, 21,]+12,

\degree, Pseq([ \rest, 2,\rest,3,\rest,6,\rest,5,\rest,4,\rest,7,]-1, inf),
\dur, Pseq([3/8,1/8, 2/8, 1/8, 1/8], inf),
\db, -3,
\legato, 2
)
)).quant_(4);
)

(
Pdef(\timpani,
(Pbind ( \type, \midi, \midiout, m,\chan, 3,
\scale, [ 11, 12, 14, 16, 17, 19, 21,]-24,
\degree, 1,
\dur, 4,
\db, -3
)
)).quant_(4);
)
(
Pdef(\kit,
(Pbind ( \type, \midi, \midiout, m,\chan, 4,
\midinote, 55,
\dur, 8,
\db, -3
)
)).quant_(4);
)
(
Pdef(\kit1,
(Pbind ( \type, \midi, \midiout, m,\chan, 5,
\midinote, Pseq([36,\rest,\rest,],inf),
\dur, 1/2,
\db, -3
)
)).quant_(4);
)

(
Pdef(\break,
(Pbind ( \type, \midi, \midiout, m,\chan, 7,
\midinote, Pseq([36,\rest,37,\rest,\rest,36,37,\rest,], inf),
\dur, 1/4,
\db, -3
)
)).quant_(4);
)
(
Pdef(\percfx,
(Pbind ( \type, \midi, \midiout, m,\chan, 8,
\midinote, Pseq([41,47,\rest,45,\rest,51,\rest,55,], inf),
\dur, 1/2,
\db, -3
)
)).quant_(4);
)

Pdef(\harps).play;
Pdef(\harp2).play;
Pdef(\cello).play;
Pdef(\glock).play;
Pdef(\glock2).play;
Pdef(\timpani).play;
Pdef(\kit).play;
Pdef(\kit1).play;
Pdef(\break).play;
Pdef(\percfx).play;

Pdef(\harps).stop;
Pdef(\harp2).stop;
Pdef(\cello).stop;
Pdef(\glock).stop;
Pdef(\glock2).stop;
Pdef(\timpani).stop;
Pdef(\kit).stop;
Pdef(\kit1).stop;
Pdef(\break).stop;
Pdef(\percfx).stop;


Multichannel MIDI using Supercollider and Logic Pro 9

Today i learnt how to send different MIDI outputs, to separate channels within Logic. Now the real fun can begin!!!! Using this technique, along with Supercolliders Pdef (Pattern define) instruction it seems possible to start making some tracks to play and edit live. Instead of simply sending MIDI, through Logic, to one software instrument , i can start mixing up the instruments. Setting one pattern to play on bass, one pattern to play a drum track and one pattern to play a synth line is now a possibility. Still lots of experimenting to do before i get this mastered but i’m on the way.

For anyone who wants to know i’ll (try to) explain how to do this.
1) Load Logic and create two channels for software instruments. (one for piano, one for guitar for example)
2) Select the first channel. Now in the inspector window you should see (about half way down) a triangle next to the name of the instrument you have chosen, click it. This will reveal some variables for this channel. Set the MIDI channel (default: all) to 1.
3) Repeat this for the second channel, setting the MIDI channel to 2.
4) Now right-click on the record button (on the transport bar) and select ‘recording settings’. Make sure the ‘Auto demix by channel if multitrack recording’ box is ticked.
5) Load Supercollider and initialize the MIDI client and setup a MIDI out, by evaluating the following lines of code.
6) Ensure that the ‘r’ record button is pressed on all channels or the information is only sent to the ones that do have it selected (it turns red when when selected)

MIDIClient.init(0, 1);

m = MIDIOut (0, MIDIClient.destinations[0].uid);

6) Now when writing you MIDI code you need to instruct Supercollider which channel to play to. Here’s some code i wrote earlier to demonstrate.

(
Ppar(
[
Pbind ( \type, \midi, \midiout, m, \chan,0,
\scale, [ 10, 11, 13, 15, 16, 18, 20, 22],
\degree, Prand([ 1,2,3,4,5,6,7,8,], inf),
\dur, Pseq([1, 1/2, 1, 1/4, 1/4, ], inf),
\db, -4
),
Pbind ( \type, \midi, \midiout, m, \chan,1,
\scale, [ 0, 1, 3, 5, 6, 8, 10, 12],
\degree, Pseq([1,3,5,7,1,5,3,7, ], inf),
\dur, Pseq([1/4, 1/8, ], inf),
\db, -5
),
], inf
).play
)
The first Pbind is set (using the ‘\chan’ command) to play from the Logic channel that is set to MIDI Channel 1, and the second Pbind will play through the Logic channel set to MIDI Channel 2. (Supercollider starts counting at 0. So Logic Midi channel 1 = Supercollider Midi channel 0, Logic MIDI channel 2 = Supercollider Midi channel 1 etc) The Ppar lets us combine Pbinds, and play them simultaneously.

Hopefully that made sense. If not come and find me at Uni and i’ll try and explain it a bit better.


Laptop Musicianship (coding, scales and modes)

Starting to get my head round supercollider coding more and more. Still struggling slightly with the musical theory side of things, but i always knew i would find this tougher. I’ve never had any musical training, and am trying to work hard at getting this to sink in. I’ve ordered several books to work through. I’ll get it soon enough.

Here’s a nice little piece of code i wrote, a small improvisation (Locrian i think!!)

(
Ppar(
[ Pbind ( \type, \midi, \midiout, m,
\scale, [ 11, 12, 14, 16, 17, 19, 21, 23],
\degree, Prand([ 1,2,3,4,5,6,7,8,], inf),
\dur, Pseq([1, 1/2, 1, 1/4, 1/4, ], inf),
\db, -4
),
Pbind ( \type, \midi, \midiout, m,
\scale, [ 1, 2, 4, 6, 7, 9, 11, 13],
\degree, Pseq([1,3,5,7,1,5,3,7, ], inf),
\dur, Pseq([1/4, 1/8, ], inf),
\db, -5
),

], inf
).play
)

(quite basic i know, but i’m progressing!!)
Here’s one that is Mixolydian (unless i’m getting confused)

Mixolydian
(
Ppar(
[ Pbind ( \type, \midi, \midiout, m,
\scale, [7, 9, 11, 12, 14, 16, 17, 19],
\degree, Prand([\rest,[1,3,5], [2,4,6], [1,4,7],[2,3,8],], inf),
\dur, Prand([1, 2, 1, 2, ], inf),
\db, -4
),
Pbind ( \type, \midi, \midiout, m,
\scale, [17, 19, 21, 22, 24, 26, 27, 29],
\degree, Prand([\rest, 1,4,7, 2,5,8,3,6,], inf),
\dur, Prand([1/2, 1, 1/2, 1, ], inf),
\db, -2
), Pbind ( \type, \midi, \midiout, m,
\scale, [27, 29, 31, 32, 34, 36, 37, 39],
\degree, Prand([\rest, 1,4,7, 2,5,8,3,6,], inf),
\dur, Prand([1/4, 1/8, ], inf),
\db, -4
),
], inf
).play
)

On piano it sounds a bit bizarre, but try putting it through a drum kit in logic ( i suggest asian kit found in ‘world>asian>asian kit’ in the library window, or any the warped kits( drums and percussion > warped kits) sounds quite good.)
I’ve tried setting up multiple midi outputs from supecollider to control different channels in logic, but have failed miserably. Please message me if you’ve figured it out.