Page 1 of 1
Random clip player
Posted: Thu Mar 30, 2017 17:45
by newfuturenow
I am trying to figure out a way to use Resolume as a random video player for an installation.
I have got a one button controller that when pressed I want to jump to a random clip on one layer, play it and then for the clip to stop. And when the button is pressed again, to go and do it to another clip etc etc
Do you think theres a way??
Re: Random clip player
Posted: Thu Mar 30, 2017 21:45
by Zoltán
I have got a one button controller
what kind of controller, midi?
Re: Random clip player
Posted: Thu Apr 06, 2017 11:07
by newfuturenow
What I have is an old games console button its hacked to give a mouse click.
I used to use it with a keystroke generator app working in Flash, It is just the random part of the process I can get my head around, is randomly jumping to a different clip with the press of a same button possible in Arena?
Re: Random clip player
Posted: Thu Apr 06, 2017 12:28
by Zoltán
a simple
http://processing.org sketch could send a /layer1/clipN/connect int 1 on mouseClick event, N being a random number you generate at the time of the mouse click.
or if you can place your mouse pointer at a short clip with autoPilot set to Random as described in this thread:
viewtopic.php?f=12&t=14303 you can do it in resolume.
Re: Random clip player
Posted: Thu Apr 06, 2017 13:09
by newfuturenow
Thanks, Processing looks the way to go.
I am trying with my amateurish coding skills, not sure about the N part to make the layer number increment/random.. can you help?
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup() {
size(400,400);
// start oscP5, telling it to listen for incoming messages at port 5001 */
oscP5 = new OscP5(this, 9001);
// set the remote location to be the localhost on port 5001
myRemoteLocation = new NetAddress("127.0.0.1",7001);
}
void draw()
{
}
void mousePressed() {
// create an osc message
OscMessage myMessage = new OscMessage("/layer1/clipN/connect int 1");
//myMessage.add(123); // add an int to the osc message
// myMessage.add(12.34); // add a float to the osc message
// myMessage.add("1"); // add a string to the osc message
// send the message
oscP5.send(myMessage, myRemoteLocation);
}
void oscEvent(OscMessage theOscMessage)
{
// get the first value as an integer
int firstValue = theOscMessage.get(0).intValue();
// print out the message
print("OSC Message Recieved: ");
print(theOscMessage.addrPattern() + " ");
println(firstValue);
}
Re: Random clip player
Posted: Thu Apr 06, 2017 15:22
by AdevProjects
This is what I have been doing:
1. Add a layer router with duration of 0 or something small
2. Assign Midi mapping to it
3. Set its auto pilot to play random clip
When triggered it now triggers a random clip in the same layer.
Re: Random clip player
Posted: Thu Apr 06, 2017 17:49
by Zoltán
if you don't need feedback from resolume then you can empty the oscEvent function.
In this state it will throw a very high number of exceptions for string an float values making your sketch crash, as most of the data coming from resolume is floats.
Code: Select all
void mousePressed() {
//generate random column/clip number
int minColumnNumber=1 ; // the fist clip in a layer;
int maxColumnNumber=20+1; //the last column where you clips are + 1
int randomClip = int(random(minColumnNumber, maxColumnNumber));
//you can do the same for the layers if you want.
int minLayerNumber=1 ; // the fist layer;
int maxLayerNumber=3+1; //the last layer + 1
int randomLayer = int(random(minColumnNumber, maxColumnNumber));
// create an osc message
OscMessage myMessage = new OscMessage("/layer"+randomLayer+"/clip"+randomClip+"/connect");
myMessage.add(1); // add an int to the osc message
// send the message
oscP5.send(myMessage, myRemoteLocation);
}
Re: Random clip player
Posted: Mon Apr 10, 2017 14:23
by newfuturenow
Thanks, removing the feedback makes a lot of sense. I will work it out and see what I can make happen in processing. & thanks to t13swift too, that layer router option is a great workaround.