Quantcast

Question about KtlLoop + MKtl

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

Question about KtlLoop + MKtl

gilFuser
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about KtlLoop + MKtl

gilFuser
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

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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
|  
Report Content as Inappropriate

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
|  
Report Content as Inappropriate

Re: Question about KtlLoop + MKtl

gilFuser
In reply to this post by alberto.decampo
Oi Mestre dos Mestres.

Muito obrigado, mas ainda tenho problemas.

In my case I'm not controlling an Ndef. The elements actions are MFdefs that inside have functions like this:

MFdef(\aatk,
[
    \atk, { |el| ~dirt.set( \aatk,  \atk.asSpec.map(el.value) ) },  // this is setting parameters of SynthDefs that are in SC but being played by Tidal
    \gui, { |el| Ndef(\aGui).set( \atk, \atk.asSpec.map(el.value) ) }, // this is only to have a visual feedback of whats going on
    \post,{ |el| "% %\n".postf( "A. attack time ", \atk.asSpec.map(el.value).round(0.001) ) },
])

and the actions look like this:
~mktl.elAt(\k11).action = MFdef( \aatk )

I put the MFdef as object, like so:
~loop.object = MFdef(\aatk);
Here I didn't know what to put:
~loop.ktlMap_(( k11: \????? ));

I was able to record but when I tried to play it I got this error.
ERROR: Message 'includes' not understood

I also tried some other options, like adding the recordEvent to the MFdef. Like so:
MFdef(\aatk).add( \loop, { |el|
    var event = (\type: \set).put(el.name, el.value);
    "rec: ".post;
    event.postcs;
    ~loop.recordEvent( event );
};)

Thank you again Alberto. If you have any idea of what should I do, please tell me.

Bom fim de semana pra todos



<[hidden email]> schrieb am Fr., 12. Mai 2017 um 17:31 Uhr:
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
|  
Report Content as Inappropriate

Re: Question about KtlLoop + MKtl

gilFuser
Olá a todos

I got it to work. Maybe there is a better way, but it works and I can move on. Good.

The Ndefs that I was using just as free GUIs, now are sending their parameter values to control buses. I point the MtklLoop object to them, and voilà!

~hshape= Bus.control(s,1);
~hsus = Bus.control(s,1);
~hstret = Bus.control(s,1);

Ndef(\aSet).addSpec(\hshape, [0, 1, \lin]);
Ndef(\aSet).addSpec(\hsus, [0.16, 16, \exp, 0.1, 1]);
Ndef(\aSet).addSpec(\hstret, [0.1, 10, \exp, 0.025, 1]);

Ndef(\aSet, { | hshape= 0.5, hsus= 1, hstret= 1 |
    [ Out.kr(~hshape, hshape), Out.kr(~hsus, hsus), Out.kr(~hstret, hstret) ]
});

~dirt.set( \hshape, ~hshape.asMap, \hsus, ~hsus.asMap, \hstret, ~hstret.asMap );

Making this and using the example that Alberto made and I have it.

best regards,
Gil


Gil Fuser <[hidden email]> schrieb am Fr., 12. Mai 2017 um 19:44 Uhr:
Oi Mestre dos Mestres.

Muito obrigado, mas ainda tenho problemas.

In my case I'm not controlling an Ndef. The elements actions are MFdefs that inside have functions like this:

MFdef(\aatk,
[
    \atk, { |el| ~dirt.set( \aatk,  \atk.asSpec.map(el.value) ) },  // this is setting parameters of SynthDefs that are in SC but being played by Tidal
    \gui, { |el| Ndef(\aGui).set( \atk, \atk.asSpec.map(el.value) ) }, // this is only to have a visual feedback of whats going on
    \post,{ |el| "% %\n".postf( "A. attack time ", \atk.asSpec.map(el.value).round(0.001) ) },
])

and the actions look like this:
~mktl.elAt(\k11).action = MFdef( \aatk )

I put the MFdef as object, like so:
~loop.object = MFdef(\aatk);
Here I didn't know what to put:
~loop.ktlMap_(( k11: \????? ));

I was able to record but when I tried to play it I got this error.
ERROR: Message 'includes' not understood

I also tried some other options, like adding the recordEvent to the MFdef. Like so:
MFdef(\aatk).add( \loop, { |el|

    var event = (\type: \set).put(el.name, el.value);
    "rec: ".post;
    event.postcs;
    ~loop.recordEvent( event );
};)

Thank you again Alberto. If you have any idea of what should I do, please tell me.

Bom fim de semana pra todos



<[hidden email]> schrieb am Fr., 12. Mai 2017 um 17:31 Uhr:
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/
Loading...