[PD] default value for an abstraction's creation argument

Frank Barknecht fbar at footils.org
Mon Jul 23 00:29:12 CEST 2007


Hallo,
robbert van hulzen hat gesagt: // robbert van hulzen wrote:

> dear all,
> i'm wondering how to get a default value for an abstraction argument that is
> not specified. eg: my abstraction [equality] can take 3 arguments, but i
> don't want to *have* to type the arguments, in which case the abs should use
> a default value.
> i came up with the following solution:
> 
> [loadbang]
> |
> [$1]
> |
> [moses 1]
> |      |
> [t b]  /
> |    /
> |  /
> |/
> [f 440]    <-- default value
> 
> i'm not sure how elegant this is, really.

Almost as elegant as possible with current Pd: Arguments, that you
don't specify, get initialized as 0. So instead of [moses 1] you
could also use [select 0] and omit the [t b]. 

To also be able to leave arguments empty that are intented to become
symbols, you could use this idiom: 

 [loadbang]
 |
 [list append $1]
 |
 [select 0]
 |       |
 |       "by argument"
 |
 "default"

Also see the abstraction any_argument.pd in CVS/abstractions/purepd/

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__




More information about the Pd-list mailing list