GUI examples bug fixes

nix
Gerard Roma 6 years ago
parent 27272ee6fb
commit 55f4a6f6d5

@ -7,8 +7,7 @@ var makeSynthDef;
Font.default = Font("Monaco", 16);
buffer = Buffer.new;
win = Window.new("HPSS",
Rect(200,200,800,450)).background_(Color.gray);
win = Window.new("HPSS", Rect(200,200,800,450)).background_(Color.gray);
soundFileView = SoundFileView.new(win)
.gridOn_(false)
@ -33,11 +32,9 @@ freqSscope.active_(true);
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
buffer = Buffer.read(Server.default, path[0]);
buffer.bufnum.postln;
soundFileView.soundfile = soundFile;
soundFileView.read(0, soundFile.numFrames);
});
@ -45,14 +42,8 @@ loadButton.action_{
loopButton.action_{|but|
if(but.value == 1, {
Routine{
{makeSynthDef.value}.defer;
"hi".postln;
Server.default.sync;
synth = Synth(\hpssExtractionDemo, [\buffer, buffer.bufnum]);
synth.postln;
{mixSlider.action.value(mixSlider)}.defer;
}.play;
mixSlider.action.value(mixSlider);
},{
synth.free;
});
@ -75,9 +66,8 @@ synthDef = SynthDef(\hpssExtractionDemo,
player = PlayBuf.ar(1, buffer, loop:1);
fhpss = FluidHPSS.ar(in: player, harmFilterSize: harmSize, percFilterSize: percSize, maskingMode: 1, harmThreshFreq1: 0.1, harmThreshAmp1: 0, harmThreshFreq2: 0.5, harmThreshAmp2: 0, percThreshFreq1: 0.1, percThreshAmp1: 0, percThreshFreq2: 0.5, percThreshAmp2: 0, windowSize: 1024, hopSize: 256, fftSize: -1);
mix =(bal * fhpss[0]) + ((1 - bal) * fhpss[1]);
Out.ar(0,Pan2.ar(SinOsc.ar(200)));
Out.ar(0,Pan2.ar(mix));
}
).add;
@ -105,5 +95,6 @@ win.layout_(
)
);
makeSynthDef.value;
win.front;
)

@ -52,18 +52,15 @@ sliders = Array.fill(4, {|i|
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
soundFileView.soundfile = soundFile;
soundFileView.read(0, soundFile.numFrames);
Routine{
audioBuffer = Buffer.read(server, path[0]);
server.sync;
FluidBufNMF.process(server,
audioBuffer.bufnum,destination:destBuffer.bufnum, components:4
audioBuffer.bufnum,resynth:destBuffer.bufnum, components:4
);
server.sync;
destBuffer.query;

@ -8,16 +8,16 @@ var synthDef, synth;
var synths;
var playing, currentSelection, colors, prevColor;
playing = Array.fill(10, {false});
var qwerty = "1234567890qwertyuiopasdfghjklzxcvbnm";
playing = Array.fill(qwerty.size, {false});
server = Server.default;
Font.default = Font("Monaco", 16);
audioBuffer = Buffer.new;
slicesBuffer = Buffer.new;
colors = Array.fill(64, {Color.rand});
synths = Array.fill(10, {nil});
colors = Array.fill(qwerty.size, {Color.rand});
synths = Array.fill(qwerty.size, {nil});
synthDef = SynthDef(\noveltySegDemo,{|buf, start, end|
Out.ar(0, BufRd.ar(1, buf, Phasor.ar(1, 1, start, end)));
@ -48,17 +48,16 @@ win = Window.new("NoveltySegmentation",
Rect(200,200,800,450)).background_(Color.gray);
win.view.keyDownAction_{|view, char, modifiers, unicode, keycode, key|
if (char.isDecDigit){
var digit = char.digit;
if(digit.notNil && slicesArray.notNil){
playFunc.value(digit - 1);
}
var num = qwerty.indexOf(char);
if (num.notNil&& slicesArray.notNil){
playFunc.value(num);
}
};
win.view.keyUpAction_{|view, char|
if(char.isDecDigit){
stopFunc.value(char.digit - 1);
var num = qwerty.indexOf(char);
if(num.notNil){
stopFunc.value(num);
}
};
@ -83,7 +82,6 @@ thSlider = Slider(win, Rect(0, 0, 100, 10)).value_(0.5);
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
audioBuffer = Buffer.read(server, path[0]);

@ -32,11 +32,9 @@ freqSscope.active_(true);
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
buffer = Buffer.read(Server.default, path[0]);
buffer.bufnum.postln;
soundFileView.soundfile = soundFile;
soundFileView.read(0, soundFile.numFrames);
});

@ -32,11 +32,9 @@ freqSscope.active_(true);
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
buffer = Buffer.read(Server.default, path[0]);
buffer.bufnum.postln;
soundFileView.soundfile = soundFile;
soundFileView.read(0, soundFile.numFrames);
});
@ -60,12 +58,12 @@ mixSlider.action_{|slider|
fwSlider.action_{|slider|
synth.set(\fw, ControlSpec(0, 5).map(slider.value));
synth.set(\fw, ControlSpec(0.0001, 3, \exp).map(slider.value));
};
bwSlider.action_{|slider|
synth.set(\bw, ControlSpec(0, 5).map(slider.value));
synth.set(\bw, ControlSpec(0.0001, 3, \exp).map(slider.value));
};

@ -7,6 +7,7 @@ var addSelections, playFunc, stopFunc;
var synthDef, synth;
var playing, currentSelection, colors, prevColor;
var qwerty = "1234567890qwertyuiopasdfghjklzxcvbnm";
playing = false;
server = Server.default;
@ -45,11 +46,9 @@ win = Window.new("TransientSegmentation",
Rect(200,200,800,450)).background_(Color.gray);
win.view.keyDownAction_{|view, char, modifiers, unicode, keycode, key|
if (char.isDecDigit){
var digit = char.digit;
if(slicesArray.notNil){
playFunc.value(digit - 1);
}
var num = qwerty.indexOf(char);
if(num.notNil && slicesArray.notNil){
playFunc.value(num);
}
};
@ -78,7 +77,6 @@ debounceSlider = Slider(win, Rect(0, 0, 100, 10)).value_(0.5);
loadButton.action_{
FileDialog({ |path|
path.postln;
soundFile = SoundFile.new;
soundFile.openRead(path[0]);
audioBuffer = Buffer.read(server, path[0]);
@ -88,8 +86,8 @@ loadButton.action_{
};
processButton.action_{|but|
var fw = ControlSpec(0, 5).map(fwSlider.value);
var bw = ControlSpec(0, 5).map(bwSlider.value);
var fw = ControlSpec(0.0001, 3, \exp).map(fwSlider.value);
var bw = ControlSpec(0.0001, 3, \exp).map(bwSlider.value);
var db = ControlSpec(1, 4410).map(debounceSlider.value);
if(but.value == 1, {
Routine{

Loading…
Cancel
Save