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: 236
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Processing OSC NYE Countdown...

Post 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

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

Re: Processing OSC NYE Countdown...

Post 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);
}

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

Re: Processing OSC NYE Countdown...

Post 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?
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: 236
Joined: Fri Sep 12, 2008 11:11
Location: sussex by the sea

Re: Processing OSC NYE Countdown...

Post by sleepytom »

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: 1597
Joined: Fri Mar 25, 2011 10:27
Location: cologne // germany

Re: Processing OSC NYE Countdown...

Post by cosmowe »

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


Thank you for sharing... and keeping this thread up to "date" :)
Image Do you like outlines? Easy Outliner on Juicebar

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

Re: Processing OSC NYE Countdown...

Post 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.

User avatar
He2neg
Wants to marry Resolume, and Resolume said "yes!"
Posts: 938
Joined: Fri Nov 22, 2013 21:34
Location: Berlin, Germany

Re: Processing OSC NYE Countdown...

Post 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...
Laptop: XMG P507 // Intel i7-5500 / GTX-1060 / 1tb SSD / 32gb RAM // Lemur / BirdDog Studio NDI
~self employed AV technician / Schu.VT|a|posteo.de~
~Berlin~

juicewon
Is taking Resolume on a second date
Posts: 24
Joined: Mon Oct 11, 2010 10:14
Location: Southern California

Re: Processing OSC NYE Countdown...

Post 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:
5950x 3090 FE 128gb DDR4 2tb NVME X3
M1 Max MacBook Pro 64gb 2tb NVME
RazerBlade 16 4080 32gb DDR5 4tb NVME

User avatar
Arvol
Might as well join the team
Posts: 2772
Joined: Thu Jun 18, 2015 17:36
Location: Oklahoma, USA

Re: Processing OSC NYE Countdown...

Post 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

juicewon
Is taking Resolume on a second date
Posts: 24
Joined: Mon Oct 11, 2010 10:14
Location: Southern California

Re: Processing OSC NYE Countdown...

Post 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.
5950x 3090 FE 128gb DDR4 2tb NVME X3
M1 Max MacBook Pro 64gb 2tb NVME
RazerBlade 16 4080 32gb DDR5 4tb NVME

Post Reply