[PD] [expr $f1 if...] bug?
Jonathan Wilkes
jancsika at yahoo.com
Tue Jan 31 20:15:22 CET 2012
----- Original Message -----
> From: Mathieu Bouchard <matju at artengine.ca>
> To: Lorenzo Sutton <lorenzofsutton at gmail.com>
> Cc: pd-list at iem.at
> Sent: Tuesday, January 31, 2012 1:04 PM
> Subject: Re: [PD] [expr $f1 if...] bug?
>
> Le 2012-01-31 à 18:33:00, Lorenzo Sutton a écrit :
>> On 31/01/2012 16:07, Jonghyun Kim wrote:
>>> expr $f1;
>>> if ($f1 == 1, 1, 0);
>>> if ($f1 == 5, 2, 0);
>>> if ($f1 == 9, 3, 0);
>>> if ($f1 == 13, 4, 0);
>>> if ($f1 == 17, 5, 0);
>>> if ($f1 == 21, 6, 0);
>>> if ($f1 == 25, 7, 0);
>>> if ($f1 == 29, 8, 0);
>>> if ($f1 == 33, 9, 0);
>>> if ($f1 == 37, 10, 0);
>>> if ($f1 == 41, 11, 0);
>>> if ($f1 == 45, 12, 0);
>> You could also use a [select] instead of [expr]. Something like
>> |
>> [sel 1 5 9 ... ]
>> | | | ... |
>> [1( [2( [3( ... [t b]
>> |
>> [0(
>
> Now that I think of it, with GridFlow (any version), you have this :
>
> [listfind 1 5 9 13 17 21 25 29 33 37 41 45]
> |
> [+ 1]
>
> To get a single index from 1 to 12, or 0 if not found.
>
> If you really need to send a zero for each time something is not found, however,
> you can do this :
>
> [#outer == (1 5 9 13 17 21 25 29 33 37 41 45)]
> |
> [# * (1 2 3 4 5 6 7 8 9 10 11 12)]
> |
> [#unpack 12]
> ||||||||||||
This is where Pd users suffer.
1) Type "||||||||||||"
2) Notice how long it takes and how your wrist feels
3) Make 12 connections from [#unpack 12] to some message boxes.
4) Notice how long it takes and how your wrist feels
-Jonathan
>
> But because of the pattern of numbers involved (equally spaced), you could use
> [mod 4] and [div 4] to separate $f1 into two parts, one part that should be 1,
> and the other that should be between 1 and 12. That's quite a shortcut.
>
> ______________________________________________________________________
> | Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
More information about the Pd-list
mailing list