"Return to caller" (followup from "symbols explicit")
for now it's just quite abstract and over my head
I made a concrete example -- with scores!
If the programming-ese terminology is too difficult, maybe focus on that example.
I hear that it's impossible to do something "x", or too hard, and I hear about complex programming paradigms, and then it comes down to a simple solution like using [value].
That's a good point. Sometimes it takes effort to find the simplest way.
I don't think extending pd would solve this issue
Yeah, the core of the issue is that Pd's stack works differently from most text languages since Fortran.
Tbh I think variable-target [send] is fine, once it's been established that [send] is going to be involved in pretty much any Pd solution. "Return to caller" as in any structured or object-oriented language is nicer, but [send] is not bad.
what I think @ddw_music refers to as "spray everywhere,"
Here, I'm referring specifically to https://forum.pdpatchrepo.info/topic/15085/return-to-caller-followup-from-symbols-explicit/8 , where the [send] pushes the value out to all matching receivers -- to every potential caller -- where it's swallowed by an [f]'s cold inlet, and only the specific caller pushes the value forward. If you have 50 potential callers, then the data have to be replicated 50 times.
If the data are sub-lists instead of single floats, that would be a lot of multiple allocation. My/jameslo's solution doesn't do that; nor does yours.
to get the equivalent of abstractions calling abstractions would require you to fill your abstractions with [v ]s and [send]s and [receives]s in the vain attempt to cover every possible situation
[list-map] in list-abs shows a nice approach, though, decoupling the iteration logic from the user-operation: the abstraction outputs a trigger to perform the operation, and then the result of that operation is put back into the abstraction to finish the job. That could inspire a super-minimalist approach (which has the benefit of assuming nothing about the returned value's type, whereas most other solutions posted here seem to assume it will always be a single float):

Now, I didn't think of this until the discussion went through a few iterations... see porres's comment about the eventual solution often being much simpler than the problem seems at first.
hjh
PurrData on new Mac M4 Max : ~adc not delivering audio!
....at present L2Ork is loading my Purr Data patches fine, not sure what might be broke or incompatible, hopefully no nasty surprises down the line.
A couple of issues though on the latest MacOS,
-
copy and paste often stops working altogether, and I use copy and paste a lot, so that's a big deal. Have you found this to be an issue also?
-
my MOTU audio interface as the selected audio with 4 channels, sometimes reverts back to internal Mac audio. Then when selecting MOTU again, L2Ork crashes. After numerous attempts it eventually accepts the audio interface, but this has happened several times now.
-
a niggle about the colour selector for background, foreground etc of controls, it's just a colour wheel and numerical input. With Purr Data I'd got used to quickly applying the same preset colours available and also dragging custom colours to a 'bank' of user colours. Now I need to note down numerical values if I want to use the same colour again - not quick or intuitive.
Copy & paste which stops working is the biggest issue though.
canvas / pixel image technique - how can I accomplish
@willblackhurst Last three numbers are bg color, fg color, and label color, I just set them all to black since it didn't really matter in this case, same reason for my lazy math. fg color does nothing in the case of cnv objects but all objects have the same three color values. The file format link will have that info or just set the colors and all options as needed save the patch and open it in a text editor or use my abstraction.
Changing colour of array using color $1 - What are the values?
@Ice-Ice Most likely, as it is a single integer, that it is the "struct color" that can be found by this patch...
colours.zip
I have included tcl colour names
David.

Here is a direct integer to colour chart......... colours-Pd.zip

Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@whale-av said:
You will have to assign a midi control to the colour value in your TouchOSC layout..... for each control.
"Color corresponds to the control color, indexed by the control's MIDI message controller value, note velocity or program number value, ranging from 0 to 8"
I don't know how that would work with a grid.
well, luckily i have some prior art from asking around on the TouchOSC Discord - i got told how to change the colour of a grid object (in this case, a fader from purple to yellow, to differentiate them).

so here's 9 grids that auto-initialize to having the fourth slider (which corresponds to the fourth send in ableton live, which is a specific type of send (+1 octave pitch grain/granulator), set to yellow.
the OSC command for this fourth one is:
function init()
if self.name == "4" then -- only executed in control 4
self.color = Color(1,1,0)
end
end
so in essence, it should be possible to take this and set the color right.
i'm not sure how though but at least there's the functional color changing code.
ok so i tried to change the formatting for yellow from what was specified in the plom.tosc, green = Color(1,93,0), to green = Color(1,1,0), but that did not seem to result in any specific change.
but i am getting these messages of /1/multifader1/3/color and /1/multifader1/4/color type stuffs and one of them receives the string red and the other the string green.

so maybe what's going on is that they're just not receiving the actual right message. if i was maybe sending a string with the required content, maybe that'd be the trick?
Using TouchOSC to draw into a 16 step array? communication back'n'forth? Show Array content in TouchOSC?
@whale-av said:
@esaruoho OSC is horrible in Vanilla..... because message headers are symbols but can include numbers that Pd interprets as floats. It is much easier to use the MrPeach externals.
Anyway...... vanilla....... plom.zip using a multifader object.
The index currently played by metro turns green.....
David.
Low-res screenshot.......
ok, i think i'm ready to try this out. i've been getting back'n'forth type stuff going on with TouchOSC and Ableton Live, so in theory i should be able to get PD stuff back to TouchOSC via OSC.
fingers crossed!
so on TouchOSC "Grid" called multifader1, the scripting contains
function onReceiveOSC(msg)
local colors =
{
red = Color(1.,.16,.11),
green = Color(.46,.8,.15),
blue = Color(.0,.77,.66),
yellow = Color(1.,.93,.0),
purple = Color(.67,.5,.67),
gray = Color(1.,1.,1.),
orange = Color(.98,.63,.11),
brown = Color(.51,.4,.28),
pink = Color(1.,.02,.95)
}
local address = msg[1]
if(address:sub(-6) == '/color') then
local argument = msg[2][1].value
local color = colors[argument]
if(color ~= nil) then
self.color = color
end
end
end
and the multifader1-named-grid sends out 7 different messages

Ofelia GLSL Video Effects
I tried on a Intel Imac, same problems with same shaders.
Now, I tried on a windows 10 machine... same problems again, only same 3 shaders works (like Bokeh)..
For bleach, the error is different from apple:
ofShader: setupShaderFromSource(): GL_FRAGMENT_SHADER shader failed to compile
: ofShader: GL_FRAGMENT_SHADER shader reports:
Fragment shader failed to compile with the following errors:
ERROR: error(#60) Unknown char: ""
ERROR: error(#273) 1 compilation errors. No code generated
: //fragment program
uniform sampler2D Tex0;
uniform float GaussianBlur_Radius;
const float total = (1. + 8. + 28. + 56.) * 2. + 70.;
void main(void)
{
vec2 st = gl_TexCoord[0].st;
vec4 color = vec4(0.0,0.0,0.0,0.0);
color += (1. / total) * texture2D(Tex0, st - GaussianBlur_Radius * vec2(4. / 4., 0.));
color += (8. / total) * texture2D(Tex0, st - GaussianBlur_Radius * vec2(3. / 4., 0.));
color += (28. / total) * texture2D(Tex0, st - GaussianBlur_Radius * vec2(2. / 4., 0.));
color += (56. / total) * texture2D(Tex0, st - GaussianBlur_Radius * vec2(1. / 4., 0.));
color += (70. / total) * texture2D(Tex0, st);
color += (1. / total) * texture2D(Tex0, st + GaussianBlur_Radius * vec2(4. / 4., 0.));
color += (8. / total) * texture2D(Tex0, st + GaussianBlur_Radius * vec2(3. / 4., 0.));
color += (28. / total) * texture2D(Tex0, st + GaussianBlur_Radius * vec2(2. / 4., 0.));
color += (56. / total) * texture2D(Tex0, st + GaussianBlur_Radius * vec2(1. / 4.,ofShader: checkProgramLinkStatus(): program failed to link
ofShader: ofShader: program reports:
Fragment shader(s) were not successfully compiled before glLinkProgram() was called. Link failed.
plot-graph - a way to display waveforms
Here I've uploaded plot graph as an abstraction plus two other abstractions to assist in its usage make-plot and cursor-drive
plot-graph creation: plot-graph unique-name size-x size-y;
Address the settings with messages to in-unique-name (eg [s in-$0-channel-L] or connect a control-rate wire to top left corner;
make-plot creation: make-plot array-name plot-resolution;
eg [make-plot $0-left-channel 200]
make-plot is used to take the audio file size given by soundfiler and divide that by the x resolution of the plot-graph window, read the array in chunks of the min max amplitudes to plot the waveform.
cursor-drive creation: [cursor-drive x resolution] eg [cursor-drive 200] drives the play cursor if active
For best results I found it best to keep the resolution to half the window size, say 200 window 100 resolution
SETTINGS. for plot-graph
size float float (can be set as a creation arg);
min float (y value <= 0 for peaks -1 to 0);
max float (y values>= 0 for peaks 0 to 1);
index float (x value 0 to resolution cur float (x position for cursor 0 to resolution);
cur-vis float (hide/show cursor 0 or 1);
min-vis float (hide/show min plot 0 or 1);
max-vis float (hide/show max plot 0 or 1);
colour float float float float float float;
where:-;
float 1 = back colour (0 to 999 struct colours);
float 2 = border colour (0 to 999 struct colours);
float 3 = plot colour (0 to 999 struct colours);
float 4 = cursor colour (0 to 999 struct colours);
float 5 = plot thickness (1 to 5ish);
float 6 = border thickness (0 to 30ish);
plot-fill float (hide/show fill 0 or 1)
fill-col float float (0 to 999 thickness 0 to 5)
For an animated plot with fill try the following in the plot-graph-help
load audio file
click 100 resolution
click look here for more
scale x using the number-box to 200
toggle off min-vis and cursor-vis
click play (and loop if a small file)
in the more page
toggle scope plot
toggle fill plot
adjust normalise
play with the colours
plot-graph.pd and plot-graph-help.pd are read only to prevent overwriting the defaults, change this if you wish
Have fun
Cheers
Balwyn
plot-graph.zip
The picture is reduced to 70%

Question about muliple arrays in one graph
@dfkettle For the properties window it is the Tcl/Tk Palette..... in [pd_colors] ....
However looking at @ingox's patch the "Data struct" subpatch in [pd_colors] seems to be the one to use with integer values.......
I have included an rgb (text) table in the zip because colours can also be set by name if Tcl/Tk is involved behind the scenes........ and the table gives the rgb values.
colours-Pd.zip
David.
(P.S.) also added [tk_palette] but [sys-gui] is required to send messages to Tk. It opens the palette chooser which gives rgb, hue etc. for any colour available.
A little Pd mod...
@narcell your question prompted me to do some work on it and I managed to put together a theme-picker plugin.
edit: now on github https://github.com/sebshader/color-themes-plugin
(after unzipping place the folder in your pd path, and make sure there are no other color -plugin.tcl files in the pd path)

It lives in the preferences menu
you can save the current (applied) theme to be used the next time pd starts by hitting "save", and if you select a theme from the list and click "Save as Dark Theme" then that theme will open instead if you're in dark mode when you open pd.
In order to stop using a specific theme for dark mode you can click "Delete Dark Theme"
I couldn't figure out a good way to include the text window and help browser colors, so those have to be re-mapped for the changes to be seen. I also had some trouble with the text highlight background color
In order to include more themes, put them in the "themes" folder inside. But only include setting colors in the files or else other things can get messed up when the list gets drawn.
@60hz I included your theme as well as the ones here https://github.com/Eric-Lennartson/pd-themes
edit nov. 4th 2021: fixed small bug & updated colorsgrey





