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); Font.default = Font("Monaco", 16);
buffer = Buffer.new; buffer = Buffer.new;
win = Window.new("HPSS", win = Window.new("HPSS", Rect(200,200,800,450)).background_(Color.gray);
Rect(200,200,800,450)).background_(Color.gray);
soundFileView = SoundFileView.new(win) soundFileView = SoundFileView.new(win)
.gridOn_(false) .gridOn_(false)
@ -33,11 +32,9 @@ freqSscope.active_(true);
loadButton.action_{ loadButton.action_{
FileDialog({ |path| FileDialog({ |path|
path.postln;
soundFile = SoundFile.new; soundFile = SoundFile.new;
soundFile.openRead(path[0]); soundFile.openRead(path[0]);
buffer = Buffer.read(Server.default, path[0]); buffer = Buffer.read(Server.default, path[0]);
buffer.bufnum.postln;
soundFileView.soundfile = soundFile; soundFileView.soundfile = soundFile;
soundFileView.read(0, soundFile.numFrames); soundFileView.read(0, soundFile.numFrames);
}); });
@ -45,14 +42,8 @@ loadButton.action_{
loopButton.action_{|but| loopButton.action_{|but|
if(but.value == 1, { if(but.value == 1, {
Routine{
{makeSynthDef.value}.defer;
"hi".postln;
Server.default.sync;
synth = Synth(\hpssExtractionDemo, [\buffer, buffer.bufnum]); synth = Synth(\hpssExtractionDemo, [\buffer, buffer.bufnum]);
synth.postln; mixSlider.action.value(mixSlider);
{mixSlider.action.value(mixSlider)}.defer;
}.play;
},{ },{
synth.free; synth.free;
}); });
@ -75,9 +66,8 @@ synthDef = SynthDef(\hpssExtractionDemo,
player = PlayBuf.ar(1, buffer, loop:1); 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); 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]); mix =(bal * fhpss[0]) + ((1 - bal) * fhpss[1]);
Out.ar(0,Pan2.ar(SinOsc.ar(200))); Out.ar(0,Pan2.ar(mix));
} }
).add; ).add;
@ -105,5 +95,6 @@ win.layout_(
) )
); );
makeSynthDef.value;
win.front; win.front;
) )

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

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

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

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

Loading…
Cancel
Save