Processing OSC NYE Countdown...

FFGL, OSC, GLSL. If you like abbreviations, this is the forum for you
Post Reply
sleepytom
Hasn't felt like this about software in a long time
Posts: 229
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Processing OSC NYE Countdown...

Post by sleepytom » Sun Dec 31, 2017 04:14

I made this to try out sending strings to the text sources.

it works, maybe it is useful for someone to learn from or even use on their new year gigs?

https://www.dropbox.com/s/c61rrceid9vr1 ... n.zip?dl=1

sleepytom
Hasn't felt like this about software in a long time
Posts: 229
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: Processing OSC NYE Countdown...

Post by sleepytom » Sun Dec 31, 2017 21:03

new version with some tweaks to text size and compiled apps for people who don't use processing...

https://drive.google.com/open?id=1iFX-s ... Z5VXe__CFO

For people who do use processing you could just copy this code ;)

Code: Select all

/* 
 This sketch sends a countdown to Resolume 6 via OSC. 
 You need a text souce on layer 1 clip 1. 
 you need the processing libraries oscP5 and netP5 to be correctly installed. 
 
 You might wish to moddify the sketch for your own needs. 
 Happy New Year - Tom Bassford - tom@tombassford.org :)
 */
import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;
String s1;

void setup() {     
  size(400, 400);  
  frameRate(25);
  oscP5 = new OscP5(this, 8000);
  myRemoteLocation = new NetAddress("127.0.0.1", 7000);
  PFont font = createFont("arial", 20);
  textFont(font);
}
void draw() {
    background(0);
fill(200);
  textSize(18);
  text("For Resolume 6", 5, 20);
  text("Put text generator source on layer 1 clip 1", 5, 50);
  text("Turn on OSC listen on port 7000", 5, 80);
  if (year()==2018) {
    s1 = "HAPPY NEW YEAR";  // show happy new year
    sendOSCf("/composition/layers/1/clips/1/video/source/params/size", 0.1); //sets text size so messgae fits onscreen
  } else if (hour()==23 && minute()==59) {
    s1 =  nf(59-second(), 2); // show just seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/params/size", 0.4);//sets text size so numbers are nice and big
  } else if (hour()==23) {
    s1 =  nf(59-minute(), 2)+":"+nf(59-second(), 2); // show mins and seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/params/size", 0.4); // sets text size
  } else {
    s1 = nf(23-hour(), 2)+":" +nf(59-minute(), 2)+":"+nf(59-second(), 2); // show hours mins and seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/params/size", 0.25); // sets text size
  }
  sendOSCs("/composition/layers/1/clips/1/video/source/params/text", s1); // updates text to show time or message
  sendOSCs("/composition/layers/1/clips/1/name", "NYE t- "+s1); // sets clip name in the grid


  println(s1);
  println(year());
}

void sendOSCs(String OSCAdr, String OSCStr) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCStr); /* add a string to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}
void sendOSCi(String OSCAdr, int OSCi) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCi); /* add a int to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}
void sendOSCf(String OSCAdr, float OSCf) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCf); /* add a float to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}

sleepytom
Hasn't felt like this about software in a long time
Posts: 229
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: Processing OSC NYE Countdown...

Post by sleepytom » Thu Dec 06, 2018 18:39

Updated for 2019 because well it's a new year, it's a new dawn, it's a new day and i'm feeling like Resolume changed the OSC addresses...

download 2018/19 version from https://drive.google.com/file/d/1PGZZJb ... sp=sharing

Nerds will see how rubbish my code is below....

Hopefully this helps someone somewhere, if you are trying to learn processing then it might be some use, as an exercise try adding a line of code which will trigger layer 2 clip 1 when it is new year - then you can have it play a cheesy fireworks clip at the same time as displaying the Happy New Year text :)

Code: Select all

/* 
Updated for 2019 :)
 This sketch sends a countdown to Resolume 6 via OSC. 
 You need a text block souce on layer 1 clip 1. 
 you need the processing libraries oscP5 and netP5 to be correctly installed. 
 
 You might wish to moddify the sketch for your own needs. 
 Happy New Year - Tom Bassford - tom@tombassford.org :)
 */
import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress myRemoteLocation;
String s1;

