Arduino & Resolume ?

Hello,

After much research without results, I come to you to ask your help.

I am currently finalizing a project but I'm stuck now ... My project is an installation, I would like, when a person enters a room, start a animation from Resolume (Arena).

So I need a presence sensor will I put in front of the entrance door to send the information to my computer. But unfortunately I have no idea of how and which code to use...

Thank you in advance for your help.

PIR sensor should work I guess (just like those movement detectors)

check - Arduino Playground - PIRsense

Thank you for your answer and this code

I have this PIR sensor, but I don't know how to start my video from Resolume.

Thanks

Not sure if you're still looking for an answer as this is quite a late response but I might be able to help you, I have made a MIDI panel with Arduino which is able to communicate with Resolume. Let me know if you still need assistance and I'll get back to you (not at home right now).

RuudJoosten:
Not sure if you're still looking for an answer as this is quite a late response but I might be able to help you, I have made a MIDI panel with Arduino which is able to communicate with Resolume. Let me know if you still need assistance and I'll get back to you (not at home right now).

Hello RuudJoosten,

I am looking to make a similar project where an Arduino would trigger clips in Resolume. Could you advise?

tommyjay:
I am looking to make a similar project where an Arduino would trigger clips in Resolume. Could you advise?

I have done triggering clips in Resolume with Arduino via MIDI.
I have used a standard hardware MIDI to USB device.
But you can also use Hairless, it "converts" serial commands (from the Arduino) to MIDI.

uxomm:
I have done triggering clips in Resolume with Arduino via MIDI.
I have used a standard hardware MIDI to USB device.
But you can also use Hairless, it "converts" serial commands (from the Arduino) to MIDI.

Thank you for that tip. I've looked at the Arduino MIDI tutorial, I'll see if that's an option. If not I can use hairless to reinterpret the data. Would you have any other advice on this subject?

Everyone still looking for this here is my hopefully complete tutorial :slight_smile:

First of all here is my tested piece that uses a single pushbutton and 2 analog potentiometers. Ofcourse you could run the code for those potmeters through a for loop which would make your code a bit neater but for demonstration purposes I've kept them separate here. I've tried to keep the comments as clear as I could.

// include MIDI library
#include <MIDI.h>

byte noteByte;  //Note to send to application
byte velocityByte; //Speed of buttonpress (used in midi buttons capable of measuring force) In regular buttons this is the max MIDI value.


// Set pin number for variable
int pushButton2 = 2;


// Set state of button to unpressed
int buttonState2 = 0;


// This variable prevents a button from being pressed more than once per press (a button might send a signal multiple times when being pressed)
int note2 = 0;


// set analog values to 0
int analogValue_1 = 0;
int analogValue_2 = 0;

// Maximum MIDI value is 127. To notice change, even if first value is 127, the last value is set to 128
int lastanalogValue_1 = 128;
int lastanalogValue_2 = 128;


void setup() {
  MIDI.begin();
  // 115200 Hairless MIDI Serial Bridge baud rate
  Serial.begin(115200);
  pinMode(pushButton2, INPUT);


}

