• sdaau_ml

    Hi all,

    I would like to have a slider, which I can set up to be in range, say, from 0 to 255, which will be integer. I used the vsl slider ( https://puredata.info/docs/developer/PdFileFormat#r364 ), and that one produces float values, but I can have an [int] box after that, and I get integers - that is fine.

    However, depending on the size of the slider, sometimes the finest motion I can do with the mouse, results in jumps of more than 1 count - and the vsl slider seems to not react on arrow key presses.

    So, I would like to have the possibility to "nudge" or "step" the slider in a defined increment of 1, using the arrow keys; for instance, if you try this in HTML:

    <input type="range" id="my_slider" name="my_slider" min="0" max="255" step="1" />

    .... then the resulting slider can be selected with a click, and then one can press the Arrow Left/Right (or Up/Down) keys, and the slider will increment/decrement the current value for the step (here 1).

    Is there anything like that - maybe an external - in PD?


    posted in technical issues read more
  • sdaau_ml

    Hi @lacuna,

    it's a Deken-package.
    Deken is build-in PD-vanilla: search & install packages easily

    Thanks for the explanation - was not aware of that!

    Could anyone post a screenshot of the helpfile, please?

    I saw you found it - but still, for reference, here is how it looks for me:


    posted in technical issues read more
  • sdaau_ml

    Thanks again @lacuna - great to have that thread as reference!

    Just tried it for a bit: I cannot seem to find any binary releases in the github, https://github.com/mganss/pdjs (EDIT: found them https://github.com/mganss/pdjs/releases )- so I went along with this:


    I don't really understand what this .dek file is supposed to be, but the page itself says it is a zip file, so I tried this (I use MSYS2 bash shell in Windows):

    $ wget http://puredata.info/Members/mganss/software/pdjs/1.2.63/pdjs%5Bv1.2.63%5D%28Darwin-amd64-32%29%28Linux-amd64-32%29%28Linux-arm64-32%29%28Windows-amd64-32%29.dek/at_download/file -O pdjs_v1.2.63.dek
    $ unzip pdjs_v1.2.63.dek
    Archive:  pdjs_v1.2.63.dek
      inflating: pdjs/js.dll
      inflating: pdjs/js.l_arm64
      inflating: pdjs/js.pd_darwin
      inflating: pdjs/js-help.pd
      inflating: pdjs/js.pd_linux
      inflating: pdjs/js-help.js

    nice, now I have a pdjs folder; so I tried copying it to my 32-bit copy of PurrData:

    $ mv pdjs /c/bin/PurrData_x86_2.15.2/extra/
    $ /c/bin/PurrData_x86_2.15.2/bin/pd.exe -verbose

    Here, in an empty patch, I place an object [pdjs/js test.js] (see also the note in the Github README about declare -path pdjs); and I get:

    tried C:\\Program Files (x86)\\Common Files\\Pd-l2ork\\pdjs\\js\\pdjs\\js.pd and failed
    tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.m_i386 and failed
    tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.dll and succeeded
    verbose( 1):C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.dll: couldn't load
    tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.pd and failed
    tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js.pat and failed
    tried C:\\bin\\PurrData_x86_2.15.2\\extra\\pdjs\\js\\pdjs\\js.pd and failed
    error: couldn't create "pdjs/js test.js"

    Hmmm... library got found, but is not loaded; then I thought, let's check:

    $ file /c/bin/PurrData_x86_2.15.2/bin/pd.exe
    /c/bin/PurrData_x86_2.15.2/bin/pd.exe: PE32 executable (GUI) Intel 80386 (stripped to external PDB), for MS Windows
    $ file /c/bin/PurrData_x86_2.15.2/extra/pdjs/js.dll
    /c/bin/PurrData_x86_2.15.2/extra/pdjs/js.dll: PE32+ executable (DLL) (GUI) x86-64, for MS Windows

    Yeah - I cannot load a 64-bit .dll by a 32-bit .exe!

    So, apparently, there is no 32-bit build for pdjs (see "Supported platforms" in the Github README), so I installed the 64-bit build of Purr Data ... and tried it there:

    $ cp -a /c/bin/PurrData_x86_2.15.2/extra/pdjs /c/bin/PurrData_x86_64_2.15.2/extra/
    $ /c/bin/PurrData_x86_64_2.15.2/bin/pd.exe -verbose

    ... and finally, could see it working - instantiating [pdjs/js test.js] gives messages:

    tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\pdjs\\js.m_i386 and failed
    tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\pdjs\\js.dll and succeeded
    pdjs version 1.2.63 (v8 version 8.6.395.24)
    tried C:\\bin\\PurrData_x86_2.15.2\\test.js and failed
    tried C:\\Users\\user\\AppData\\Roaming\\Pd-l2ork\\test.js and failed
    tried C:\\Program Files\\Common Files\\Pd-l2ork\\test.js and failed
    tried C:\\bin\\PurrData_x86_64_2.15.2\\extra\\test.js and failed
    error: Script file 'test.js' not found.
    ... click the link above to track it down, or click the 'Find Last Error' item in the Edit menu.
    error: couldn't create "pdjs/js test.js"

    One invocation that works for quick test is [pdjs/js pdjs/js-help.js], which succeeds - and then you can right-click the object and see the Help.

    Finally, note this from the README:

    There is no built-in editor like in Max, source files have to be created and edited outside of Pure Data.

    Well, this is nice! On to see how to work with this object...

    Thanks again for the help!

    posted in technical issues read more
  • sdaau_ml

    Thanks so much for the answer, @lacuna:

    pdjs lib should run in Purr Data, doesn't it?

    I had no idea it existed - I just wrote pdjs in the OP as an "example pseudocode" - NICE!

    Is this the link to pdjs? http://puredata.info/Members/mganss/software/pdjs/1.2.63/

    Seemingly pdjs is not included with latest PurrData, but I'll try to install from the above link - hopefully it works ...

    posted in technical issues read more
  • sdaau_ml

    Hi all,

    Has been a while since I've used Pure Data. Now I'm about to do a small project, which I should share with collaborators, which do not have Pure Data background, however, are comfortable with JavaScript. For this, I'm considering doing some patches in Purr Data.

    Back in the days, I was aware of the following:

    (via https://newcome.wordpress.com/2013/12/29/scripting-pure-data/ ; https://forum.pdpatchrepo.info/topic/9650/best-way-to-write-code-in-pd):

    I have tried these in latest Purr Data on Windows - pdlua is still there; however, no trace of pyext/py.

    Now, I was wondering - I am aware that Purr Data is partially based on JavaScript - and also, my collaborators are mostly comfortable with JavaScript too; so, I'd just like to confirm:

    • is there a way to define/implement a Pure Data object using JavaScript as a scripting language (say, through something like a [pdjs myscript.js] object)? Just to specify, I do not really need to do audio-rate calculations with this, only control-rate calculations of data on inlets ...

    I guess there isn't such a thing/object, as I would have probably found it by now - however, this with Purr Data being somewhat based on JavaScript just keeps staying in the back of my head, so it would be nice to get an explicit "no" if there isn't. :)

    Thanks in advance for any answers!

    posted in technical issues read more
  • sdaau_ml

    Meh, I should have thought of this earlier - the fix is just to use [set $1(, to update the value but not trigger a bang/message on the output:


    posted in technical issues read more
  • sdaau_ml

    Hi all,

    For a while I've wanted to have "synchronized" toggles, so that say I could have two of them, maybe one in top left of the patch window - and the other in the bottom right of the patch window, where I might be doing some work; and in case the window is large, then from the position of bottom right it would be a bit tedious and scroll to top left each time I wanted to click the button. In this kind of situation, I'd expect only one (say, the top left) to have its outlet connected to an actual object - the other would be there just to ease the working process.

    So basically, it would be "either/or" pair - if I toggle one button on, the other turns on too; if I then toggle the other off, the first one turns of too.

    Of course, if you just try to do the most trivial implementation of this:


    ... that is, outlet of one into inlet of other, and vice versa - and then you click either one, - PD will either crash/segfault, or you'll get a "stack overflow" message; since in this case, a recursive update loop happens.

    So is there another method to allow for such "synchronized" buttons, without ending up in a recursive loop, and potentially crashing PD? Also, I could image synchronized number boxes to be useful, too...

    posted in technical issues read more
  • sdaau_ml

    Hi all,

    Let's assume you have an external, with this kind of code in it:

    typedef struct _MyExternal {
      int        var_a;
      int        var_b;
      int        var_c;
      int        var_d;
      t_symbol* obj_name;
    } t_MyExternal;
    void MyExternal_calcandprint(t_MyExternal *x) {
      x->var_d = x->var_a + x->var_b + x->var_c;
      post("The external has obj_name %s with values %d (%d+%d+%d)", x->obj_name->s_name, x->var_d, x->var_a, x->var_b, x->var_c );
    void MyExternal_seta(t_MyExternal *x, t_float f) {
      x->var_a = f;
    void MyExternal_setb(t_MyExternal *x, t_float f) {
      x->var_b = f;
    void MyExternal_setc(t_MyExternal *x, t_float f) {
      x->var_c = f;
      class_addmethod(MyExternal_class, (t_method)MyExternal_seta, gensym("seta"), A_FLOAT, 0);
      class_addmethod(MyExternal_class, (t_method)MyExternal_setb, gensym("setb"), A_FLOAT, 0);
      class_addmethod(MyExternal_class, (t_method)MyExternal_seta, gensym("setc"), A_FLOAT, 0);

    So, let's say I want to set these variables from PD, in a message like this:

    [ ;               <
    [ recvobj seta 3; |
    [ recvobj setb 4; |
    [ recvobj setc 5; <

    So, even if this content is in one message box, all of these message will be received individually, and so

    • first MyExternal_seta will run, calling MyExternal_calcandprint
    • then MyExternal_setb will run, calling MyExternal_calcandprint again
    • then MyExternal_setc will run, calling MyExternal_calcandprint yet again

    The thing is, these messages could come from different message boxes, but all sort of close in time, and this is the case I want to handle - I want each set* function to run individually as they do - but I'd want MyExternal_calcandprint to run only once, once all the variables have been set.

    However it is kind of impossible to predetermine whether only a, or also b and c will be changed in a call. So I imagine, if there existed a function, say, pd_defer_ctrl which I could use like:

    void MyExternal_setc(t_MyExternal *x, t_float f) {
      x->var_c = f;
      pd_defer_ctrl( 5, x->MyExternal_calcandprint );

    it would help me with my problem, if it worked like this - if PD is not in "defer mode", then it enters it, and sets a threshold of 5 ms from now; then it adds MyExternal_calcandprint to a queue. Then when next set* message comes in, PD sees its already in "defer mode", sees it arrived before the threshold of 5 ms has expired - and so it first checks if MyExternal_calcandprint is already in the queue, and if it is, it does not add it again. Finally, once the threshold of 5 ms has expired, PD then runs all the functions in the defer queue.

    Is there something like that I could use in a PD external?

    EDIT: Turns out Max/MSP probably already has such an API function, because I can see in bonk~.c source:

    #ifdef MSP
    static void bonk_write(t_bonk *x, t_symbol *s)
        defer(x, (method)bonk_dowrite, s, 0, NULL);

    .... but I guess there is nothing like that for Pure Data...

    posted in extra~ read more
  • sdaau_ml

    Every once in a while, I come to having to program an external which ends up having some specific variables, which I'd prefer being set "internally" instead of exposing them through outlets, mostly to reduce clutter. And unfortunately, that is usually not easily visible in https://github.com/pure-data/externals-howto ...

    So, I'm not really sure if the below is the "correct" thing - I just managed to patch it together by reading from the PD source.

    You can find the code in:

    The help patch looks like this:


    Basically, this is a copy of [send], which when banged, triggers r AHA and r EHE - even if there aren't corresponding send objects. It turns out, there must be a pd_bind in order for this to work, and for a long time I thought the object argument there is the sender object - but actually it seems to be the receiving object reference. So this objects includes an additional "dummy" receiver class, a copy of [receive], which is there simply to initialize this binding, once this is done, other normal [receive] objects begin reacting on messages too.

    Now I noticed I don't actually have the code for setting [value] variables there, but it is easier - you simply declare a symbol, and then you call PD functions on it:

      t_symbol* s_mysimbol;
      x->s_mysimbol    = gensym("myvar");
      // initialize/instantiate the [value] variables (reading is with value_getfloat)
      // note - via value_get, these will also gain non-null ->s_thing property
      value_setfloat(x->s_mysimbol, 42);

    posted in extra~ read more
  • sdaau_ml

    Hi all,

    Is it possible for a PD external to detect its environment? By this I mean, distinguishing whether it runs on PD standalone on desktop, vs running in say libpd in an embedded environment?


    posted in extra~ read more

Internal error.

Oops! Looks like something went wrong!