void setup() {     
  size(400, 400);  
  frameRate(25);
  oscP5 = new OscP5(this, 8000);
  myRemoteLocation = new NetAddress("127.0.0.1", 7000);
  PFont font = createFont("arial", 20);
  textFont(font);
}
void draw() {
  background(0);
  fill(200);
  textSize(18);
  text("For Resolume 6", 5, 20);
  text("Put 'Text Block' generator source on layer 1 clip 1", 5, 50);
  text("Turn on OSC listen on port 7000", 5, 80);
  if (year()==2019) {
    s1 = "HAPPY\nNEW\nYEAR!!";  // show happy new year
    sendOSCf("/composition/layers/1/clips/1/video/source/blocktextgenerator/scale", 0.1); //sets text size so messgae fits onscreen
  } else if (hour()==23 && minute()==59) {
    s1 =  nf(59-second(), 2); // show just seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/blocktextgenerator/scale", 0.4);//sets text size so numbers are nice and big
  } else if (hour()==23) {
    s1 =  nf(59-minute(), 2)+":"+nf(59-second(), 2); // show mins and seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/blocktextgenerator/scale", 0.4); // sets text size
  } else if (31-day()>0){
    s1 = nf(31-day(), 2)+" Days \n"+nf(23-hour(), 2)+":" +nf(59-minute(), 2)+":"+nf(59-second(), 2); // show hours mins and seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/blocktextgenerator/scale", 0.25); // sets text size
  } else {
    s1 = nf(23-hour(), 2)+":" +nf(59-minute(), 2)+":"+nf(59-second(), 2); // show hours mins and seconds
    sendOSCf("/composition/layers/1/clips/1/video/source/blocktextgenerator/scale", 0.25); // sets text size
  }
  sendOSCs("/composition/layers/1/clips/1/video/source/blocktextgenerator/text", s1); // updates text to show time or message
  sendOSCs("/composition/layers/1/clips/1/name", "NYE t- "+s1); // sets clip name in the grid


  println(s1);
  println(year());
}

void sendOSCs(String OSCAdr, String OSCStr) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCStr); /* add a string to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}
void sendOSCi(String OSCAdr, int OSCi) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCi); /* add a int to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}
void sendOSCf(String OSCAdr, float OSCf) {
  OscMessage myMessage = new OscMessage(OSCAdr);
  myMessage.add(OSCf); /* add a float to the osc message */
  /* send the message */
  oscP5.send(myMessage, myRemoteLocation);
}
The eagle eyed among you will see there is a small bug with displaying the days countdown during the hour of 11pm, but whatever you can fix it if you like, or don't bother. Who the hell wants a countdown timer on screen before its the 31st anyway?
Last edited by sleepytom on Thu Dec 06, 2018 18:45, edited 1 time in total.

sleepytom
Hasn't felt like this about software in a long time
Posts: 229
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: Processing OSC NYE Countdown...

Post by sleepytom » Thu Dec 06, 2018 18:42

Oh and if anyone actually uses this I'd love to see a video of it in action!

User avatar
cosmowe
Knows Resolume better than the devs
Posts: 1215
Joined: Fri Mar 25, 2011 10:27
Location: cologne // germany

Re: Processing OSC NYE Countdown...

Post by cosmowe » Thu Dec 06, 2018 18:46

How dare nobody said "thank you" before..... :o


Thank you for sharing... and keeping this thread up to "date" :)
w10 || Schenker U506 || lemur || kp3 || pulse || leap motion || spark d'fuser || magewell capture dongle

sleepytom
Hasn't felt like this about software in a long time
Posts: 229
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: Processing OSC NYE Countdown...

Post by sleepytom » Fri Dec 07, 2018 00:53

No worries, and thanks for the thanks ;)

Really I hope this demonstrates how OSC opens up options in Resolume and that this inspires people to create their own solutions to get more out of the application. I've personally found that controlling Resolume from Processing has been a good introduction to writing some code and whilst i'm a long way from calling myself a developer I've learnt a lot about coding whilst getting some pretty instant results that have enabled me to work round workflow issues and limitations that previously would have had me stumped. Big thanks to the Resolume team for providing the OSC interface and especially to Joris for giving me a good deal of help when i was starting out trying to learn how to write code in Processing.

User avatar
He2neg
Is seriously in love with Resolume. Met the parents and everything
Posts: 422
Joined: Fri Nov 22, 2013 21:34
Location: Berlin, Germany

Re: Processing OSC NYE Countdown...

Post by He2neg » Sun Dec 09, 2018 09:22

For all searching for a easy Countdown and dont want to get into anything new (poor ppl =P )

I found this one https://streamtimer.com/

You can build your timer and stream it via url and web or pack it and download it to use it offline. You can get it into Resolume in various ways (NDI Scan / OBS / ect )

Sharing is caring...
Laptop: XMG P507 // Intel i7-5500 / GTX-1060 / 1tb SSD / 32gb RAM // Touch OSC / Lemur/ APC-40
~self employed AV technician / Schu.VT@posteo.de~
~Berlin~

Post Reply