Hey guys!
I've spent the last two months working on a project that's for an educational exhibition in a college.
{see attached image 'overall idea'}
What we're trying to achieve is to have a multimedia 'book', that can tell when the page has turned, then play the next series of videos based on which page is revealed. The way I'm going about this is to have a series of light dependant analogue resistors, hidden under tabs on the pages, so when a page is turned, the sensor is revealed then causes a midi note to be generated, (which Resolume has been mapped to) and the change occurs.
It's all gone from strength to strength as I've worked on it and I've gotten to the point where I've had everything work exactly as I've wanted it to, then it's apparently all randomly failing, and quite spectacularly at that!
I'll bring you along through the stages of things now:
At first I had used and Arduino Uno, alongside LoopMidi and the Hairless-Midi tools for the proof of concept and it all was fine:
{see attached image 'uno proof of concept.jpg'}
That was all perfect, as I was able to map Resolume correctly and it would 'hear' the command properly.
The next phase was to move things up to the Arduino Due, as we wanted to be able to have more permutations of pages of the book {jumping from 3 sensors in the first test up to 6}. At this point in the work, everything functioned perfectly again, so I had 4 slices {top left, bottom left, top right, bottom right} each with a layer mapped to it, then one midi note to cover changing the 4 slices as each page turned.
overall idea.jpg
At this point, as everything was cool with the hardware and code, the focus went to the presentation of the plinth, and how the sensors could be concealed:
{see images:
early stage plinth.jpg
plinth in progress.jpg}
Here you can see a still of the mapping having worked successfully:
{see image: this is when it worked briefly and took the mapping correctly.jpg}
(using baud rates of 115200 in both the arduino code and in Hairless)
This is right around when tragedy struck, the due gets dropped from a table and everything went haywire from there. I replaced the Due with a Mega {changing resistor values and port numbering because of the difference in the Due being 3.3v and the Mega being 5v}
So the way the arduino code works is like this, loopmidi has made the virtual midi port, hairless midi is attached to that same port, then finally resolume is set to see that virtual port too. When the arduino code starts, it checks to see if the sensors give an answer that's above a certain threshold, if the answer is yes, then +1 gets added to 'newnote'. Later in the code (when I'm constructing the midi packet), I tell it to send out a note based on that 'newnote' variable.
The logic of this is such that when a person reveals a sensor by turning a page, I want it only to send the note once so as not to spam the change, so at the end of my loop I declare 'newnote' to equal 'oldnote'
If 'oldnote' is the same as 'newnote' it does nothing, if 'newnote' varies from 'oldnote' then it plays the next note.
Figuring that bit out was the game changer that meant everything would work as we'd hoped.
So I have 9 sensors, then I also have an array of the notes that can be played {55 - 64}
So when 'newnote' is set to call one of the notes from the array it looks like this:
MIDImessage(noteON, notePlayed[newNote], velocity);
delay(300);
MIDImessage(noteOFF, notePlayed[newNote], velocity);
All of this what I've described works perfectly when it's just the arduino, loopmidi and hairless, the first time you reveal any sensors, the arduino counts them and then if the note wasn't just played a second ago then it plays it, if it's not changed it does nothing.
Now for some unknown reason Resolume will ignore the part of the code that tells the note not to repeat, so then it'll spam the same note until Resolume crashes.
I'm using windows 7 and have tried to set everything up in Arena 4.1.8 & 5.1.4. Everything's been edited with Media Encoder to the dxv standard through the adobe suite, I've tried 38400 baud and 115200. I've tried opening hairless before and after resolume is open. Even holding the arduino's reset button so that I'm certain resolume 'hears' the status byte at the start of the transmission.
What's really making me crazy is that the very same code has all been able to work perfectly and achieve what we need, then as if arbitrarily, it's suddenly ignoring the aspect of the code that stops it repeating itself so then Hairless's output is that note 55 is being spammed on at 127 velocity. If Resolume is open it flickers between each of the mapped layers for that note and then about 30kilobytes per second of data gets sent until everything crashes.
This is a really so close but yet so far situation. I'd intend buying Arena 5 at the educational rate for the project but I need to side step these issues, otherwise I need to start from scratch with another platform, I really have my heart set on using Resolume though because it just such a masterfully well made program! Any help would be much appreciated, thanks for your time in reading this!