Multitrack is working - needed a separate recorder and granulator
for each buffer, and it's still creakyfeature-multitrack
parent
8a74f8612f
commit
86fe427429
110
grains.scd
110
grains.scd
|
@ -8,6 +8,33 @@ Server.killAll;
|
||||||
~frippbuffer.write("/Users/mike/Music/SuperCollider Recordings/slow.aiff");
|
~frippbuffer.write("/Users/mike/Music/SuperCollider Recordings/slow.aiff");
|
||||||
~frippbuffer.isNil;
|
~frippbuffer.isNil;
|
||||||
|
|
||||||
|
|
||||||
|
(
|
||||||
|
SynthDef(
|
||||||
|
\fripp_record,
|
||||||
|
{
|
||||||
|
arg in = 2, buffer = 0, mix = 0.25, record = 0.0;
|
||||||
|
var insig = record * In.ar(in, 1);
|
||||||
|
RecordBuf.ar(insig, buffer, 0, mix, 1 - mix, loop: 1)
|
||||||
|
}
|
||||||
|
).add;
|
||||||
|
|
||||||
|
|
||||||
|
SynthDef(
|
||||||
|
\grainsynth,
|
||||||
|
{
|
||||||
|
arg out=0, buffer, blen, pitchb, triggerb, posb, modb, size=0.1, amp=0.5, pan=0, track=0.25, jitter=0, blur=0.0;
|
||||||
|
var pitch, trigger, chor, pos, pans, grains, filtfreq;
|
||||||
|
trigger = In.kr(triggerb);
|
||||||
|
pitch = In.kr(pitchb);
|
||||||
|
pos = Wrap.kr(In.kr(posb, 1) + WhiteNoise.kr(blur), 0, 1);
|
||||||
|
pans = pan + WhiteNoise.kr(jitter) + (track * (In.kr(posb, 1) - 1));
|
||||||
|
grains = TGrains.ar(2, trigger, buffer, pitch, pos * blen, size, pans, amp);
|
||||||
|
Out.ar(out, grains);
|
||||||
|
}
|
||||||
|
).add;
|
||||||
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
||||||
~ntracks = 4;
|
~ntracks = 4;
|
||||||
|
@ -217,15 +244,6 @@ fork {
|
||||||
~makebuffers.value();
|
~makebuffers.value();
|
||||||
|
|
||||||
|
|
||||||
SynthDef(
|
|
||||||
\fripp_record,
|
|
||||||
{
|
|
||||||
arg in = 2, buffer = 0, mix = 0.25, record = 0.0;
|
|
||||||
var insig = record * In.ar(in, 1);
|
|
||||||
RecordBuf.ar(insig, buffer, 0, mix, 1 - mix, loop: 1)
|
|
||||||
}
|
|
||||||
).add;
|
|
||||||
|
|
||||||
~bufrecorders = Array.new(~ntracks);
|
~bufrecorders = Array.new(~ntracks);
|
||||||
|
|
||||||
~frippbuffers.do({
|
~frippbuffers.do({
|
||||||
|
@ -244,32 +262,31 @@ SynthDef(
|
||||||
|
|
||||||
~bufrecorder = ~bufrecorders[0];
|
~bufrecorder = ~bufrecorders[0];
|
||||||
|
|
||||||
// the main granulator synth
|
// the granulators
|
||||||
|
|
||||||
|
~granulators = Array.new(~ntracks);
|
||||||
|
~grainmodes = Array.fill(~ntracks, 0);
|
||||||
|
|
||||||
~granulator = SynthDef(
|
~frippbuffers.do({
|
||||||
\grainsynth,
|
| buffer, index |
|
||||||
{
|
[ "Grain synth: ", buffer, index ].postln;
|
||||||
arg out=0, buffer, pitchb, triggerb, posb, modb, size=0.1, amp=1.0, pan=0, track=0.25, jitter=0, blur=0.0;
|
~granulators.add(Synth.new(
|
||||||
var pitch, blen, trigger, chor, pos, pans, grains, filtfreq;
|
\grainsynth,
|
||||||
//trigger = Impulse.kr(120);
|
[
|
||||||
trigger = In.kr(triggerb);
|
\out, ~granulatorb,
|
||||||
pitch = In.kr(pitchb);
|
\buffer, buffer,
|
||||||
blen = BufDur.kr(buffer);
|
\blen, ~buflen,
|
||||||
pos = Wrap.kr(In.kr(posb, 1) + WhiteNoise.kr(blur), 0, 1);
|
\posb, ~playbacklfob,
|
||||||
pans = pan + WhiteNoise.kr(jitter) + (track * (In.kr(posb, 1) - 1));
|
\triggerb, ~triggerb,
|
||||||
grains = TGrains.ar(2, trigger, buffer, pitch, pos * blen, size, pans, amp);
|
\pitchb, ~pitchb,
|
||||||
Out.ar(out, grains);
|
\modb, ~lfob,
|
||||||
}
|
\size, 0.1
|
||||||
).play(s, [
|
],
|
||||||
\out, ~granulatorb,
|
s
|
||||||
\buffer, ~frippbuffers[~currentfripp],
|
))
|
||||||
\posb, ~playbacklfob,
|
});
|
||||||
\triggerb, ~triggerb,
|
|
||||||
\pitchb, ~pitchb,
|
~granulator = ~granulators[0];
|
||||||
\modb, ~lfob,
|
|
||||||
\size, 0.1
|
|
||||||
]);
|
|
||||||
|
|
||||||
// mixing and effects
|
// mixing and effects
|
||||||
|
|
||||||
|
@ -372,17 +389,27 @@ OSCdef.freeAll;
|
||||||
~to.button('/track', 0, { |v|
|
~to.button('/track', 0, { |v|
|
||||||
var buffer = ~frippbuffers[v];
|
var buffer = ~frippbuffers[v];
|
||||||
if( buffer.isNil.not, {
|
if( buffer.isNil.not, {
|
||||||
|
[ "set track to", v, buffer ].postln;
|
||||||
~bufrecorder.set(\record, 0.0);
|
~bufrecorder.set(\record, 0.0);
|
||||||
|
~bufrecorder.set(\mix, 0.0); // stop unselected track fading out
|
||||||
~bufrecorder = ~bufrecorders[v];
|
~bufrecorder = ~bufrecorders[v];
|
||||||
~bufrecorder.set(\record, ~to.v('/record'));
|
~bufrecorder.set(\record, ~to.v('/record'));
|
||||||
~granulator.set(\buffer, buffer);
|
~granulator = ~granulators[v];
|
||||||
[ "set track to", v, buffer ].postln;
|
~to.v_('/grainfx/mix', 0); // will always be 0 because we turned it off
|
||||||
|
~granulator.get(\amp, { | v | ~to.v_('/grainfx/gain', v) });
|
||||||
|
~granulator.get(\blur, { | v | ~to.v_('/grains/blur', v) });
|
||||||
|
~granulator.get(\size, { | v | ~to.v_('/grains/size', v) });
|
||||||
|
~granulator.get(\pan, { | v | ~to.v_('/grainfx/pan', v) });
|
||||||
|
~granulator.get(\track, { | v | ~to.v_('/grainfx/track', v) });
|
||||||
|
~granulator.get(\jitter, { | v | ~to.v_('/grainfx/jitter', v) });
|
||||||
|
// todo - set the grainmode based on what this one has
|
||||||
}, {
|
}, {
|
||||||
[ "Bad track index", v ].postln;
|
[ "Bad track index", v ].postln;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
~to.slider('/feedback', 0, TouchOSCScale(0, 0.25), { |v|
|
~to.slider('/feedback', 0, TouchOSCScale(0, 0.25), { |v|
|
||||||
~bufrecorder.set(\feedback, v) } );
|
~bufrecorder.set(\feedback, v) } );
|
||||||
|
|
||||||
|
@ -426,6 +453,7 @@ OSCdef.freeAll;
|
||||||
~to.button('/grains/mode', 0, { |v|
|
~to.button('/grains/mode', 0, { |v|
|
||||||
var mode = ~modes[v];
|
var mode = ~modes[v];
|
||||||
if( mode.isNil.not, {
|
if( mode.isNil.not, {
|
||||||
|
[ "granulator is", ~granulator ].postln;
|
||||||
~granulator.set(\posb, mode[1]);
|
~granulator.set(\posb, mode[1]);
|
||||||
~playbacklfo = mode[0];
|
~playbacklfo = mode[0];
|
||||||
~playbacklfob = mode[1];
|
~playbacklfob = mode[1];
|
||||||
|
@ -454,10 +482,10 @@ OSCdef.freeAll;
|
||||||
|
|
||||||
// Page 2: grainfx
|
// Page 2: grainfx
|
||||||
|
|
||||||
~to.slider('/grainfx/mix', 0.25, TouchOSCScale(0, 1), { |v|
|
~to.slider('/grainfx/mix', 0.25, TouchOSCScale(0, 1), { |v|
|
||||||
~bufrecorder.set(\mix, v);
|
~bufrecorder.set(\mix, v);
|
||||||
});
|
});
|
||||||
~to.slider('/grainfx/gain', 0.5, TouchOSCScale(0, 1), { |v| ~granulator.set(\amp, v) } );
|
~to.slider('/grainfx/gain', 0.5, TouchOSCScale(0, 1), { |v| ~granulator.set(\amp, v) } );
|
||||||
~to.slider('/grainfx/pt', 0.75, TouchOSCScale(0, 1), { |v| ~grainmixer.set(\passthrough, v) } );
|
~to.slider('/grainfx/pt', 0.75, TouchOSCScale(0, 1), { |v| ~grainmixer.set(\passthrough, v) } );
|
||||||
|
|
||||||
~to.button('/grainfx/back', 0, { |v| ~pitch.set(\dir, if( v > 0, { -1 }, { 1}))});
|
~to.button('/grainfx/back', 0, { |v| ~pitch.set(\dir, if( v > 0, { -1 }, { 1}))});
|
||||||
|
@ -574,3 +602,11 @@ OSCdef.freeAll;
|
||||||
~bufrecorder.set(\buffer, ~frippbuffers[1]);
|
~bufrecorder.set(\buffer, ~frippbuffers[1]);
|
||||||
|
|
||||||
|
|
||||||
|
~granulators[0].get(\buffer, {|v| v.postln});
|
||||||
|
|
||||||
|
(
|
||||||
|
~frippbuffers.do({
|
||||||
|
|b, i|
|
||||||
|
b.write("/Users/mike/Music/SuperCollider Recordings/buffer" ++ i.asString ++ ".aiff");
|
||||||
|
});
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue