Page 1 of 1

Processing OSC NYE Countdown...

Posted: Sun Dec 31, 2017 04:14
by sleepytom
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

Re: Processing OSC NYE Countdown...

Posted: Sun Dec 31, 2017 21:03
by sleepytom
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);
}

Re: Processing OSC NYE Countdown...

Posted: Thu Dec 06, 2018 18:39
by sleepytom
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?

Re: Processing OSC NYE Countdown...

Posted: Thu Dec 06, 2018 18:42
by sleepytom
Oh and if anyone actually uses this I'd love to see a video of it in action!

Re: Processing OSC NYE Countdown...

Posted: Thu Dec 06, 2018 18:46
by cosmowe
How dare nobody said "thank you" before..... :o


Thank you for sharing... and keeping this thread up to "date" :)

Re: Processing OSC NYE Countdown...

Posted: Fri Dec 07, 2018 00:53
by sleepytom
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.

Re: Processing OSC NYE Countdown...

Posted: Sun Dec 09, 2018 09:22
by He2neg
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...

Re: Processing OSC NYE Countdown...

Posted: Fri Dec 23, 2022 11:18
by juicewon
Any chance of an update for 2023?

Maybe I'm missing something but the stand-alone .app for Mac seems like it wants to work at first glance. The clip name is displaying the countdown, but the Text Block wont update past the default 'Resolume'.

Arena 7.13.2

8-) :geek:

Re: Processing OSC NYE Countdown...

Posted: Fri Dec 23, 2022 19:29
by Arvol
juicewon wrote: Fri Dec 23, 2022 11:18 Any chance of an update for 2023?

Maybe I'm missing something but the stand-alone .app for Mac seems like it wants to work at first glance. The clip name is displaying the countdown, but the Text Block wont update past the default 'Resolume'.

Arena 7.13.2

8-) :geek:
There are some NYE countdown timers on juicebar and gumroad

Re: Processing OSC NYE Countdown...

Posted: Mon Dec 26, 2022 05:56
by juicewon
I seem to have figured it out by updating the OSC address for the text string.


Here is an update for anyone that could find it useful.

https://drive.google.com/drive/folders/ ... sp=sharing

Happy Holidays.