Question about KtlLoop + MKtl

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about KtlLoop + MKtl

gilFuser
Banned User
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Question about KtlLoop + MKtl

gilFuser
Banned User
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Question about KtlLoop + MKtl

alberto.decampo
Oi Mestre,

here is a little example, adapted from KtlLoop.schelp:


// use a KtlLoop to record and playback the slider movements of a nanoKontrol2

// make an MKtl
(
~mktl = MKtl(\x, "*trol2");
~mktl.gui;
~mktl.elAt(\sl).action = { |el| el.value.postln };
// move sliders to see that they do something
)

// make a sound to control
(
Ndef(\form, { |freq = 50, shape = 0.9, ffreq = 200, amp = 0.1, lag = 0.1|
    var snd = VarSaw.ar(freq.lag(lag) + [0.3, -0.3], 0, shape.lag(lag));
    Formlet.ar(snd * amp.lag(lag), ffreq.lag(lag), 0.003, 0.03).softclip;
}).play(vol: 0.2);
// add specs for its unusual params:
Ndef(\form).addSpec(\freq, [20, 200]);
Ndef(\form).addSpec(\shape, [0.5, 1]);
Ndef(\form).addSpec(\ffreq, [200, 12000, \exp]);
)

(
// map the first 4 sliders
~mktl.elAt(\sl, 0).action = { |el| Ndef(\form).setUni(\freq, el.value) };
~mktl.elAt(\sl, 1).action = { |el| Ndef(\form).setUni(\shape, el.value) };
~mktl.elAt(\sl, 2).action = { |el| Ndef(\form).setUni(\ffreq, el.value) };
~mktl.elAt(\sl, 3).action = { |el| Ndef(\form).setUni(\amp, el.value * 0.25) };
)


(
// make a KtlLoop for them
~loop = KtlLoop(\kel);
// the object to control
~loop.object = Ndef(\form);

// which params to record
~loop.paramsToRecord_(~mktl.elAt(\sl).collect(_.name).keep(4));

// which recorded controller params to use for setting which process params:
~loop.ktlMap_((sl_1: \freq, sl_2: \shape, sl_3: \ffreq, sl_4: \amp));

KtlLoopGui(~loop, 10, bounds: 330@180);
)

(
// connect them: use action of the group of all sliders  to record
~mktl.elAt(\sl).action = { |el|
        var event = (\type: \set).put(el.name, el.value);
        "rec: ".post;
        event.postcs;
        ~loop.recordEvent( event );
};
)

// try recording:
~loop.startRec;
// now move sliders ... then
~loop.stopRec;

// -> should get a recorded list info post:
// KtlLoop('kel') stopRec; // recorded list[2] with 145 events.

~loop.list;
~loop.list.size;

// try playback:
~loop.play;

// repeat the loop to try ...
~loop.looped = true;

// rescaling - all recorded controller values
// can be scaled, shifted, and inverted.

~loop.rescaled = false;

~loop.rescaled = true;
// decrease range toward center
~loop.scaler = 0.5;
~loop.scaler = 0.25;
// shift up or down
~loop.shift = 0.1;
~loop.shift = -0.1;

// invert range
~loop.invert;
~loop.up;
~loop.flipInv;

// dont rescale amp?
~loop.dontRescale(\sl_4);
~loop.doRescale(\sl_4);

~loop.postKtlInfo;


> On 12/05/2017, at 15:21 , [hidden email] wrote:
>
> I meant
> ~loop.recordEvent((mov: ~mktl.elAt(\k11)actcion));
>
> Gil Fuser <[hidden email]> schrieb am Fr., 12. Mai 2017 um 15:15 Uhr:
> Hi everyone.
>
> How can I record the movement of an MKtl element?
>
> I thought this would work:
>
> ~mktl.elAt(\k11).action = { |el| el.value.postln };
>
> ~loop = KtlLoop(\kel);
> ~loop.startRec;
> ~loop.recordEvent((mov: ~mktl.elAt(\k11).value));
> ~loop.stopRec;
> ~loop.play;
>
> I tried many variations of this idea, but couldn't find the way of doing it.
>
> bests,
> Gil
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Question about KtlLoop + MKtl

alberto.decampo
Just added an update of this example to the KtlLoop Quark:

Quark("KtlLoop").update; // … wait for update to finish …
// then do:
(Quark("KtlLoop").localPath +/+ "examples/KtlLoop_MKtl_example.scd").openOS;

best adc