void loop() {
  // Read state of button (is it pressed?)
  int buttonState2 = digitalRead(pushButton2);


  delay(1); //This delay is required to prevent a failure of "MIDI.sendControlChange"

  // Analog potentiometer

  // Potentiometer gives values up to 1023. MIDI signal ranges from 0 to 127, therefor we devide by 8.

  int analogValue_1 = analogRead(A0) / 8;
  int analogValue_2 = analogRead(A1) / 8;


  // Potentiometer could be too sensitive and give different (+-1) values.
  // Check if the last value is more than this minor fluctuation, if so send the signal.
  if ((analogValue_1 - lastanalogValue_1) > 1 || (analogValue_1 - lastanalogValue_1) < -1) {
    // Has the value changed?
    if (analogValue_1 != lastanalogValue_1) {

      // More info: http://arduinomidilib.sourceforge.net/a00001.html
      // Send serial value (ControlNumber 1, ControlValue = analogValue_1, Channel 1)
      MIDI.sendControlChange(1, analogValue_1, 1);

      lastanalogValue_1 = analogValue_1; //Set the current value as the last value
    }
  }

  if ((analogValue_2 - lastanalogValue_2) > 1 || (analogValue_2 - lastanalogValue_2) < -1) {
    // Has the value changed?
    if (analogValue_2 != lastanalogValue_2) {
      MIDI.sendControlChange(2, analogValue_2, 1);
      lastanalogValue_2 = analogValue_2;
    }
  }


  // Button 2

  // When button pressed:
  if (buttonState2 == HIGH) {
    // If note is not playing (first time recieving a button press signal)
    if (note2 == 0) {

      // Play note (note number, velocity, channel)
      // more info: http://arduinomidilib.sourceforge.net/a00001.html
      // MIDI notes chart http://www.phys.unsw.edu.au/jw/notes.html

      // Play note 55 = G3, 127 = trigger note with max volume
      MIDI.sendNoteOn(55, 127, 1);

      // Note is now playing (Set note to 1, so that this function can not reactivate while keeping the button pressed)
      note2 = 1;
    }
    // When the button is released
  } else {
    // If the note is playing
    if (note2 == 1) {
      // Stop playing the note
      MIDI.sendNoteOff(55, 0, 1);
    }
    // Set note back to 0 so you can reactivate it
    note2 = 0;
  }

  delay(1); // Delay to keep everything working smoothly

}

Once you got that working with your analog meters or buttons you need a way to turn this serial signal into a MIDI signal that Resolume can use.

For this you need on Windows 2 applications, for Mac just 1.

Windows:
LoopMIDI

Hairless MIDI Serial Bridge

Mac:
Hairless MIDI Serial Bridge

The Hairless MIDI Serial Bridge website has great instructions on how to set it up with LoopMIDI(for Windows) or without LoopMIDI(for Mac) under "Getting started". Further set-up instructions are under "My MIDI program (Ableton, Logic) doesn’t show up in the dropdown".

Follow those instructions on how to set up both programs.

In Hairless MIDI Serial Bridge check the "Debug MIDI messages" box. If you move your potmeter or press a button you should see a message like "+13.148 - MIDI In: Ch 1: Controller 1 value 127" (this is an example your message might have different values).

Once you've done that:

  • Open both loopMIDI(windows only) & Hairless MIDI Serial Bridge (You must have these open at all times)
  • Open Resolume.
  • In the menu go to "Arena" > "Preferences".
  • On the left select the tab "MIDI".

There you should see "loopMIDI Port"

  • Check the box "Midi Input"
  • Close the "Preferences" window

Now in the menu go to: "Mapping" > "Edit Application MIDI Map"
Once you clicked that everything in Resolume should get a yellow overlay.

Click the field you want to map, it should be marked by white corners.
Once you have that you can move one of your potentiometers or press one of your buttons.

You should see that it is now marked by text like "1/1".
This means it is connected to your potmeter or button.

Now in the menu go to: "Mapping" > "Edit Application MIDI Map" to stop mapping.

Move your potmeter or press a button and watch the magic happen :slight_smile:

Thanks RuudJoosten,

I'm going to do exactly this tomorrow, thank you for the tutorial!!

In general, I am also looking for programs that help create similar Vj Loops https://limeartstore.com/ ? Tell me what I need?

Hey there!
Thanks so much for all that's been shared here, particularly RuudJoosten! :smiley:
I'm avidly trying to replicate the tutorial you'd put together and as I'm following it out I'm having a few problems that are primarily down to not having as much programming experience!
You'd mentioned being able to tidy everything into one for loop, would you be able to post how that looks please?
I'd tried to run what you'd posted above on the arduino but as it was compiling it and sending it over, it presented an error that said that Midi hadn't been declared within that scope. I did a bit of reading then and saw that was to do with when the variable was being declared, so if it was all consolidated into one loop with one declaration of the variable, I figure then the variable being named once would solve it? So I'm as far as understanding what we'd need to change, but I haven't the experience to achieve it, can you help with the last bit? :smiley:
As it stands, here's the output I've been getting from the arduino ide:

Thanks again for all of the time that went into figuring this out and sharing it too!

