Pure Data and AI
@atux No problem...... https://forum.pdpatchrepo.info/topic/8699/artificial-intelligence-part-1-pdana
But seriously...
Not yet. IMHO maybe never. It needs training and has had (nearly) none (see below). ChatGPT is probably still the best engine as it has had a massive amount of language training. But 9 months ago, asked to code for Pd, It didn't even "know" what "stereo`" meant regarding a [dac~]....... https://forum.pdpatchrepo.info/topic/14373/chatgpt-to-generate-pd-patch
It would probably conclude that there are better methods than Pd for the re-synthesis, or that you should go and throw a stone into water and record that as it will be better and easier.
AI can be found in Pd as far back as 2013......... AI wizard.zip
I get my fun solving problems myself, so AI doesn't interest me at all. If it ever gets to the point where it is actually intelligent (doubtful) it is likely to logically conclude that I, you, and indeed all humans, are not actually useful. I am not intelligent enough to know what that will mean for us when we have given it decision making powers, but I could guess.......
David.
PD in Python?
Maybe these links help? I have not tested, just have been reading about it:
https://pdpy-org.github.io/doc/install_libpd.html
https://github.com/libpd/libpd
https://forum.pdpatchrepo.info/topic/14087/pd-and-python-py-pyext-external
https://forum.pdpatchrepo.info/topic/11732/commands-for-forum-search-engine
Many times (but not alwys) newer search results are more useful today than >10 years ones. Because many things have changed in the meantime. PDextended still runs but is really outdated and not recommended.
grambilib~ - New ambisonics externals for Pd
thanks for the suggestion! I"ve never compiled anything before, but I gave it a shot...
I'm getting this error in PD after loading the 3 compiled objects (6 files: grambidec.pd_darwin, grambidec.pd_darwin.o, grambiman.pd_darwin, grambiman.pd_darwin.o, grambipan.pd_darwin, grambipan.pd_darwin.o):
load_object: Symbol "grambiman_setup" not found in "/Users/brianlindgren/Documents/Pd/externals/grambiman.pd_darwin"
Also make is generating a bunch of warnings:
++++ info: using Makefile.pdlibbuilder version 0.7.0
++++ info: using Pd API /Applications/Pd-0.54-1.app/Contents/Resources/src/m_pd.h
++++ info: making target all in lib grambidec~
++++ info: making grambidec.pd_darwin.o in lib grambidec~
cc -DPD -I "/Applications/Pd-0.54-1.app/Contents/Resources/src" -DUNIX -DMACOSX -I /sw/include -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -arch arm64 -mmacosx-version-min=10.6 -o grambidec.pd_darwin.o -c grambidec.c
grambidec.c:41:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:43:16: warning: unused variable 'APin2' [-Wunused-variable]
t_sample *APin2 = (t_sample *)(w[3]);
^
grambidec.c:44:16: warning: unused variable 'APin3' [-Wunused-variable]
t_sample *APin3 = (t_sample *)(w[4]);
^
grambidec.c:45:16: warning: unused variable 'APin4' [-Wunused-variable]
t_sample *APin4 = (t_sample *)(w[5]);
^
grambidec.c:69:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:78:23: warning: variable 'sample2' set but not used [-Wunused-but-set-variable]
t_sample sample1, sample2, sample3, sample4;
^
grambidec.c:78:41: warning: variable 'sample4' set but not used [-Wunused-but-set-variable]
t_sample sample1, sample2, sample3, sample4;
^
grambidec.c:102:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:113:41: warning: variable 'sample4' set but not used [-Wunused-but-set-variable]
t_sample sample1, sample2, sample3, sample4;
^
grambidec.c:143:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:185:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:228:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:282:24: warning: unused variable 'x' [-Wunused-variable]
t_grambidec_tilde *x = (t_grambidec_tilde *)(w[1]);
^
grambidec.c:351:37: warning: unused parameter 's' [-Wunused-parameter]
void *grambidec_tilde_new(t_symbol *s, int argc, t_atom *argv) //, t_floatarg test
^
grambidec.c:473:5: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
CLASS_MAINSIGNALIN(grambidec_tilde_class, t_grambidec_tilde, APf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Pd-0.54-1.app/Contents/Resources/src/m_pd.h:529:59: note: expanded from macro 'CLASS_MAINSIGNALIN'
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
^ ~~~~~~~~~
15 warnings generated.
++++ info: linking objects in grambidec.pd_darwin for lib grambidec~
cc -undefined suppress -flat_namespace -bundle -arch arm64 -mmacosx-version-min=10.6 -o grambidec.pd_darwin grambidec.pd_darwin.o -lc
ld: warning: -undefined suppress is deprecated
ld: warning: -undefined suppress is deprecated
++++ info: making grambiman.pd_darwin.o in lib grambidec~
cc -DPD -I "/Applications/Pd-0.54-1.app/Contents/Resources/src" -DUNIX -DMACOSX -I /sw/include -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -arch arm64 -mmacosx-version-min=10.6 -o grambiman.pd_darwin.o -c grambiman.c
grambiman.c:64:24: warning: unused variable 'x' [-Wunused-variable]
t_grambiman_tilde *x = (t_grambiman_tilde *)(w[1]);
^
grambiman.c:139:24: warning: unused variable 'x' [-Wunused-variable]
t_grambiman_tilde *x = (t_grambiman_tilde *)(w[1]);
^
grambiman.c:226:24: warning: unused variable 'x' [-Wunused-variable]
t_grambiman_tilde *x = (t_grambiman_tilde *)(w[1]);
^
grambiman.c:252:32: warning: variable 'sample3' set but not used [-Wunused-but-set-variable]
t_sample sample1, sample2, sample3, sample4, sample10;
^
grambiman.c:306:24: warning: unused variable 'x' [-Wunused-variable]
t_grambiman_tilde *x = (t_grambiman_tilde *)(w[1]);
^
grambiman.c:370:37: warning: unused parameter 's' [-Wunused-parameter]
void *grambiman_tilde_new(t_symbol *s, int argc, t_atom *argv)
^
grambiman.c:436:5: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
CLASS_MAINSIGNALIN(grambiman_tilde_class, t_grambiman_tilde, APf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Pd-0.54-1.app/Contents/Resources/src/m_pd.h:529:59: note: expanded from macro 'CLASS_MAINSIGNALIN'
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
^ ~~~~~~~~~
7 warnings generated.
++++ info: linking objects in grambiman.pd_darwin for lib grambidec~
cc -undefined suppress -flat_namespace -bundle -arch arm64 -mmacosx-version-min=10.6 -o grambiman.pd_darwin grambiman.pd_darwin.o -lc
ld: warning: -undefined suppress is deprecated
ld: warning: -undefined suppress is deprecated
++++ info: making grambipan.pd_darwin.o in lib grambidec~
cc -DPD -I "/Applications/Pd-0.54-1.app/Contents/Resources/src" -DUNIX -DMACOSX -I /sw/include -Wall -Wextra -Wshadow -Winline -Wstrict-aliasing -O3 -ffast-math -funroll-loops -fomit-frame-pointer -arch arm64 -mmacosx-version-min=10.6 -o grambipan.pd_darwin.o -c grambipan.c
grambipan.c:423:5: warning: performing pointer subtraction with a null pointer has undefined behavior [-Wnull-pointer-subtraction]
CLASS_MAINSIGNALIN(grambipan_tilde_class, t_grambipan_tilde, APf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Pd-0.54-1.app/Contents/Resources/src/m_pd.h:529:59: note: expanded from macro 'CLASS_MAINSIGNALIN'
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
^ ~~~~~~~~~
1 warning generated.
++++ info: linking objects in grambipan.pd_darwin for lib grambidec~
cc -undefined suppress -flat_namespace -bundle -arch arm64 -mmacosx-version-min=10.6 -o grambipan.pd_darwin grambipan.pd_darwin.o -lc
ld: warning: -undefined suppress is deprecated
ld: warning: -undefined suppress is deprecated
++++info: target all in lib grambidec~ completed
This is my Makefile:
# Makefile for mylib
lib.name = grambidec~
class.sources = grambidec.c grambiman.c grambipan.c
datafiles = grambilib-help.pd readme.md
include Makefile.pdlibbuilder
Any suggestion? Thanks again!
Conditional expression that doesn't work.
@FredIR Good advice from everybody......
I put this on the forum a while ago..... https://forum.pdpatchrepo.info/topic/13320/welcome-to-the-forum
It is quite essential reading for anyone starting with Pd.
It is certain that your messages are arriving in the wrong order, and as @alexandros says, we can have no idea where the error could be because we cannot know in which order you connected the objects (we can, by reading the text version of the patch, but it would take a while to then rebuild it with triggers so as to make it readable, and our heads would be spinning)....
So $f1 arrived before $f2 or $f3 and by adding a bang to your order of operations after they have arrived you get the correct answer, but you are lucky that the object banging that bang received its data late enough for the solution to work.
David.
instance specific dynamic patching documentation assistance
@Muology You can get more info on dynamic patching here........ https://forum.pdpatchrepo.info/topic/10813/collection-of-pd-internal-messages-dynamic-patching/4 and in that thread.
To replace just one object in an abstraction is complicated.... you have to find it and cut it..... using [find( [findagain( and [cut( messages........ then put your new object...... and then connect it.
To connect it you need to know it's object number (it's place in the order of creation of objects in the patch... starting at 0) .... and the object numbers of the objects you want to connect it to.
That is not really worth the bother.
As @oid says.... it is easier to clear the contents and use a message to replace everything you can do that in any canvas)..... but...
It is easier still to replace the abstraction with another..... but then you still have to reconnect it within your master patch...... so...
Replace the whole abstraction.... and use [send] [send~] etc. rather than [outlet] [outlet~] etc. so that you don't have to reconnect.
You don't need to use [namecanvas].... you can send messages to patches and sub-patches and arrays by their current name. $0 is an automatically assigned value greater than 1000 assigned to every canvas as it is opened (created). You can get its value by.......
[loadbang]
|
[$0]
|
[numberbox]
...... as it could well change when you reopen the patch (if for example you have opened another patch first).
So it can be used but it is better to actually give fixed arguments to your abstractions using $1 $2 etc using a counter as you create them.
My opening post here....... https://forum.pdpatchrepo.info/topic/9774/pure-data-noob contains a dynamic patch builder....... build_voices.pd .... which will help you to see how it can be done...... although I didn't show how to remove the objects you will be able to calculate their object numbers and cut them.
Further down that thread I attempted to thoroughly explain $0 $1 $2 etc...... "show me dollars".
For your particular purpose...... this.zip
A simple example, that you can build on once you learn a bit more.
Happy dynamic patching....
David.
Where does latency come from in Pure Data?
@Pandas As above..... Pd has an input > output delay equal to its block size.
Put something in and it will output 64 samples later.
But the soundcard cannot convert that to analogue instantly... so we add a buffer that gives it time to process the audio before the next block arrives.... MOTU 2-3ms with ASIO... On board soundcard usually 30-80ms.
I see you posted elsewhere on the forum..... https://forum.pdpatchrepo.info/topic/14495/sync-to-external-daw-midi-clock-audio-latency
I don't know those programs and maybe someone else will help.
Sending the audio samples to another program through a port will still not be instantaneous... but should be close unless you are listening to it at the same time.... but even media players will buffer at least 512 samples before they play a stream.
Does QSynth have compensation settings to delay the midi and attempt to match the audio timing?
What is your OS?
As you are communicating with software rather than a DAC you could try reducing the Delay (mSecs) in Pd media settings,,,,,, down to 3, then 2, then 1.. 0 probably not but you never know.... basically until it hangs and then go back to the last setting that worked.
Apply but don't save the settings until you are done.... or Pd might not start or might not let you change them again while it is "stuck" even if you restart it.
There is a fix for that..... I will upload it if that happens..
Running Pd at 96kHz audio rate should I think reduce the 64 sample (Pd internal) block delay.... you could try that too...... I think it should output in half the 48kHz time.
And try this..... it might help....... depends what you are wanting to achieve...... https://forum.pdpatchrepo.info/topic/13125/batch-processing-audio-faster-than-realtime
David.
GUI plugins must-have?
connections in bezier curves
not in Vanilla, as far as I know, only in other flavours as PurrData, L2Ork or PlugData.
One trick for clean patching is to use the patcher more text-like, with many horizontal lines, as you can see from more advanced users here in the forum (lately here f.e. : https://forum.pdpatchrepo.info/topic/14461/can-an-array-be-used-to-arrange-amplitude-changes/2 )
visualize what's going in the chords (which I remember I had in pd-ext)
I never tried, @svanya has made this:
https://forum.pdpatchrepo.info/topic/13046/a-movable-autoconnnecting-vu-meter-esp-for-debugging-code
and something like insert function (insert the block between two objects when dragging), adaptive chords drawing
Not all, but some are available by "intelligent patching"
https://forum.pdpatchrepo.info/topic/13471/shortcut-replacing-wires
edit/production modes
ctrl+e
learn all the shortcuts
@oid recommended this, I haven't tried yet:
https://github.com/RVirmoors/maxhotkey-pd
hard on PD
Arduino -> Pduino problem measuring lapsed time with [realtime]
Great input all of it, thanks!
@whale-av said:
@AndreasA You could probably round your data...... as you are always close to an integer (no 2 3 4 5 6 or 7).....
[expr int (0.5 + $f1) ]
.... maybe a [/ 10] first and a [* 10] after for the data we see....... but of course that is for a particular speed..... so maybe not?
You could also set a window large enough to accept changes as the speed varies, but filter numbers that are out of range (those around 20 in this case... or is it those around 10?) and reject them.
Yeah well didn’t give you enough information there. These numbers I get is at maximum speed of my wheel, or rather the lowest number that pd will output when over a certain speed. So I want it to be able to handle that and all slower speeds as well. The [smooth] is awesome, thanks for the tip!
@jameslo said:
@AndreasA I'm assuming that the numbers you are seeing in the Arduino IDE are timings you captured on the Arduino, not using [realtime], is that correct? If so I think @alexandros is suggesting that you send those timings to Pd, instead of trying to measure the times between Arduino messages on the Pd side.
Actually discovered some problems on the Arduino-side as well so I actually had both arduino and pd limit the output there for a while. But arduino is now definitely taken care of. With @alexandros method I’m closer to what I want but not quite there. Thinking about lowering the bar and deal with it as a limitation later on in the actual synth.
The thing with [realtime] was really interesting read. Good stuff to know!
Though, it would be awesome to have the resolution of serial_print but with firmata and pduino. Pduino is such a great interface for someone not use to coding and I’d like to add more sensors on the same arduino, which right now feels like a big undertaken without pduino and with my lack of knowledge.
Is there a way, do you think? Could I mess with the firmata code to add serial.print()? Obviously wrong forum, but just in case someone has tried.
Round trip latency tests
yes, downloading patches works here.
...uploading... latency-tester.pd
and a version with simple fix: latency-tester2.pd
https://forum.pdpatchrepo.info/topic/13814/catch-would-like-to-set-the-name-programmatically/20
To find new adress of broken links to forum threads:
do an online search with "thread title site:pdpatchrepo.info"
The thread about this:
https://forum.pdpatchrepo.info/topic/11464/any-mirror-of-old-forum-puredata-hurleur-com
can an array object be moved with a metronome, like shift left & then right?
@esaruoho So you don't really want to move it....... you are still looking for a way to have a constant update (while it is actually updating).
Some messages will update the [array] as @oid says..... and there are many......... https://forum.pdpatchrepo.info/topic/10720/change-appearance-of-an-array-by-sending-a-message
But there is only one message that will do so without changing the data or the appearance.....
[;
arrayname rename arrayname(
....... renaming the array with the same name will cause a redraw.
I am a bit loathe to point you in these directions as it will create more fun.....
When an array is updated Pd will send a ping message..... that could be used to update again, but maybe a small delay would be advisable (feedback overflow)..... https://forum.pdpatchrepo.info/topic/11501/get-array-values-when-they-are-updated
For [array define] a copy can be created for display...... could also be done with a [metro]...... https://forum.pdpatchrepo.info/topic/12072/display-an-array-define-array-constantly
But too fast updating will cause dropouts.
David.