Hello all, hopefully some of you can help with this issue. I've written an application in processing that once a minute checks the current system time and compares this to a number of video files in a folder. If the time matches a video filename (eg 12-15.mov), that video gets played. When the video is finished, it switches back to checking the time again and waits for a new movie to be played.
The problem I'm having is to do with support for the video library for slightly older machines - I can't delete instances of the old video files when a new one is loaded with the regular Video library. I've been using the FasterMovie class (
http://www.processing.org/discourse/beta/num_1175633922.html) and have tried some QTJava methods such as disposeQTObject() in the FasterMovie class stop() method, but it only seems to free up 50% of the memory used up by the Movie object. Over time all this 'unused' memory adds up, and will probably crash the computer. Is there a solution I'm missing here?
I'm stuck with using either a 32-bit mac mini running osx 10.5.8, or a 64-bit macbook running 10.4.11. Ideally I would use Andres' excellent GSVideo library included in the alpha Processing 2 releases, but as far as I know that requires jre 1.6 which is unavailable for the two computers I have available to me.
24th Aug 2011 - TumblrP5 class now supports image data uploads, along with all other posts except video and audio data uploads. Available for download from
http://openprocessing.org/visuals/?visualID=34381
Hope it's useful to somebody :)
Hacked together this class today, hope it's of use to somebody. It's probably a little messy so if anybody has any suggestions how to tidy it up, or if they want examples, want to report bugs, or ask a question, fire away! I was initially trying (and failing) to figure out how to post image data from processing to tumblr, which would probably be the most interesting thing if I could include it in this class. If anybody could suggest how to accomplish this, I would be very grateful!
At the moment it supports writing every type of post to tumblr, except data uploads.
Photos/Videos/Audio can be posted from an online URL source
Uses the API v1, so no Oauth required - just a username and a password
Has anybody tried this out before? I've built a datavis programme in processing that will update itself every 10 or 15 minutes, and I', going to try to post an image of the visualisation from processing to tumblr so I have an easy interface to see how the graph has changed over time (and also make it available to a wider public). I don't know how often the Tumblr API can be called, but I don't plan on updating much more than about 6 times an hour. Any possible issues I should watch out for?
[Sorry if the post should be in somewhere more specific mods :) ]
I've been trying to port some of my QT Video library sketches to work on a linux system (Mint 11) with the GSVideo library, but I keep getting an error that I don't see reported elsewhere on the forum: "Unable to load library 'glib-2.0': libglib-2.0.so" I made sure that I have the latest versions of gstreamer and all the good/bad/ugly plugins, but it still doesn't work. Is there another dependency I'm missing? And how/where should it be installed?
Thanks in advance - here's the full debugger error message:
GSVideo version: 0.9
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Unable to load library 'glib-2.0': libglib-2.0.so: cannot open shared object file: No such file or directory
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236)
at com.sun.jna.Library$Handler.<init>(Library.java:140)
at com.sun.jna.Native.loadLibrary(Native.java:379)
at org.gstreamer.lowlevel.GNative.loadNativeLibrary(GNative.java:48)
at org.gstreamer.lowlevel.GNative.loadLibrary(GNative.java:45)
at org.gstreamer.lowlevel.GlibAPI.<clinit>(GlibAPI.java:36)
at org.gstreamer.lowlevel.GMainContext.<init>(GMainContext.java:30)
at org.gstreamer.Gst.init(Gst.java:291)
at codeanticode.gsvideo.GSVideo.initImpl(Unknown Source)
at codeanticode.gsvideo.GSVideo.init(Unknown Source)
at codeanticode.gsvideo.GSCapture.initGStreamer(Unknown Source)
at codeanticode.gsvideo.GSCapture.initPlatform(Unknown Source)
at codeanticode.gsvideo.GSCapture.<init>(Unknown Source)
at ColorSorting.setup(ColorSorting.java:51)
at processing.core.PApplet.handleDraw(Unknown Source)
Hello folks, just sharing a small datavis project I worked on recently - it compares the percentage of each countries population that have internet access with the percentage of the population that use Facebook.
Each "node" represents a country - the blue ellipse being relative to the number of the country's population with net access, the white relative to the number that use facebook. Rolling over a node with the mouse brings up the statistics for that country, and you can quickly find a country with the menu on the right. Pressing 'c' displays all the country titles over their respective nodes, and 'r' generates a new configuration [ pointless but fun :) ].
Hello! I put together a sketch that converts images (still or a video feed) into the NES palette, and it seems to work quite well if a little slow. I was just wondering if any of you know of any tricks of speeding up my code so it runs more efficiently? Obviously there's a lot of calculations going on currently: I'm sampling the colour of every
nth pixel and drawing the closest colour from the NES palette to a rect(). Obviously the less frequently I sample, the faster the sketch runs - but that in turn means the rect() are drawn larger and thus the appearance of a much lower resolution. Also - I might be missing an error/doing something idiotic without realising but in my sketch but the frameRate seems to decrease gradually the longer the sketch runs. Any ideas?
I'm working on a musical interface with pure data and processing, but have come across a problem. Basically I want the user to be able to add a new Satellite that travels in a circle at a specified radius and at a random speed. If the user adds more than one Satellite object to a given radius, then when the two collide I want to send an osc value to pure data - triggering a sound. I've been approaching it a bit like a particle system so far - having my Satellite class, then having a Satellite System class to manage the adding/subtracting of objects from the arraylist, and a draw method to run the sketch. My problem lies with detecting if the satellites have collided though - I'm using two for loops to compare the x and y values between the satellites, but when a collision is detected, it sends the osc value 11 times! I'm sure that it is because of the for loops, but what is the best way around this problem? If anybody has any ideas I would be very thankful!
Hope I'm making sense - I haven't included all the code as there is quite a bit of it already. The problem bit is included below:
//testing for collisions
void collide(ArrayList sats){
for(int i=0; i<sats.size();i++){
Satellite sat1 = (Satellite)sats.get(i);
for(int j=i+1;j<sats.size();j++){
if(j!=i){
Satellite sat2 = (Satellite)sats.get(j);
//calculating distance
float dx = sat1.loc.x - sat2.loc.x;
float dy = sat1.loc.y - sat2.loc.y;
float distance = (sqrt(dx*dx+dy*dy));
//set the minimum distance
float minDist = sat1.sz/2+sz/2;
//if there is a collision: fill the ellipse; send osc value; print collision!
if(distance<minDist){
fill(c);
ellipse(sat1.loc.x, sat1.loc.y, sz, sz);
sendOSC(radius, freq);
println("collision!");
}
//if the ellipses are close together, draw a line connecting them
I've been doing a bit of research into this lately as I am working on some visuals for a composition that I would like to burn to dvd for an exhibition (unfortunately there won't be a computer supplied so I can't process the visuals in realtime), and it seems that there is no particularly easy way of doing this without a serious amount of dropped frames.
I looked at
this thread on the old forum, and from what I can gather the easiest way to do this is to make a sketch that writes the waveform values into a text file, then in another sketch read the values one frame at a time to generate the visuals. That thread is reasonably old, so I was wondering if anyone had figured out a less convoluted way of achieving this since then? I know it's a regular enough question, maybe if there is a good solution we can put it on the wiki?
I've been doing a bit of experimenting with applying some simple forces to particle systems and arraylists. I made this sketch:
http://wwww.openprocessing.org/visuals/?visualID=13048 but it becomes quite slow a bit too quick for my liking. I have a feeling the problem lies in the attached bit of code below - is there a faster way to compare the coordinates of a single particle against all the others, that is also not a complete pain to implement?
Was messing around with Mike Davis' Conway code, and decided to see how it works in 3d with cubes. Often it initially produces some interesting patterns, but then gets pretty chaotic. Here's the code anyway, it requires the PeasyCam library but if you comment those few lines out it will still run fine.
If anyone has any more suggestions on how to get better results and/or spot any mistakes do let me know!
/*
Game of Life (in 3d!)
Based on Mike Davis' Conway sketch.
Press a key to regenerate, control cam with mouse.
I've been messing around with a simple enough sketch that creates a 2d array of tetrahedrons, and I want one to rotate around their own centerpoint if the mouse rolls over it - so as a mouse travels across the screen it will cause any tetrahedrons in the cursors path to begin spinning. All is working fine enough so far, apart from the old translation/rotation conflict. The first tetrahedron in the array (ie the one at x=0, y=0) rotates on it's own axis, but the further down the array you get the rotation is on a wider arc. Is there a simple way to fix this issue?
Here's my code. Feel free to make any other suggestions where necessary!
import processing.opengl.*;
int num = 18;
int edgeLength = 15;
Tetrahedron tetrahedrons[][] = new Tetrahedron[num][num];
void setup(){
size(800, 800, OPENGL);
smooth();
for(int i=0; i<num; i++){
for(int j=0; j<num; j++){
tetrahedrons[i][j] = new Tetrahedron(i*50, j*50, 0, edgeLength);
}
}
}
void draw(){
background(0);
noFill();
for(int i=0; i<num; i++){
for(int j=0; j<num; j++){
pushMatrix();
tetrahedrons[i][j].render();
popMatrix();
}
}
}
class Tetrahedron{
int x, y, z;
int edgeLength;
float theta;
boolean selected=false;
Tetrahedron(int ix, int iy, int iz, int iedgeLength){
So has anyone else tried it recently? I'm going to try to convert a processing sketch to run on it, but wasn't sure if I'll be running into any major bugs/issues/nightmares on the way.
Strictly speaking this is an arduino based project, but I used processing to handle the incoming data and create the visuals. I built a small device consisting of an ultrasonic distance sensor attached to a rotating assembly - which when switched on would scan a room and produce a 2-dimensional map of the space the device is placed in. The distance data was sent to processing in order to generate a kind of graphic score, and also via OSC to pure data which would then synthesize responsive audio in realtime.
There were a few things I could do with improving the work, so let's hope for a 3.0! Initially I had a bit of trouble as the motor would not exactly correspond to the visuals after running for an hour or so. I was thinking about a foolproof way of keeping the visuals in sync with the rotation of the motor, so perhaps a hall-effect sensor (detects a magnet) that would count the time of one full rotation of the sensor - thus setting the graphic score's rotation speed.
I'm trying to build an osc controller that will communicate with puredata based on the collisions of a number of objects (Planets) following a circular path, but each set at a different speed. I have this working correctly, happy with the results etc. But now I want to make it interactive - ie with the mousePressed() I want to add a new planet, with a new speed at a specified radius etc, and with a maximum of say 10 planets - after that, or with a keypress, the first one in the list can be removed. It seems to me that an arraylist is ideal for this - but I don't know how I should go about changing my current code to suit this. Should I put the arraylist inside the Planet class, or should I create a kind of particle system? I've tried a few different ways but I'm stumped. (It's also very hot here at the moment and my Irish brain isn't used to it :P )
My code is attached, and it works in a basic form. It creates an array of 5 objects that revolve around the center of the canvas, and sends an osc message if the pass over one another. Also, if I'm doing anything else silly, please let me know :)
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress netAd;
int num = 5;
Planet[] planets = new Planet[num];
void setup(){
size(500, 500);
oscP5 = new OscP5(this, 12000);
netAd = new NetAddress("127.0.0.1", 12000);
for(int i=0; i<num; i++){
planets[i] = new Planet(width/2, height/2, random(0.1, 0.300), 100, int(random(50, 80)), i, planets);
}
}
void draw(){
background(0);
for(int i=0; i<num; i++){
planets[i].run();
}
}
class Planet{
float xpos, ypos, x, y;
float speed;
int radius;
int sz = 10;
int id;
int freq;
Planet[] others;
Planet(float _xpos, float _ypos, float _speed, int r, int _freq, int _id, Planet[] _others){
Hello!
I've written a sketch that generates music based on the fibonacci sequence - and I'm using the Ess library for sound synthesis. It works fine for long periods of time when I run it straight from processing, but when I uploaded it to openprocessing there's a bug - after about a minute the applet crashes and stops advancing to the next step. Has anyone got any ideas as to why there might be a problem? I've tried it in the latest versions of safari and firefox for mac os 10.4. Maybe there's too much going on in the sketch?