Go Down

Topic: Arduino & Resolume ? (Read 10542 times) previous topic - next topic

Anazaki

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.

robtillaart

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

check - http://playground.arduino.cc/Code/PIRsense
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Anazaki

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

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

tommyjay

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?

uxomm

#5
Apr 21, 2016, 06:16 pm Last Edit: Apr 21, 2016, 06:17 pm by uxomm
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.
Always decouple electronic circuitry.

tommyjay

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?

RuudJoosten

#7
May 03, 2016, 09:53 pm Last Edit: May 03, 2016, 10:03 pm by RuudJoosten
Everyone still looking for this here is my hopefully complete tutorial  :)

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.

Code: [Select]
// 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  :)

tommyjay

Thanks RuudJoosten,

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

vjetter

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

genghisaloe

Hey there!
Thanks so much for all that's been shared here, particularly RuudJoosten! :D
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? :D
As it stands, here's the output I've been getting from the arduino ide:
https://monosnap.com/file/pNzZCOecvbJxuiKx3no3RUTPPfGTO2

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

genghisaloe

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

genghisaloe

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: 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

}



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

Go Up