[PD] Edit Pd file to change coordinates. pdlua or other language?

João Pais jmmmpais at gmail.com
Sat Mar 19 23:56:13 CET 2016


Hi Fred,

> This functionality can be created in any proper language, but it is hard  
> to create a generic solution based on your example. For instance, how do  
> you know it will be all the lines except the ones you specify, and do  
> you really want all the objects at 100,100 ?

Well, the purpose would be to know because the code makes it happen. Just  
like you know that [expr if($f1 >= 0, 1, -1)] gives out a 1 for numbers  
above and 0, and -1 for numbers below.


> Only if you have a large number of patches with the same structure and  
> object order it is worthwhile to create a program like you propose to  
> patch them. Otherwise a proper code-editor will be as time-efficient in  
> changing the patches.
>
> If in this case you just want the [expr] and [hradio] at 100,100 for a  
> number of patches a sed* script will do...
>
> Creating a script to convert patches costs effort, so you want it as  
> generic as possible. If it can be used only once, a code editor is a  
> better way.

With one single patch I have here, there are 8805 lines of code. Is it  
easier to change this by hand than to find a general solution? And if I  
change a couple of objects and want to try this again, should I redo it  
every time?


> Fred Jan
>
> *) sed is a unix tool just like grep, only more flexible... Maybe you  
> should try to install cygWin, then you get most unix tools on Windows.  
> However, prepare for a steep learning curve...
>
> Success,
>
> Fred Jan
>
> P.S. first non-optimized attempt:
> cat jmmmp.pd | sed -e 's/#X obj [1-9][0-9]* [1-9]expr/' -e 's/#X obj  
> [1-9][0-9]* [1-9][0-9]* expr/#X obj 100 100 hradio/'

I thank you for this, but I think you didn't understand the purpose: I'm  
looking for a general tool. If I needed to edit 5 lines, it would have  
been much faster to do it by hand than to write a mail bothering people  
about it.

Best,

Joao



More information about the Pd-list mailing list