This is also how I've the hardware set up, so the pots to A0 and A1 then the button to D2 :slight_smile:

Okay so having put more time into this, I've just found that all that was missing from RuudJoosten's sketch above is this line right after '#include <MIDI.h>'
MIDI_CREATE_DEFAULT_INSTANCE();

So this is his work from above with the extra line added in to get past the scope error:

// include MIDI library
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
byte noteByte; //Note to send to application
byte velocityByte; //Speed of buttonpress (used in midi buttons capable of measuring force) In regular buttons this is the max MIDI value.

// Set pin number for variable
int pushButton2 = 2;

// Set state of button to unpressed
int buttonState2 = 0;

// This variable prevents a button from being pressed more than once per press (a button might send a signal multiple times when being pressed)
int note2 = 0;

// set analog values to 0
int analogValue_1 = 0;
int analogValue_2 = 0;

// Maximum MIDI value is 127. To notice change, even if first value is 127, the last value is set to 128
int lastanalogValue_1 = 128;
int lastanalogValue_2 = 128;

void setup() {
MIDI.begin();
// 115200 Hairless MIDI Serial Bridge baud rate
Serial.begin(115200);
pinMode(pushButton2, INPUT);

}

void loop() {
// Read state of button (is it pressed?)
int buttonState2 = digitalRead(pushButton2);

delay(1); //This delay is required to prevent a failure of "MIDI.sendControlChange"

// Analog potentiometer

// Potentiometer gives values up to 1023. MIDI signal ranges from 0 to 127, therefor we devide by 8.

int analogValue_1 = analogRead(A0) / 8;
int analogValue_2 = analogRead(A1) / 8;

// Potentiometer could be too sensitive and give different (+-1) values.
// Check if the last value is more than this minor fluctuation, if so send the signal.
if ((analogValue_1 - lastanalogValue_1) > 1 || (analogValue_1 - lastanalogValue_1) < -1) {
// Has the value changed?
if (analogValue_1 != lastanalogValue_1) {

// More info: Arduino MIDI Library: MIDI_Class Class Reference
// Send serial value (ControlNumber 1, ControlValue = analogValue_1, Channel 1)
MIDI.sendControlChange(1, analogValue_1, 1);

lastanalogValue_1 = analogValue_1; //Set the current value as the last value
}
}

if ((analogValue_2 - lastanalogValue_2) > 1 || (analogValue_2 - lastanalogValue_2) < -1) {
// Has the value changed?
if (analogValue_2 != lastanalogValue_2) {
MIDI.sendControlChange(2, analogValue_2, 1);
lastanalogValue_2 = analogValue_2;
}
}

// Button 2

// When button pressed:
if (buttonState2 == HIGH) {
// If note is not playing (first time recieving a button press signal)
if (note2 == 0) {

// Play note (note number, velocity, channel)
// more info: Arduino MIDI Library: MIDI_Class Class Reference
// MIDI notes chart http://www.phys.unsw.edu.au/jw/notes.html

// Play note 55 = G3, 127 = trigger note with max volume
MIDI.sendNoteOn(55, 127, 1);

// Note is now playing (Set note to 1, so that this function can not reactivate while keeping the button pressed)
note2 = 1;
}
// When the button is released
} else {
// If the note is playing
if (note2 == 1) {
// Stop playing the note
MIDI.sendNoteOff(55, 0, 1);
}
// Set note back to 0 so you can reactivate it
note2 = 0;
}

delay(1); // Delay to keep everything working smoothly

}

Again this was all RuudJoosten's contribution, having added in that last line it was uploading and working perfectly. I'm using his tutorial for the pc set up of things. Thanks again! {^_^} b

RuudJoosten:
Not sure if you're still looking for an answer as this is quite a late response but I might be able to help you, I have made a MIDI panel with Arduino which is able to communicate with Resolume. Let me know if you still need assistance and I'll get back to you (not at home right now).

Hello RuudJoosten,

I know I'm a little late but I am looking for a solution to make a similar project where an Arduino would trigger videos in Resolume with a PIR sensor.

Could you advise ?

Thanks

I'm late to the party too, but here are my 2 cents.

