gui and pattern on same synthdef

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

gui and pattern on same synthdef

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 =,mfb,mul:mod)+freq,fb,amp);
        signal =;, signal ! 2);


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 ="gamma", Rect(200,200, 460,230), false);
// and place the frequency and amplitude sliders in the window, Rect(10,10, 160, 20)).font_(Font("Helvetica", 9)).string_("freq");, Rect(40,10, 160, 24))
        .action_({|sl| synth.set(\freq, [25.623, 401.31] });, Rect(10,46, 160, 20)).font_(Font("Helvetica", 9)).string_("amp");, Rect(40,46, 160, 24))
.action_({|sl| synth.set(\amp, [0, 1.0, \amp] });, Rect(10,82, 160, 20)).font_(Font("Helvetica", 9)).string_("mod");, Rect(40,82, 160, 24))
        .action_({|sl| synth.set(\mod, [0, 1000] });, Rect(10,118, 160, 20)).font_(Font("Helvetica", 9)).string_("fb");, Rect(40,118, 160, 24))
        .action_({|sl| synth.set(\fb, [0.0pi, pi] });, Rect(10,154, 160, 20)).font_(Font("Helvetica", 9)).string_("freq2");, Rect(40,154, 160, 24))
        .action_({|sl| synth.set(\freq2, [25.623, 401.31] });, Rect(10,190, 160, 20)).font_(Font("Helvetica", 9)).string_("mfb");, Rect(40,190, 160, 24))
        .action_({|sl| synth.set(\mfb, [0.0pi, pi] });
// we then create the window