|
|
|
@ -1,22 +1,49 @@ |
|
|
|
|
/* |
|
|
|
|
|
|
|
|
|
algoforte #3 (220105b) |
|
|
|
|
code for first track of "algoforte01" - a two-tracker release on my |
|
|
|
|
bandcamp: https://music.lukaprincic.si or https://bandcamp.com/lukaprincic |
|
|
|
|
track 2 is a live performance of most the ideas in here with some changes |
|
|
|
|
that seem to be necessary for live coding performance. :/ |
|
|
|
|
|
|
|
|
|
to use this code you need to be able to send midi out to either virtual |
|
|
|
|
instrument that plays a grand piano (a sampler or similar). i personally |
|
|
|
|
used Salamander Grand Piano SFZ loaded into Renoise. |
|
|
|
|
|
|
|
|
|
you can also use disklavier if you have one handy nearby. |
|
|
|
|
|
|
|
|
|
by starting MIDIClient.init (and waiting for a second or two) |
|
|
|
|
and then m=MIDIOut(0) a midi output/input is created for SC. |
|
|
|
|
|
|
|
|
|
the midi out from SC must go into midi input of the sampler/piano, |
|
|
|
|
use test Pbindef to test. midichannel on sampler/piano: 1 (in SC: 0) |
|
|
|
|
|
|
|
|
|
route audio output from piano back to SC and disconnect it from |
|
|
|
|
main output (speakers). this is easily done using JACK. |
|
|
|
|
|
|
|
|
|
requirement for this patch is also DEINDUGens which include JPverb |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
// algoforte #3 /////////////////////////////////////////////////////////////////////// |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// helpers: |
|
|
|
|
s.boot |
|
|
|
|
s.meter |
|
|
|
|
s.plotTree |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// init midi |
|
|
|
|
MIDIClient.init(1,1); |
|
|
|
|
|
|
|
|
|
// create output on channel 1 |
|
|
|
|
m = MIDIOut(0) |
|
|
|
|
|
|
|
|
|
// connect. |
|
|
|
|
m.connect |
|
|
|
|
|
|
|
|
|
// test |
|
|
|
|
Pbindef(\testmidi, \type, \midi, \midicmd, \noteOn, \midiout, m, \chan, 1, \amp, 0.5).play |
|
|
|
|
Pbindef(\testmidi).stop |
|
|
|
|
|
|
|
|
|
// processing input from piano |
|
|
|
|
( |
|
|
|
|
Ndef(\inDSPout, { |
|
|
|
@ -34,6 +61,7 @@ Ndef(\inDSPout, { |
|
|
|
|
Ndef(\inDSPout).fadeTime = 4 |
|
|
|
|
Ndef(\inDSPout).play(fadeTime:5) |
|
|
|
|
|
|
|
|
|
// when needed: |
|
|
|
|
Ndef(\inDSPout).end(30) |
|
|
|
|
Ndef(\inDSPout).stop |
|
|
|
|
|
|
|
|
@ -90,7 +118,7 @@ Pbindef(\p220105b, \type, \midi, \midicmd, \noteOn, \midiout, m, \chan, 1, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// --> |
|
|
|
|
// allocate new buffer |
|
|
|
|
b = Buffer.alloc(s, s.sampleRate*10, 1) |
|
|
|
|
|
|
|
|
|
// start recording into buffer via 'in' |
|
|
|
@ -99,10 +127,10 @@ Ndef(\recbuf, {var sn=\in.ar(0!2); RecordBuf.ar(sn[0], b)}) |
|
|
|
|
// plug output from inDSPout to in of \recbuf |
|
|
|
|
Ndef(\recbuf) <<>.in Ndef(\inDSPout) |
|
|
|
|
|
|
|
|
|
// is there something in a buffer? |
|
|
|
|
// is there something being recorded in a buffer? |
|
|
|
|
b.plot |
|
|
|
|
|
|
|
|
|
// stop recording to a buffer |
|
|
|
|
// when needed - stop recording to a buffer |
|
|
|
|
Ndef(\recbuf).clear |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,7 +151,8 @@ Ndef(\gran, { |
|
|
|
|
}) |
|
|
|
|
) |
|
|
|
|
Ndef(\gran).fadeTime = 5 |
|
|
|
|
Ndef(\recbuf).play |
|
|
|
|
Ndef(\gran).play |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ndef(\gran).end(30) // fadeout |
|
|
|
|
Ndef(\recbuf).stop // stop immediately (send note offs) |
|
|
|
|
Ndef(\gran).stop // stop immediately (send note offs) |
|
|
|
|