gui and pattern on same synthdef

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

gui and pattern on same synthdef

Ch4n
This post was updated on .
Hi everyone, i try to create an fm synth with a basic gui end a pattern, basically i want a pattern who change the note but also a gui who change freq and others fm parameters for run a sequence and to modify parameters in real time, everything on the same synthdef.
Here i try to add a gui to a synthdef, but i can't also connect a pattern on the same synthdef, many tutorials talk about gui and about patterns but i cant find anything about their interaction, i need some help! thanks

Here is the code

(
SynthDef(\gamma, {|freq, freq2, amp, mod, fb, mfb|
        var signal, harmonics,env;
        harmonics = 16;

        signal = SinOscFB.ar(SinOscFB.ar(freq2,mfb,mul:mod)+freq,fb,amp);
        signal = FreeVerb.ar(signal);
        Out.ar(0, signal ! 2);
}).add;

)


(
var synth, win;
// we initialize the synth
synth = Synth(\gamma, [\freq, 100, \amp, 0,  \mod, 0, \freq2, 99.99,\fb, 0, \mfb, 0,]);
// specify the GUI window
win = Window.new("gamma", Rect(200,200, 460,230), false);
// and place the frequency and amplitude sliders in the window
StaticText.new(win, Rect(10,10, 160, 20)).font_(Font("Helvetica", 9)).string_("freq");
Slider.new(win, Rect(40,10, 160, 24))
        .action_({|sl| synth.set(\freq, [25.623, 401.31].asSpec.map(sl.value).postln) });
StaticText.new(win, Rect(10,46, 160, 20)).font_(Font("Helvetica", 9)).string_("amp");
Slider.new(win, Rect(40,46, 160, 24))
.action_({|sl| synth.set(\amp, [0, 1.0, \amp].asSpec.map(sl.value).postln) });

StaticText.new(win, Rect(10,82, 160, 20)).font_(Font("Helvetica", 9)).string_("mod");
Slider.new(win, Rect(40,82, 160, 24))
        .action_({|sl| synth.set(\mod, [0, 1000].asSpec.map(sl.value).postln) });
StaticText.new(win, Rect(10,118, 160, 20)).font_(Font("Helvetica", 9)).string_("fb");
Slider.new(win, Rect(40,118, 160, 24))
        .action_({|sl| synth.set(\fb, [0.0pi, pi].asSpec.map(sl.value).postln) });
StaticText.new(win, Rect(10,154, 160, 20)).font_(Font("Helvetica", 9)).string_("freq2");
Slider.new(win, Rect(40,154, 160, 24))
        .action_({|sl| synth.set(\freq2, [25.623, 401.31].asSpec.map(sl.value).postln) });
StaticText.new(win, Rect(10,190, 160, 20)).font_(Font("Helvetica", 9)).string_("mfb");
Slider.new(win, Rect(40,190, 160, 24))
        .action_({|sl| synth.set(\mfb, [0.0pi, pi].asSpec.map(sl.value).postln) });
// we then create the window
win.front;
)

Loading...