.cc - week nine.
Still a work in progress. Currently this looks like it should, just all GUI elements are not working properly. I've had trouble doing this, as the BBCut Class Library is fairly difficult, or atleast unlike what I am used to when developing a GUI. While it probably looks a rushed effort, significant amounts of time went into this.
(
// Simplified Sound File Select Dialogue (Returns Handle to Sound File)
~sampleSelect = {
// Vars
var bufID;
// Read sound file into buffer and grab buffer id
bufID = Buffer.loadDialog(s);
// Return Buffer ID
bufID;
};
)
(
// Create Sample Handle
~sampleHandle = ~sampleSelect.value;
)
(
// Determine Sample Path
~samplePath = ~sampleHandle.path;
)
//use the GUI to find onsets for a loaded sample- use post to output the data array
Segmentation.new
(
// paste results here:
~data = [ [ 0, 0.44247916666667, 0.046009756624699, 1 ], [ 21239, 0.386375, 0.0027814882341772, 1 ], [ 39785, 0.8573125, 0.058457486331463, 2 ], [ 97502, 0.38320833333333, 0.015279575251043, 2 ], [ 115896, 0.78910416666667, 0.014642789959908, 2 ], [ 153773, 0.39583333333333, 0.044767320156097, 3 ], [ 172773, 0.40035416666667, 0.0050696325488389, 1 ], [ 191990, 0.84677083333333, 0.075923785567284, 1 ], [ 249257, 0.37785416666667, 0.018813425675035, 2 ], [ 267394, 0.37808333333333, 0.016685917973518, 2 ] ];
)
(
var w, clock, finalCut, finalCut2;
var buttonHi = 24, buttonStack = 20, textStack = 50, sliderStack = 80;
// GUI.window returns the window class for the current kit
// ; hence GUI.window.new instantiates a new window
w = GUI.window.new( "Cutter", Rect(128, 644, 520, 660));
// w.view.decorator = FlowLayout( w.view.bounds );
w.view.background = Color( 0.0,0.714,0.96 );
clock = ExternalClock(TempoClock(2.1));
clock.play;
5.do({ arg i; //, divLow = 1, divHigh = 2;
var b, line, titleBox;
var sf, cutSynth, cutProc, cutSlider;
b = SCButton(w, Rect(20, buttonStack, 75, buttonHi ))
.states_([
[ "Drum " ++ i ++ " Off", Color.black, Color.rand ],
[ "Drum " ++ i ++ " On", Color.white, Color.red ]
])
.action_({ arg butt;
//BUTTON ACTION
(
Routine.run({
sf = BBCutBuffer(~samplePath, 8, ~data);
s.sync; //this forces a wait for the Buffer to load
cutSynth = CutBuf3(sf); /*(
sf, //buffer
1.3, //random cut playback probab.
1.0, //ratio IOI
false, //attack env
false //release env
); */
cutProc = BBCutProc11.new; /*(
2, //sub division
4.0, //4.0, //barlength
2, //phrase bars 2
2, //numrepeats 2
1.0, //stutterchance
2, //stutterspeed divLow.round(1.0)
1.0 //stutterarea
);*/
finalCut = BBCut2(
cutSynth, // cut groups
cutProc // algorithm generating cuts
);
finalCut2 = finalCut.play;
});
)
//END BUTTON ACTION
});
titleBox = SCStaticText(
parent: w,
bounds: Rect(20, textStack, 410, buttonHi)
);
titleBox.stringColor_(Color.white);
titleBox.background_(Color(0.0,0.714,0.96));
titleBox.string_("Cut Length:");
titleBox.font_(Font("Arial Black", 15));
cutSlider = SCRangeSlider(w, Rect(20, sliderStack, 312, buttonHi));
cutSlider.lo_(0.2);
cutSlider.range_(0.4);
cutSlider.action_({ |slider|
cutProc.set(\divLow, (slider.lo * 8), \divHigh, (slider.hi * 8));
});
buttonStack = buttonStack + 100; //UI look
textStack = textStack + 100;
sliderStack = sliderStack + 100;
});
//END DO LOOP
//taken from here
{
arg divLow = 0.0;
var sliderPan, panL = 0.2; //v = SinOsc.ar(finalCut); //bad
var l, x, y, p, q, a, j, c, d;
p = LFSaw.ar(200);
q = LFSaw.ar(301);
sliderPan = SCSlider(w, Rect(400, 100, 40, 400));
sliderPan.focusColor_(Color.white);
sliderPan.action_({
//~randComb.set(\panL, [-1.0, 1.0].asSpec.map(sliderPan.value));
panL = ([-1.0, 1.0].asSpec.map(sliderPan.value).round(0.001));
});
sliderPan.value_(0.95);
//arg panVal = panL;
#l, x, y = BiPanB2.ar(
p,
q,
0.0,//panVal
0.1);
#a, j, c, d = DecodeB2.ar(4, l, x, y);
[a, j, d, c] // reorder to my speaker arrangement: Lf Rf Lr Rr
}.play;
// B-format encode
//from here
// B-format decode to quad
w.front;
)
//END
.sources.
Haines, Christian 16.10.08, "Spatialisation," Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
22.10.08
copywrite 4:29 pm
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment