ofelia: deque class
@Cuinjune I tried to create a video frame table ("circular video buffer").
It is possible to read (draw) video from the table but somehow only the current frame is stored at every position of the table.
Here is an example patch. "frames" is the frame table. "N" is the table size. At the left is the texture from the table, at the right the original video. Do you know what I do wrong?
I also tried ofPixels instead of ofTexture with the same result.
And I tried to store several images (jpg´s) instead of video to the frame buffer, which does probably work because each image has its own source.
;
if type(window) ~= "userdata" then;
window = ofWindow();
end;
;
local canvas = pdCanvas(this);
local clock = pdClock(this, "setup");
local videoPlayer = ofVideoPlayer();
local outputList = {};
local frames = {};
local N = 150;
;
function ofelia.bang();
ofWindow.addListener("setup", this);
ofWindow.addListener("update", this);
ofWindow.addListener("draw", this);
ofWindow.addListener("exit", this);
window:setPosition(50, 100);
window:setSize(800 + 40, 600 + 40);
if type(window) ~= "userdata" then;
window = ofWindow();
end;
;
window:create();
if ofWindow.exists then;
clock:delay(0);
end;
end;
;
function ofelia.free();
window:destroy();
ofWindow.removeListener("setup", this);
ofWindow.removeListener("update", this);
ofWindow.removeListener("draw", this);
ofWindow.removeListener("exit", this);
end;
;
function ofelia.setup();
ofSetWindowTitle("Video Player");
ofBackground(0, 0, 0, 255);
end;
;
function ofelia.moviefile(path);
videoPlayer:load(path);
videoPlayer:setLoopState(OF_LOOP_NORMAL);
videoPlayer:setPaused(true);
end;
;
function ofelia.setSpeed(f);
videoPlayer:setSpeed(f / 100);
end;
;
function ofelia.play();
videoPlayer:play();
end;
;
function ofelia.stop();
videoPlayer:setFrame(0);
videoPlayer:setPaused(true);
end;
;
function ofelia.setPaused(f);
if f == 1 then pause = true;
else pause = false;
end;
videoPlayer:setPaused(pause);
end;
;
function ofelia.setFrame(f);
videoPlayer:setFrame(f);
end;
;
function ofelia.setPosition(f);
videoPlayer:setPosition(f);
end;
;
function ofelia.setVolume(f);
videoPlayer:setVolume(f / 100);
end;
;
function ofelia.update();
videoPlayer:update();
if videoPlayer:isFrameNew() then;
table.insert(frames, 1, videoPlayer:getTexture());
if #frames > N then;
table.remove(frames, N + 1);
end;
end;
end;
;
function ofelia.draw();
videoPlayer:draw(420, 20, 400, 600);
if #frames == N then;
frames[ofelia.frame]:draw(20, 20, 400, 600);
end;
outputList[1] = videoPlayer:getPosition();
outputList[2] = videoPlayer:getCurrentFrame();
outputList[3] = videoPlayer:getTotalNumFrames();
return outputList;
end;
;
function ofelia.exit();
videoPlayer:close();
end;
;
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?
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 !
video unable to open/play on windows 7
@zerino What is the file format that you are trying to use? Is it a compressed format?
For a .mov you could try putting these .dlls in the same folder as gem.dll
If you already have files with the same names there then move them somewhere safe first so that you can recover.......
this.zip
Although you might need to install Quicktime too.
If that doesn't work then try this........ https://forum.pdpatchrepo.info/topic/11390/trying-to-run-gem-for-pd-windows-10-64-bit/2
I have the whole of https://puredata.info/downloads/extended-view-toolkit running with Gem 0.94-test3 on Windows 7 64-bit using Vanilla........
If you are only trying to manipulate video (not using gems other gems) there are other solutions....
https://hcgilje.wordpress.com/vpt/
https://www.derivative.ca/088/Downloads/
That can both be controlled by OSC messages, and deal more easily with any audio track that is embedded.
VPT cannot be run at the same time on the same machine as Pd though........
David.
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?
Purr Data Linux-64 and GEM?
@jancsika said:
ls /usr/lib/pd-l2ork/extra/Gem/Gem*
ls /usr/lib/pd-l2ork/extra/Gem/Gem*
/usr/lib/pd-l2ork/extra/Gem/Gem.la
/usr/lib/pd-l2ork/extra/Gem/Gem-meta.pd
/usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux
/usr/lib/pd-l2ork/extra/Gem/GemPrimer.pdf
du -h /usr/lib/pd-l2ork/extra/Gem/Gem*
du -h /usr/lib/pd-l2ork/extra/Gem/Gem*
4.0K /usr/lib/pd-l2ork/extra/Gem/Gem.la
4.0K /usr/lib/pd-l2ork/extra/Gem/Gem-meta.pd
5.6M /usr/lib/pd-l2ork/extra/Gem/Gem.pd_linux
568K /usr/lib/pd-l2ork/extra/Gem/GemPrimer.pdf
PD-Vanilla will not load PD-Externals--Mint Linux
Hello, I am able to load a couple of PD externals. I am using Pd 0.46.7 on Linux Mint 18.2 Cinnamon 64-bit. I am using the find externals command under the help menu. I see the directories in my ~pd-externals folder. But when I try and use objects like [counter] that are supposed to be in these externals I get a can"t create error?
I get this message when I start PD
sys_midiapi 1
input channels = 2, output channels = 2
priority 6 scheduling failed; running at normal priority
tried /home/lulujoe13/pd-externals/zexy.l_ia64 and failed
tried /home/lulujoe13/pd-externals/zexy.pd_linux and failed
tried /home/lulujoe13/pd-externals/zexy/zexy.l_ia64 and failed
tried /home/lulujoe13/pd-externals/zexy/zexy.pd_linux and failed
/home/lulujoe13/pd-externals/zexy: can't load library
tried /home/lulujoe13/pd-externals/cyclone.l_ia64 and failed
tried /home/lulujoe13/pd-externals/cyclone.pd_linux and failed
tried /home/lulujoe13/pd-externals/cyclone/cyclone.l_ia64 and failed
tried /home/lulujoe13/pd-externals/cyclone/cyclone.pd_linux and succeeded
Cyclone 0.3 beta 2; Released: June 19th, 2017
This is a sub library containing the objects:
[!-], [!-~], [!/], [!/~], [!=~], [%~], [+=~], [<=~], [<~], [==~], [>=~] and [>~]
tried /home/lulujoe13/pd-externals/upp.l_ia64 and failed
tried /home/lulujoe13/pd-externals/upp.pd_linux and failed
tried /home/lulujoe13/pd-externals/upp/upp.l_ia64 and failed
tried /home/lulujoe13/pd-externals/upp/upp.pd_linux and failed
/home/lulujoe13/pd-externals/upp: can't load library
tried /home/lulujoe13/pd-externals/Gem.l_ia64 and failed
tried /home/lulujoe13/pd-externals/Gem.pd_linux and failed
tried /home/lulujoe13/pd-externals/Gem/Gem.l_ia64 and failed
tried /home/lulujoe13/pd-externals/Gem/Gem.pd_linux and succeeded
/home/lulujoe13/pd-externals/Gem/Gem.pd_linux: libftgl.so.2: cannot open shared object file: No such file or directory
/home/lulujoe13/pd-externals/Gem: can't load library
deken-plugin.tcl (Pd externals search) in /home/lulujoe13/pd-externals/deken-plugin loaded.
Platform detected: Linux-x86_64-64bit
'deken-plugin.tcl' already loaded, ignoring: '/home/lulujoe13/pd-externals/deken-plugin/deken-plugin.tcl'
Opened Alsa Client 128 in:0 out:2
counter 1
... couldn't create
Can anyone offer suggestions and help? Thanks. JoeF.
Gem for 64-bit OSX
Coincidentally, I've been working on the same thing myself for the past several days. I succeeded in compiling Gem on OSX 10.12 with Pd 0.47.1 (64 bit), using an amalgam of these instructions:
As seb noted, no quicktime film/video support, and I also get the extra dock icon & Pd crashing sometimes when I close my patch.
Having noticed this conversation the other day, I tried compiling Gem against Purr Data 2.3.1 using the same general method, but didn't get far at all. I didn't save the errors, but got a sense that it'd be much more involved than just adjusting paths to Pd-l2ork/Contents/Resources...
I haven't tried to compile the gmerlin plugin, but I have the imageJPEG plugin working, and I've spent many hours trying to get videoVLC working. There are several mailing list discussions which suggest that the problem might be with gem_videoVLC.so (perhaps not pointing to libvlc.5.dylib correctly, either needing editing or symlinking?).
I'm reaching the limits of my meager hacking abilities, but nonetheless it's pretty exciting to have Gem back up & running on 64 bit! I'm happy to join the cause if others are also interested in trying to work out the kinks in enabling the rest of the workaround plugins (gmerlin, videoVLC), and hopefully also find a way to get Gem working on Purr Data.