interrogate my Gem Installation on arch linux :),
I've downloaded gem via:
git clone https://git.iem.at/pd/Gem.pd
i then put the Gem directory in the bin directory.
After that inside the Gem folder I ran ./autogen.sh
then:
./configure
./make
./make install
I then also ran:
./make
./make install
...in the source file, (to make sure :S)
i then opened pd from the terminal with:
pd -lib Gem
and the pd window says the following
.....so it looks like thats what you need to do to install gem at least on arch linux, however.
objects such as [gemhead] are recognized but they dont generate a help file?
...and unfortunately [gemwin] isnt recognized as an object at all, confusingly.
May someone interrogate my process here to potentially bring some light on these issues?
3 shader adaptions: sonogram / vectorscope and conway
I realized recently that Gem has some very similar (and nice) shader examples, like a game of life, or a multi pass rendering (I learned that this is what I am doing with the effect chain in the video player).
And the timbreID library has some nice Gem patches for visualizing audio.
And Gem has of course a video player.
I ask myself now, because I do not want to reinvent the wheel, what are the advantages and disadvantages if I compare Gem to Ofelia?
I did some experiments with Gem some time ago but at a certain point I got stuck, whether because of my lacking knowledge or because the patch was getting slow.
So it could be possible to do exactly the same with both libraries?
Here I found a very old paper about Gem that states Gem is using openGL up to 1.2.
https://puredata.info/downloads/gem/documentation/manual/pub/zmoelnig2004gem.pdf
Has that changed? Or could that be a difference? I think the openGL versions that Ofelia can use depend only on the hardware.
What I like about ofelia so far is (in comparison to Gem):
To compile the patch as a standalone application.
To make nice interfaces.
(but I think those points are not openGL related...)
That it gives access to lua and open frameworks (which could make it easier to do complex graphics calculations / interfaces?).
Is anyone else in the position to compare those libraries, or has an opinion about them?
Frequency processing issue
@Joseph-Mikkelson That's great.
So I looked in [pd G] and separated out the very left hand part...... see...... [left part]
Then I tidied it up....... [left-part-tidy]
I left in the string / cord that looks like it might be a mistake.
Then I copied all the audio part into another patch called [buffer]
And then I used that to make a new left part........ [left-part-buffer-abstraction]
That "mistake"...? cord I have left out of the last patch.
In that last patch is [buffer 1 0]
The 1 is an argument, and replaces $1 in an object inside [buffer]
For the next (second) part you would use [buffer 2 0] and the delwrite inside would become [delwrite~ buffer-2 1000]......... and then arguments 3, 4, etc. so that the delay names are all different, and the messages receiving the frequency etc. are different for each one too.
That solves the buffer created multiple times problem, that you have solved already I see..
I have added a second argument to [buffer].
When it is 0 [buffer] will use [vline~] and when it is 1 it will use [del]
So actually for the 2nd part of [pd G] you would use [buffer 2 1] so that [del] is used instead of [vline~]
The $1 in the envelope message to [vline~] is receiving a bang when it needs a float...... I don't know what you intended there. The output of [expr] is sending the value for $1, and so banging the message through, and I don't think you need the extra bang at the same time.
A $1 in a message does not take the argument of the abstraction. It takes the first float or symbol sent into the message.
That is the $1 that is complaining in the terminal....... because it has not been sent a value, just a bang.
I hope that helps you to see where any other mistakes might be.
Abstractions are great. If you change [buffer] and save it then every copy will change, so if you want to add some effects into it...... that is very easy.... you only have to do it once.
all_that.zip ..... don't forget to unzip.
David.
new vanilla list sort
@ingox If you are looking for source code for any old extended externals they are all in https://sourceforge.net/projects/pure-data/files/pd-extended/0.43.4/Pd-extended_0.43.4-source.tar.bz2/download
Worth grabbing a copy while it remains available.
All the "makefile"s are included.
Useful for compiling externals for 64-bit (when they work).
I have seen the sort message almost hidden in a subpatch in 12-tut.pd in a tutorial on scalars here...... https://puredata.info/community/projects/convention04/lectures/tk-barknecht/tut.tgz
and it is mentioned (again... sort of.... with no explanation of the message call) as a function in Chapter 2.9.1 here...... http://puredata.info/docs/manuals/pd/x2.htm
and so it is also in Pd's \doc\1.manual\x2.htm
Zexy sort below. But it looks like the canvas sort is in g.graph.c.
There is an "if scalar sort" statement in there.
However g.graph.c has been disappeared from 0.49...... so......?
David.
.... sort.c.... (zexy)
In/*
* sort : sort a list of floats
*
* (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zexy.h"
/* ------------------------- sort ------------------------------- */
/*
SHELL SORT: simple and easy
*/
static t_class *sort_class;
typedef struct _sort
{
t_object x_obj;
int bufsize;
t_float *buffer;
t_int *indices;
int ascending;
t_outlet*indexOut, *sortedOut;
} t_sort;
static void sort_dir(t_sort *x, t_float f)
{
x->ascending = (f < 0.f)?0:1;
}
static void sort_buffer(t_sort *x, int argc, t_atom *argv)
{
int n = argc;
t_float *buf;
t_atom *atombuf = argv;
if (argc != x->bufsize) {
if (x->buffer) freebytes(x->buffer, x->bufsize * sizeof(t_float));
if (x->indices)freebytes(x->indices, x->bufsize * sizeof(t_int));
x->bufsize = argc;
x->buffer = getbytes(x->bufsize * sizeof(t_float));
x->indices = getbytes(x->bufsize * sizeof(t_int));
}
buf = x->buffer;
while (n--){
*buf++ = atom_getfloat(atombuf++);
x->indices[n] = n;
}
}
static void sort_list(t_sort *x, t_symbol *s, int argc, t_atom *argv)
{
int step = argc, n;
t_atom *atombuf = (t_atom *)getbytes(sizeof(t_atom) * argc);
t_float *buf;
t_int *idx;
int i, loops = 1;
sort_buffer(x, argc, argv);
buf = x->buffer;
idx = x->indices;
while (step > 1) {
step = (step % 2)?(step+1)/2:step/2;
i = loops;
loops += 2;
while(i--) { /* there might be some optimization in here */
for (n=0; n<(argc-step); n++) {
if (buf[n] > buf[n+step]) {
t_int i_tmp = idx[n];
t_float f_tmp = buf[n];
buf[n] = buf[n+step];
buf[n+step] = f_tmp;
idx[n] = idx[n+step];
idx[n+step] = i_tmp;
}
}
}
}
if (x->ascending)
for (n = 0; n < argc; n++) SETFLOAT(&atombuf[n], idx[n]);
else
for (n = 0, i=argc-1; n < argc; n++, i--) SETFLOAT(&atombuf[n], idx[i]);
outlet_list(x->indexOut , gensym("list"), n, atombuf);
if (x->ascending)
for (n = 0; n < argc; n++) SETFLOAT(&atombuf[n], buf[n]);
else
for (n = 0, i=argc-1; n < argc; n++, i--) SETFLOAT(&atombuf[n], buf[i]);
outlet_list(x->sortedOut, gensym("list"), n, atombuf);
freebytes(atombuf, argc*sizeof(t_atom));
}
static void *sort_new(t_floatarg f)
{
t_sort *x = (t_sort *)pd_new(sort_class);
x->ascending = (f < 0.f)?0:1;
x->sortedOut=outlet_new(&x->x_obj, gensym("list"));
x->indexOut=outlet_new(&x->x_obj, gensym("list"));
x->bufsize = 0;
x->buffer = NULL;
inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("direction"));
return (x);
}
static void sort_help(t_sort*x)
{
post("\n%c sort\t\t:: sort a list of numbers", HEARTSYMBOL);
}
void sort_setup(void)
{
sort_class = class_new(gensym("sort"), (t_newmethod)sort_new,
0, sizeof(t_sort), 0, A_DEFFLOAT, 0);
class_addlist (sort_class, sort_list);
class_addmethod (sort_class, (t_method)sort_dir, gensym("direction"), A_DEFFLOAT, 0);
class_addmethod(sort_class, (t_method)sort_help, gensym("help"), A_NULL);
zexy_register("sort");
}
`
PD block size vs audio interface buffer size
Generally, the "blocksize" in the audio setting really is the hardware buffer size and not Pd's global blocksize (which is always 64 samples).
Modern ASIO drivers are multiclient which means that the device can be used by more than one app at the same time. When you set the buffer size in your device app (e.g. Focusrite MixControl) this will set the internal blocksize and consequently the minimum latency possible for all clients. Usually you would want to set the internal buffer size as low as possible (without getting audio glitches).
Individiual clients (e.g. a Pd instance) can request a buffer size from the device. This can't be smaller than the above mentioned internal buffer size, but it can be larger (if you need extra latency). Most DAWs control the latency via the buffer size while Pd has it's own buffering mechanism ("delay").
Note that for Pd the hardware buffer size affects the overall timing resolution (when DSP is on). Pd will calculate several blocks of 64 samples as fast as possible until it has enough samples to send to the device. If the hardware buffer size is 256, Pd will calculate 4 blocks in a row (4 * 64 = 256) and then wait until the device asks for another 256 samples. This causes jitter! (Try [bang~] with [realtime] and [print] to see it yourself). The lower the hardware buffer size, the less jitter you get, so generally it's better to keep "blocksize" as low as possible and rather increase "delay" if you need more latency.
BTW, in case of old single client ASIO drivers, "blocksize" would directly set the hardware buffer size of the device. This is still the case e.g. with ASIO4ALL.
source package for gem
It depends if you're on Mac, Windows or Linux.
I'm on MacOS and I use Gem without Pd-extended. I just have to use Pd-Vanilla 32 bits (Pd-0.49-0-i386) and I've downloaded Gem via Help -> Find Externals -> Gem (in the research) and you choose the version from Deken Gem 0.93.3. Install it. Close Pure Data.
To load Gem when you're starting PureData : Open Pure data and go to Pd -> Preferences -> StartUp . In the StartUp Flags you tape Gem, 'Enter' and you juste have to close Pd and re-open and you can use Gem.
With cmd+B, you open the Help Browser and you have a Gem section with all the help you'll need to understand Gem (I've started two months ago).
Have Fun !
delread~ broken under upsampling?
I tried making your patch and it worked if the block size was lower than 256
edit: it's because your write buffer length is less than 256 samples. Increase past 1 ms and it works.
not sure why it would work with block sizes of 64 & 128 but not with 256 though.. and it seems like it should work anyways..
edit2: For those curious (I was) after digging around what happens is that it is possible for the writer to write over its starting point in the buffer before the reader has a chance to read those values if the buffer size < the block size. Because the "real" delay time (that is, the starting read point in the circular buffer) is supposed to be < the write buffer size but is also supposed to be >= the block size, the delay is set to the buffer size so when it reads the buffer it starts at the buffer size and reads the buffer circularly until the block finishes.
In this specific case, because 1 ms is 176 samples, pd rounds the write buffer size up to 240 (for some reason it adds 64 samples). (And snapshot~ takes the last sample in a block)
Trying to run Gem for Pd Windows 10 64 bit
@jeffgrips I have it running with vanilla in Windows7.... but it was hard...... and it's a long story....
I cannot see any reason that it would not work for widows10.
I have not found any other easier better solution.
(((SEE below though for the fact that the -lib needs to be declared...!
That could be your only problem? But I doubt it..!!! )))
I used the 64-bit GEM from here (0.94-test3.zip)..... https://github.com/avilleret/Gem/releases/
I unzipped it and put it in a folder (which I called "dot") on my desktop.
Because I am using many different versions of Pure Data I left it there, and I start Pd with a shortcut that also points to the GEM folder and loads it as a library (It has to be loaded at startup as a library...... and that could be why you don't have it working.... but probably not...).
This is the contents of the line "target" in the shortcut.......
"C:\Users\David\Desktop\Pd Vanilla\pd-0.47-1.msw\pd\bin\pd.exe" -lib C:\Users\David\Desktop\dot\0.94-test3/Gem -font-size 10 -font-face "Consolas"
Be careful with forward / backward slashes.
I am pretty sure that I tipped the contents of the "QT" folder out into the "0.94-test3 folder" where gem.dll is (from within the "QT" folder inside "0.94-test3").
If you find some .dlls are missing then post back with a list, and I can upload them....... but you might not have the correct C++ redistributables from Microsoft.
But if you want to start Pd normally by double-clicking a patch then you will need to declare the library in Pd.. edit....preferences.... startup......
If you have GEM in the extra folder you should only need to put "-lib Gem" where you see that I have put "-noautopatch".......
The gem abstractions could not be found though (the "parts of Gem... .like [pix_image] pix_video] [gemwin] etc. worked fine) I copied the contents of the Gem folder from "extended" into a folder on the desktop called "GemAbstr" and set a path to it in Pd preferences.
I removed gem.dll from that folder (no conflicts....!).
The abstractions now create, but the help files for embedded objects cannot be found (different "search" for embedded objects) so I have to open my "GemAbstr" folder and open them manually.
Everything works. All the patches from https://puredata.info/downloads/extended-view-toolkit create and run correctly. The camera on my computer even works (I had never had it working before).
And it works with Spout.
If you go this route then I wish you good luck.......
@zerino has confirmed that it can work with widows10........ https://forum.pdpatchrepo.info/topic/11450/pix-and-geometric-objects-not-being-loaded-in-pd-vanilla/7
........and resolved the "help" file problem.....
For the time being you are lucky that you are using Windows.
This solution is not available for other systems.
David.
Purr Data Linux-64 and GEM?
Ok, here in Puppy-Linux apt-get is not installed.
Now I installed libftgl2_2.1.3 successfully with the package manager.
Doing the same as before
[Gem] creates! Yes!
In the commandline (linux-console) [shortened]:
pd-l2ork -noprefs -nostdpath -nrt -verbose
Pd-L2Ork version 2.4.6 (20171213-rev.46ffba3)
compiled 22:30:53 Dec 13 2017
port 5401
guidir is /usr/lib/pd-l2ork/bin
"/usr/lib/pd-l2ork/bin"/nw/nw --user-data-dir="/root/.config/purr-data" "/usr/lib/pd-l2ork/bin" 5401 localhost pd-l2ork "/usr/lib/pd-l2ork/bin" xf3c100Waiting for connection request...
[0426/002010.733670:WARNING:chrome_main_delegate.cc(565)] final extension:
... connected
/etc/pd/gem.conf: No such file or directory
/root/.config/pure-data/gem.conf: No such file or directory
./gem.conf: No such file or directory
load plugins 'film' in '/usr/lib/pd-l2ork/extra/Gem/'
pattern : /usr/lib/pd-l2ork/extra/Gem/gem_film*.so
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_filmAVIPLAY.so'!
library loading returned: dlerror 'libaviplay-0.7.so.0: cannot open shared object file: No such file or directory'
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_filmGMERLIN.so'!
library loading returned: dlerror 'libgmerlin_avdec.so.1: cannot open shared object file: No such file or directory'
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_filmMPEG3.so'!
library loading returned: dlerror 'libmpeg3.so.2: cannot open shared object file: No such file or directory'
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_filmQT4L.so'!
library loading returned: dlerror 'libquicktime.so.2: cannot open shared object file: No such file or directory'
[...]
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_imageMAGICK.so'!
library loading returned: dlerror 'libMagick++-6.Q16.so.5: cannot open shared object file: No such file or directory'
[...]
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_imageMAGICK.so'!
library loading returned: dlerror 'libMagick++-6.Q16.so.5: cannot open shared object file: No such file or directory'
[...]
dylib loading file '/usr/lib/pd-l2ork/extra/Gem/gem_recordQT4L.so'!
library loading returned: dlerror 'libquicktime.so.2: cannot open shared object file: No such file or directory'
[...]
There are some more libs missing, maybe I should install them too?
All the examples of Gem seem to work now!
Even the teapod and openGL stuff.
And my final patches, also work. So nice!
Now I will review what those flags actually do:
https://puredata.info/docs/faq/commandline
But I am wondering, if I was lucky, that Gem is programmed for printing messages in the commandline and other non-working libraries probably won't do so?
Thank you so much
Purr Data Linux-64 and GEM?
Welcome to Purr Data
warning: your system's font stack is not optimal
Pd has started the GUI
canvasinfo: v0.1
stable canvasinfo methods: args dir dirty editmode vis
pdinfo: v.0.1
stable pdinfo methods: dir dsp version
classinfo: v.0.1
stable classinfo methods: size
objectinfo: v.0.1
stable objectinfo methods: class
[import] $Revision: 1.2 $
[import] is still in development, the interface could change!
compiled against Pd-l2ork version 2.4.6 (20171213-rev.46ffba3)
input channels = 2, output channels = 2
working directory is /usr/lib/pd-l2ork/extra/Gem
input channels = 2, output channels = 2
audio buffer set to 50
opened input device name hw:0
configuring sound input...
Sample width set to 4 bytes
configuring sound output...
Sample width set to 4 bytes
error: audio I/O dropout
tried but couldn't sync A/D/A
tried /usr/lib/pd-l2ork/extra/Gem/Gem.l_ia64 and failed
tried /usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux and succeeded
verbose( 1):/usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux: libftgl.so.2: cannot open shared object file: No such file or directory
tried /usr/lib/pd-l2ork/extra/Gem/Gem.pd and failed
tried /usr/lib/pd-l2ork/extra/Gem/Gem.pat and failed
tried /usr/lib/pd-l2ork/extra/Gem/Gem/Gem.pd and failed
Gem
... couldn't create
libftgl is missing?