Unless you're absolutely sure you want to use a PIR sensor, avoid it.

My prefered solution for cheaply and easily detecting people entering a room is a laser diode pointed at a photodiode. The photodiode can be mounted inside a 5cm long dark tube to avoid too much light from the room hitting it.

The photodiode value can be read by an analog input on the arduino. When the laser hits the diode, it should saturate and read 1024, but when someone crosses the beam, the value will go under a threshold to be determined experimentally (depends on the ambient ligthing, installation, alignment etc...).

With the detection working, how do you send that to resolume. You can either have a processing proxy sketch running, communicating with the Arduino over the serial port and translating that into MIDI or OSC, or if you use an ATmega32u4 based Arduino (like a Sparkfun Pro Micro), you can get it to works as a MIDI device directly and avoid the processing sketch.

If you want to be really geeky and get the smallest possible solution, vusb on an attiny85 would be fun to implement.

If you're using an ESP8266 or ESP32, I guess you could send OSC commands via WiFi if the latency is not critical.

For the past couple of months I have made few Arduino projects for the purpose of integration various systems with Resolume Arena.
Custom VJ controller's, custom RGB and 12V LED Lights, custom video wall with WS2812 stripe and tested them live on stage few times.

In theory, MIDI and OSC protocols seem to be a good choice for communication, but in practice that has been shown differently...

Arduino projects where hardware mostly need to receive signal or information from the software, the DMX protocol was best choice.
Main goal in such projects is fast communication.

Projects where software receives commands from hardware needs much less communication but goal here is highest possible reliability.
I have managed to get most reliable results sending signals to opensource software MCE Controller which act as tiny server who then
send's keystrokes and other commands to running Arena instance.
Using this method i have minimalise every possible interference with other devices that may be used live on stage which have MIDI as only option for communication.

Thank you for mentioning MCE Controller. Looks quite interesting.

Hello, is anyone using that code? or has tried to? I want to use more potentiometers but I cannot seem to know enough to make it work. Maybe you can help me out, I want to use some more pots. this is my version of the code.

// include MIDI library
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();

// set analog values to 0
int analogValue_1 = 0;
int analogValue_2 = 0;
int analogValue_3 = 0;

// Maximum MIDI value is 127. To notice change, even if first value is 127, the last value is set to 128
int lastanalogValue_1 = 128;
int lastanalogValue_2 = 128;
int lastanalogValue_3 = 129;

void setup() {
MIDI.begin();
// 115200 Hairless MIDI Serial Bridge baud rate
Serial.begin(115200);

}

void loop() {
// Analog potentiometer

// Potentiometer gives values up to 1023. MIDI signal ranges from 0 to 127, therefor we devide by 8.

int analogValue_1 = analogRead(A0) / 8;
int analogValue_2 = analogRead(A1) / 8;
int analogValue_3 = analogRead(A2) / 8;

// Potentiometer could be too sensitive and give different (+-1) values.
// Check if the last value is more than this minor fluctuation, if so send the signal.
if ((analogValue_1 - lastanalogValue_1) > 1 || (analogValue_1 - lastanalogValue_1) < -1) {
// Has the value changed?
if (analogValue_1 != lastanalogValue_1) {

// More info: Arduino MIDI Library: MIDI_Class Class Reference
// Send serial value (ControlNumber 1, ControlValue = analogValue_1, Channel 1)
MIDI.sendControlChange(1, analogValue_1, 1);

lastanalogValue_1 = analogValue_1; //Set the current value as the last value
}
}

if ((analogValue_2 - lastanalogValue_2) > 1 || (analogValue_2 - lastanalogValue_2) < -1) {
if (analogValue_2 != lastanalogValue_2) {
MIDI.sendControlChange(2, analogValue_2, 1);
lastanalogValue_2 = analogValue_2;
}
}

if ((analogValue_3 - lastanalogValue_3) > 1 || (analogValue_3 - lastanalogValue_3) < -1) {
if (analogValue_3 != lastanalogValue_3) {
MIDI.sendControlChange(3, analogValue_3, 1);
lastanalogValue_3 = analogValue_3;
}
}

}