> On 12/05/2017, at 17:31 , alberto.decampo <[hidden email]> wrote:
>
> Oi Mestre,
>
> here is a little example, adapted from KtlLoop.schelp:
>
>
> // use a KtlLoop to record and playback the slider movements of a nanoKontrol2
>
> // make an MKtl
> (
> ~mktl = MKtl(\x, "*trol2");
> ~mktl.gui;
> ~mktl.elAt(\sl).action = { |el| el.value.postln };
> // move sliders to see that they do something
> )
>
> // make a sound to control
> (
> Ndef(\form, { |freq = 50, shape = 0.9, ffreq = 200, amp = 0.1, lag = 0.1|
>    var snd = VarSaw.ar(freq.lag(lag) + [0.3, -0.3], 0, shape.lag(lag));
>    Formlet.ar(snd * amp.lag(lag), ffreq.lag(lag), 0.003, 0.03).softclip;
> }).play(vol: 0.2);
> // add specs for its unusual params:
> Ndef(\form).addSpec(\freq, [20, 200]);
> Ndef(\form).addSpec(\shape, [0.5, 1]);
> Ndef(\form).addSpec(\ffreq, [200, 12000, \exp]);
> )
>
> (
> // map the first 4 sliders
> ~mktl.elAt(\sl, 0).action = { |el| Ndef(\form).setUni(\freq, el.value) };
> ~mktl.elAt(\sl, 1).action = { |el| Ndef(\form).setUni(\shape, el.value) };
> ~mktl.elAt(\sl, 2).action = { |el| Ndef(\form).setUni(\ffreq, el.value) };
> ~mktl.elAt(\sl, 3).action = { |el| Ndef(\form).setUni(\amp, el.value * 0.25) };
> )
>
>
> (
> // make a KtlLoop for them
> ~loop = KtlLoop(\kel);
> // the object to control
> ~loop.object = Ndef(\form);
>
> // which params to record
> ~loop.paramsToRecord_(~mktl.elAt(\sl).collect(_.name).keep(4));
>
> // which recorded controller params to use for setting which process params:
> ~loop.ktlMap_((sl_1: \freq, sl_2: \shape, sl_3: \ffreq, sl_4: \amp));
>
> KtlLoopGui(~loop, 10, bounds: 330@180);
> )
>
> (
> // connect them: use action of the group of all sliders  to record
> ~mktl.elAt(\sl).action = { |el|
> var event = (\type: \set).put(el.name, el.value);
> "rec: ".post;
> event.postcs;
> ~loop.recordEvent( event );
> };
> )
>
> // try recording:
> ~loop.startRec;
> // now move sliders ... then
> ~loop.stopRec;
>
> // -> should get a recorded list info post:
> // KtlLoop('kel') stopRec; // recorded list[2] with 145 events.
>
> ~loop.list;
> ~loop.list.size;
>
> // try playback:
> ~loop.play;
>
> // repeat the loop to try ...
> ~loop.looped = true;
>
> // rescaling - all recorded controller values
> // can be scaled, shifted, and inverted.
>
> ~loop.rescaled = false;
>
> ~loop.rescaled = true;
> // decrease range toward center
> ~loop.scaler = 0.5;
> ~loop.scaler = 0.25;
> // shift up or down
> ~loop.shift = 0.1;
> ~loop.shift = -0.1;
>
> // invert range
> ~loop.invert;
> ~loop.up;
> ~loop.flipInv;
>
> // dont rescale amp?
> ~loop.dontRescale(\sl_4);
> ~loop.doRescale(\sl_4);
>
> ~loop.postKtlInfo;
>
>
>> On 12/05/2017, at 15:21 , [hidden email] wrote:
>>
>> I meant
>> ~loop.recordEvent((mov: ~mktl.elAt(\k11)actcion));
>>
>> Gil Fuser <[hidden email]> schrieb am Fr., 12. Mai 2017 um 15:15 Uhr:
>> Hi everyone.
>>
>> How can I record the movement of an MKtl element?
>>
>> I thought this would work:
>>
>> ~mktl.elAt(\k11).action = { |el| el.value.postln };
>>
>> ~loop = KtlLoop(\kel);
>> ~loop.startRec;
>> ~loop.recordEvent((mov: ~mktl.elAt(\k11).value));
>> ~loop.stopRec;
>> ~loop.play;
>>
>> I tried many variations of this idea, but couldn't find the way of doing it.
>>
>> bests,
>> Gil
>>
>


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Question about KtlLoop + MKtl

gilFuser
Banned User
This post was updated on .
In reply to this post by alberto.decampo
CONTENTS DELETED
The author has deleted this message.