-
lacuna posted in technical issues • read more
-
lacuna
[moses], you can use it to filter big jumps. Maybe use feedback to dynamically adapt the right inlet.
moving-windowed-gate.pd
moving-windowed-gate-help.pd
(edit:small bug fix) -
lacuna
@vulturev1 Use the right outlet of [sigmund~] with [>] and [spigot] to filter out "silence".
Look at [moses], you can use it to filter big jumps. Maybe use feedback to dynamically adapt the right inlet.
Also play with sigmunds window-size and hop-size.
This is a Vanilla moving average (EDIT now with [arraysum]) :
movingaverage3.pd
movingaverage3-help.pd
Moving average is a low pass and it also distorts the good data portion.
Reading your description, maybe a median filter with uneven windowsize is better suited, see this screenshot, made with else/median: https://forum.pdpatchrepo.info/topic/13849/how-to-smoothe-out-arrays/11 -
lacuna
Be aware of naming conventions:
A subpatch is this:
[pd sub]
An abstraction is this:
[abstraction]
(calling another .pd file as object)Both, abstraction and subpatch, can have graph-on-parent.
An abstraction may have arguments, such as
[abstraction 1 2 3 hello]
A subpatch can not have arguments.
$0 in a subpatch is same as in it's parent patch.
$0 of an abstraction is unique.For getting $0 of the parent patch inside of an abstraction, you can handle it as agrument, such as
[abstraction $0]
and poll it inside the abstraction with$1
(first argument).Getting $0 of an abstraction outside of the abstraction, at it's parent patch for example, is one of Pd's issues.
One way to solve this is
inside the abstraction:
[loadbang]
|
[f $0]
|
[outlet] -
lacuna
Impressive examples for struct patches:
https://forum.pdpatchrepo.info/topic/10756/vanilla-struct-multislider-with-jump-on-click-and-drag@Balwyn
https://forum.pdpatchrepo.info/topic/14009/hide-array-name/14
https://forum.pdpatchrepo.info/topic/14037/plot-graph-a-way-to-display-waveforms
Here is a workshop on data structures from some years ago (things might have changed in the meantime, but I don't know). Unfortunately the workshop-patches are not online, but you might ask João in the Pd-mailinglist.
https://media.ccc.de/v/lac2018-26-understanding_and_being_creative_with_pure_data_s_data_structures#t=1633
I am interested in how to pipe data from Pd to a fully equipped plotting-software?
https://stackoverflow.com/questions/17543386/pipe-plot-data-to-gnuplot-scripthttps://stackoverflow.com/questions/33457750/gnuplot-plotting-using-piped-input
@katjav https://www.katjaas.nl/plot/plot.html
(all of this is on my undone-list)
-
lacuna
.
or [text get] instead of [array get] or [tabread] instead of list-drip .... -
-
lacuna
okok wasn't sure if my "as being said" sounded arrogant ... allright!
On the question, how to calculate exact: As far as I understand (not): Fixed point arithmetic can be exact but has no headroom.
-
lacuna
@jameslo I'm not a native speaker, no offense intended.
Just was hoping, we would overcome those (non)issues, making courageous decisions or find some better workaround/patch/fix.
Some day, I am going to try the mentioned ones. I am learning, too, thank you all!!! -
lacuna
@jameslo
https://en.wikipedia.org/wiki/Floating-point_arithmetic#Representable_numbers,_conversion_and_rounding"[...] Any rational with a denominator that has a prime factor other than 2 will have an infinite binary expansion. This means that numbers that appear to be short and exact when written in decimal format may need to be approximated when converted to binary floating-point. For example, the decimal number 0.1 is not representable in binary floating-point of any finite precision; the exact binary representation would have a "1100" sequence continuing endlessly:
e = −4; s = 1100110011001100110011001100110011...,
where, as previously, s is the significand and e is the exponent.
When rounded to 24 bits this becomes
e = −4; s = 110011001100110011001101,
which is actually 0.100000001490116119384765625 in decimal. [...]"
And as being said here about SC and Arduino, and on the mailling-list on Max or JSON: Pd is not the only user-friendly (scripting/patching) language/environment that had to deal with this.
Althought backward-compabillity is the most precious thing
and long-term maintaince would become more complicated if PD single and double would differ in such an elementary part, my vote goes for more Pd64 developement, if I had a voice.But for now, it seems like there are several easy experimental improvements, already doable when self-compiling Pd64!?
%.14lg mentioned by @katjav
https://lists.puredata.info/pipermail/pd-list/2012-04/095940.html
or that
http://sourceforge.net/tracker/?func=detail&aid=2952880&group_id=55736&atid=478072Also we could have a look (for %.14lg ) in the code of Katja's Pd-double, and Pd-Spagetties is double, too. (dev stopped, I never tried this)
@jancsika Is Purr-Data double now? https://forum.pdpatchrepo.info/topic/11494/purr-data-double-precision I don't know if or how they care about printing and saving. -
lacuna
yes
12 years ago:
[PD] why does PD round numbers? (in tables, in messageboxes, etc)
https://lists.puredata.info/pipermail/pd-list/2012-04/095892.html -
lacuna
@alexandros said:
[3.14\ <- this is a symbol (Ctl+4) | [f ] | [3.14\ <- this is a number atom (Ctl+3)
Since 0.5? shortcut ctrl+4 has been replaced by the new list-box. Symbol-box has no shortcut anymore, it's still in the 'put-menu'.
-
lacuna
mmmh that's bad news.
@jameslo do you know these threads? Maybe they help:
https://forum.pdpatchrepo.info/topic/13710/how-to-calculate-with-higher-precision/5
https://forum.pdpatchrepo.info/topic/709/symbol-to-float-conversion/17
Also I think @porres Else has more double stuff, but not sure about this? -
-
lacuna
@WEIRD1
Forgot to sum attack and hold-times, resulting in total delay for sustain-stage to start.vline messages are
"go to 1 in A ms, wait for A+H ms then go to 0 in R ms" -
lacuna
@WEIRD1 said:
feel free to suggest
EDIT: better [del 200] to prevent getting stuck in instant invinite loops -
lacuna
@Dannmar said:
In Bela's documentation they refer as the object [rzero~ 1] to detect activity, but how could I turn that into a non-activity detector?
Maybe like this, but not sure, you have to try:
-
lacuna
@Dannmar said:
Now I'm just looking for a way to stop the sample whenever I remove my hand from near the sensor, and if possible with a fade-out to make the stop less abrupt.
Fade-out stop would be:
(and better connect [$1 800( to this [line~] instead of [line] for amplitude changes.)
Maybe you know yourself how to trigger this? With [threshold~] too?
For me it is hard to know because information is missing:
This part I don't understand:and also to trigger this sample as soon as there is something echoing the trigger at a distance inferior of 15cm using a Threshold~ object
but this works already, doesn't it?
In which condition you want the sample to stop?
What kind of sensor?
What is attached to pins 11 and 12?
What data does [adc~ 12] output when moving hand?
Is [print Distance (cm) : ] about correct?
Which Bela tutorial are you referring to?[rzero~ 1] does some integration, I think. [dac~ 11] outputs ultrasonics? [line~] till 1000 and [adc~ 12] going into [samphold~] measures the time untill the reflected ultrasound is detected or sth like that?
Generally speaking, when developing something it is important to understand what is going on instead of blind copy&paste. And when asking, to provide all information you have to make it easy / possible to answer.
-
-
lacuna
@nicnut [expr] outputs ints and floats, not bangs.
Also [expr] is tedious with complicated if-else statements, you have to nest them:
[expr if ($f1==1, 1, if ($f1 ==2, 2, 0) )]
or
[expr if($i1==1, 1, 0;
if ($i1==2, 2, 0) ]
But the object you are describing is [select] or [sel] in short.
Also right click in Vanilla on the blank canvas > help
to see all Vanilla objects
(this is the vocabulary)
and look closer at operators [==] [>] [&&] ect. also [moses]To read some 'previous' data I usually do
[t f b]
X
[f]this first outputs the previous float, then stores the new one in [f].
But if you may want to look further past, and make up more complicated rules, building lists or writing into [text] or [array] will be more flexible.For probabilities, there are [array random] or [random] for example.