-
sdaau_ml
Awesome, many thanks @jancsika :
In the meantime, you should be able to choose "Help" -> "Open DevTools",
Nice, Chome developer console -- was looking for that as soon as I read Chromium, but could not otherwise find it
Btw, it is called "Help" -> "Show DevTools" in my PurrData 2.15.2
Oops, I forgot about the CSS styling and fonts. Let me investigate.
Yup, just tried it myself, fonts on [cnv] canvas seem fine, but not on regular objects; also some extension objects, and also abstractions, are rendered fully black. Also connector lines are missing.
Thanks for looking into this!
-
sdaau_ml
I'm aware this is an old thread, also for Linux, but just wanted to remark on this:
the -font-size command line startup flag does absolutely nothing on any system I've tried it on. Doesn't matter what size I set it to high or low it still loads the same default size.
I kind of noticed something similar, Purr Data 2.15.2 on Windows 10. I tried calling it with
pd.exe -font-face 50 -font-face "Consolas"
... and indeed, whatever old patch I opened, still had the old font size .... However, if I did Ctrl-N for a new patch, then Ctrl-1 to place an object, then start typing - then that font is indeed large ... So, it is possible that font size gets saved with the object in a .pd file.
However, my problem now is, that the
-font-face
never gets honored (font face remains the same, no matter what I use for-font-face
).... -
sdaau_ml
I am aware that there exists https://github.com/iem-projects/patch2svg-plugin :
This adds a new menu-item to the "File" menu: "Save patch as SVG..."
It allows you to save the current Pd patch as an SVG graphics.
... which is exactly what I need - but for Purr Data. Since
patch2svg
is a TCL script for vanilla PD, and (https://agraef.github.io/purr-data-intro/Purr-Data-Intro.html mentions:Purr Data is Pd-l2ork with the Tcl/Tk GUI part ripped out and replaced with modern web technology. To these ends, it uses an open-source framework called nw.js a.k.a. “node-webkit”, which is essentially a stand-alone web browser engine (Chromium) combined with a JavaScript runtime (Node.js).
... it seems, I can't really use
patch2svg
for Purr Data.Then again, Purr Data should already be drawing everything in SVG, it seems, - so it seems there should be a way for it to save the patch canvas as SVG natively; but I cannot see an obvious way to do it ...
I can print to PDF from Purr Data, and then convert that to SVG using inkscape - but in that case all texts become "curves"/"paths", and are not editable as texts ...
So, I was wondering - is there a way to export a patch in Purr Data as an SVG vector image (and preferably, with text information present)?
-
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?
Thanks!
-
sdaau_ml
Hi @lacuna,
it's a Deken-package.
Deken is build-in PD-vanilla: search & install packages easilyThanks 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:
-
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 MSYS2bash
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 aboutdeclare -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!
-
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 ... -
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):
py
/pyext
( http://puredata.info/Members/thomas/py/ ) - allows using the Python language to define/implement a Pure Data objectpdlua
- ( https://github.com/agraef/pd-lua ) allows using the Lua language to define/implement a Pure Data objectpdj
( http://puredata.info/downloads/pdj ) - "PDJ enables you to write java code to interact with pure-data objects"
I have tried these in latest Purr Data on Windows -
pdlua
is still there; however, no trace ofpyext
/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!
-
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: -
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...
-
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; MyExternal_calcandprint(x); } void MyExternal_setb(t_MyExternal *x, t_float f) { x->var_b = f; MyExternal_calcandprint(x); } void MyExternal_setc(t_MyExternal *x, t_float f) { x->var_c = f; MyExternal_calcandprint(x); } ... 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, callingMyExternal_calcandprint
- then
MyExternal_setb
will run, callingMyExternal_calcandprint
again - then
MyExternal_setc
will run, callingMyExternal_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...
- first
-
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, triggersr AHA
andr EHE
- even if there aren't corresponding send objects. It turns out, there must be apd_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_get(x->s_mysimbol); ... value_setfloat(x->s_mysimbol, 42); ... value_release(x->s_mysimbol);
-
sdaau_ml
OK, I got the counting part solved - test.pd :
Simply another counter has to be added, it will count incoming messages on the cold inlet, and receive a slow "bang" on the hot one - and at the same time, this "bang" can reset this another counter...
However, it will still be nice to know if there is a way to collect (and output) actual messages..
-
sdaau_ml
HI all,
Consider the following patch, test.pd :
Basically, when the [metro] is started, I'm having a message printed every 100 ms - this is as expected.
However, this is what I'd like to do: put some sort of a "bucket" object at the output of the
[hello $1 world $1(
message box, and then have that "bucket" output connected to[print]
. So, the incoming messages at 100 ms would be "collected"/"collated" by the "bucket" object, and nothing would be printed by[print]
- and then when I "bang" the "bucket" object, either:- All messages received so fat would be output on the "bucket" object outlet, causing them to be printed
- I would get a message such as "10 messages received" or similar, depending on how many messages arrived in the previous period
As soon as the "bucket" object is "bang"ed in this way, it is "emptied", and a new period of collection can start again.
Is there an object that does this in PD vanilla - or is there a combo of vanilla objects I could use to achieve this?
-
sdaau_ml
Awesome - many thanks for the help, @whale-av - I like both approaches, but I think I'd prefer the canvas properties.
EDIT: if going through canvas properties, you must have "Graph on Parent" enabled, otherwise the size is not settable (and is ignored); but that is not really a problem, the default rendering is the same; also the default height for object boxes seems to be 18 pixels in PD vanilla...
Btw, the limit that you noticed - I'm pretty sure there is a similar kind of limit of text character width in a comment box, so I guess it makes sense it is also applied to object boxes (at least 'pd' subpatch ones).
Many thanks again!
-
sdaau_ml
Hi all, am on Ubuntu 18.04, using the PD vanilla that comes with it (puredata:all/bionic 0.48.1-3).
This is the test I tried doing: I make a new patch (test.pd), inside I make a subpatch [pd blah], and inside blah, I put several [outlet]s:
Clearly, the outlets on the subpatch are so tight close to each other, that it makes sense that I would "stretch" the width of the [pd blah] object:
Great, it stretches, the outlets are now individually visible... So I save the test.pd, close it, reopen it again... and [pd blah] is again just as tight as on the first image?!
Does anyone know, if there is some sort of a trick, so I can save the "widened" [pd blah] object in my test.pd patch?!
-
sdaau_ml
Thanks again for the discussion, all:
Hi @sdaau_ml I was intrigued by how this might be done in Windows (you didn't say which OS).
I'm on Ubuntu 18 / Linux, so [shell] would have been great, but not for patches that would run in vanilla...
Thanks again!
-
sdaau_ml
Many thanks @60htz and @whale-av - for letting me know exactly what I needed to know
-
sdaau_ml
Hi all,
I would want the following: Whenever I press Ctrl-S to save a patch in Puredata, I'd want the timestamp of that action to be written in a message box; then, I could do a:
[loadbang] | [Fri Nov 9 11:39:07 CET 2018( | [print]
... and have the timestamp of the last save, be output whenever I start a patch.
So, is there a way to detect a save within Puredata?