hi list,
what is the prefered vanilla way to set a range for the notein object?
say i only want midi notes 40 to 60 to play a pitched sound in my patch, notes below and above would control other parameters of "the synth".
i tried with two [moses] objects but it seems a bit convoluted and since i am dealing with a “list” of 3 values (pitch, velocity, channel) it is not very elegant.
thanks
Hi,
On 08/07/21 13:08, Simon Iten wrote:
hi list,
what is the prefered vanilla way to set a range for the notein object?
say i only want midi notes 40 to 60 to play a pitched sound in my patch, notes below and above would control other parameters of "the synth".
i tried with two [moses] objects but it seems a bit convoluted and since i am dealing with a “list” of 3 values (pitch, velocity, channel) it is not very elegant.
just use [unpack] before the two [moses] and [pack] after them.
If you really dislike the two [moses] objects you could have something like: [expr ($f1 >= 40) && ($f1 <= 60)]
in a single object and use it for a [spigot] to filter the numbers... But I'm not sure that's any better - and you'd still need to 'extract' only the first number, again most probably with [unpack].
It also really depends on the design of your patch... 'where' does the 3-value list come from? Are you generating it? Capturing it from a physical device, etc.?
My two cents, Lorenzo.
On 08/07/2021 12:08, Simon Iten wrote:
say i only want midi notes 40 to 60 to play a pitched sound in my patch, notes below and above would control other parameters of "the synth".
Lorenzo's suggestion to use [expr] seems good, but there is no need to [unpack] as [expr] can distribute a list across its variables:
#N canvas 500 93 495 363 12; #X msg 101 70 40 127 1; #X msg 111 96 60 127 1; #X msg 121 123 61 127 1; #X obj 199 185 expr ($f1 >= 40) && ($f1 <= 60); #X msg 83 45 39 127 1; #X obj 83 218 list prepend; #X obj 83 244 route 1 0; #X obj 83 297 print note; #X obj 113 271 print parameter; #X obj 83 160 trigger list list; #X connect 0 0 9 0; #X connect 1 0 9 0; #X connect 2 0 9 0; #X connect 3 0 5 1; #X connect 4 0 9 0; #X connect 5 0 6 0; #X connect 6 0 7 0; #X connect 6 1 8 0; #X connect 9 0 5 0; #X connect 9 1 3 0;
In this case, [trigger list float] would work just as well as you are dealing with the first number in the list, but this generalises —— just add conditions on velocity and channel to [expr].
Is this elegant? No, just brute-force literal mindedness, I guess, but I am an idiot.
Best
m
On 09/07/21 00:44, matthew brandi wrote:
On 08/07/2021 12:08, Simon Iten wrote:
say i only want midi notes 40 to 60 to play a pitched sound in my patch, notes below and above would control other parameters of "the synth".
Lorenzo's suggestion to use [expr] seems good, but there is no need to [unpack] as [expr] can distribute a list across its variables:
[...]
Right that works! As the OP seems to also want to keep the 'discarded' values. Another way of doing it without lists is the one below. Both with expr and without.
Of coruse there's not much info on where the values are 'coming from' and how they will be used: that could also be interesting to know. :-)
Lorenzo
BEGIN PATCH <<<<<<
#N canvas 665 146 595 494 12; #X obj 331 36 metro 1000; #X obj 331 10 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 331 206 unpack f f f, f 26; #X obj 329 347 pack f f f f, f 27; #X obj 329 385 route 1 0; #X obj 299 268 >= 40; #X obj 348 268 <= 60; #X obj 329 306 &&; #X obj 331 235 t f f f, f 9; #X obj 37 284 expr ($f1 >= 40) && ($f1 <= 60) ; $f1; #X text 37 239 All of this could also be; #X obj 331 97 random 30; #X obj 331 134 + 40; #X obj 410 97 random 127; #X obj 489 97 random 16; #X obj 331 170 pack f f f, f 23; #X obj 331 61 t b b b, f 23; #X obj 359 418 print <<OTHER>>; #X obj 329 447 print >> NOTE <<; #X text 94 153 Up to here , just simulating; #X text 96 171 what the input might be ------->; #X text 282 252 |; #X text 276 271 <; #X text 282 288 |; #X text 282 236 /; #X text 282 304 ; #X text 37 258 in a single expr such as:; #X connect 0 0 16 0; #X connect 1 0 0 0; #X connect 2 0 8 0; #X connect 2 1 3 2; #X connect 2 2 3 3; #X connect 3 0 4 0; #X connect 4 0 18 0; #X connect 4 1 17 0; #X connect 5 0 7 0; #X connect 6 0 7 1; #X connect 7 0 3 0; #X connect 8 0 5 0; #X connect 8 1 6 0; #X connect 8 2 3 1; #X connect 11 0 12 0; #X connect 12 0 15 0; #X connect 13 0 15 1; #X connect 14 0 15 2; #X connect 15 0 2 0; #X connect 16 0 11 0; #X connect 16 1 13 0; #X connect 16 2 14 0;
END PATCH <<<<<
thanks lorenzo and matthew!
i had a perliminary version with two moses objects running, but will give yours a try!
the input comes from a quneo controller, and i only want the pads to play sounds while all other buttons and faders (which also send out note on/off) are used for parameter changes.
since i also use the controller in other projects, i can’t reprogram it and have to deal with the presets i have.
cheers!
On 9 Jul 2021, at 11:03, Lorenzo Sutton lorenzofsutton@gmail.com wrote:
On 09/07/21 00:44, matthew brandi wrote:
On 08/07/2021 12:08, Simon Iten wrote:
say i only want midi notes 40 to 60 to play a pitched sound in my patch, notes below and above would control other parameters of "the synth".
Lorenzo's suggestion to use [expr] seems good, but there is no need to [unpack] as [expr] can distribute a list across its variables:
[...]
Right that works! As the OP seems to also want to keep the 'discarded' values. Another way of doing it without lists is the one below. Both with expr and without.
Of coruse there's not much info on where the values are 'coming from' and how they will be used: that could also be interesting to know. :-)
Lorenzo
BEGIN PATCH <<<<<<
#N canvas 665 146 595 494 12; #X obj 331 36 metro 1000; #X obj 331 10 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 331 206 unpack f f f, f 26; #X obj 329 347 pack f f f f, f 27; #X obj 329 385 route 1 0; #X obj 299 268 >= 40; #X obj 348 268 <= 60; #X obj 329 306 &&; #X obj 331 235 t f f f, f 9; #X obj 37 284 expr ($f1 >= 40) && ($f1 <= 60) ; $f1; #X text 37 239 All of this could also be; #X obj 331 97 random 30; #X obj 331 134 + 40; #X obj 410 97 random 127; #X obj 489 97 random 16; #X obj 331 170 pack f f f, f 23; #X obj 331 61 t b b b, f 23; #X obj 359 418 print <<OTHER>>; #X obj 329 447 print >> NOTE <<; #X text 94 153 Up to here , just simulating; #X text 96 171 what the input might be ------->; #X text 282 252 |; #X text 276 271 <; #X text 282 288 |; #X text 282 236 /; #X text 282 304 ; #X text 37 258 in a single expr such as:; #X connect 0 0 16 0; #X connect 1 0 0 0; #X connect 2 0 8 0; #X connect 2 1 3 2; #X connect 2 2 3 3; #X connect 3 0 4 0; #X connect 4 0 18 0; #X connect 4 1 17 0; #X connect 5 0 7 0; #X connect 6 0 7 1; #X connect 7 0 3 0; #X connect 8 0 5 0; #X connect 8 1 6 0; #X connect 8 2 3 1; #X connect 11 0 12 0; #X connect 12 0 15 0; #X connect 13 0 15 1; #X connect 14 0 15 2; #X connect 15 0 2 0; #X connect 16 0 11 0; #X connect 16 1 13 0; #X connect 16 2 14 0;
END PATCH <<<<<
<Screenshot_2021-07-09.png>_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list