Storing values over time (midi for example)

after - strangely - years I’m playing around with vvvv, midi keyboard and Reason for the first time and …

I’m a bit stuck here. What I wanted to achieve was something seemingly simple like this, this (8:45) or dottore’s that.
What has me stumped is: how do I write/keep the values over time without vvvv eating itself?

I’ve attached a patch with a simulation of notes being played over 2 octaves with random velocity to illustrate the problem. I know perfectly well what the problem is (for each note played I insert all 25 of them - twice…) but… yeah. You see can watch the framerate drop after a short while.

Help appreciated.

keepingValues.v4p (32.1 kB)

Hello Purf.

Funny, I thought, hmm thats kinda what I’m working on. And then I saw your link. Thats me at 8:45 of the second video :)

Ok let me give you some insights. You’re right to me this also seemed rather simple at first, but has now been part of my everyday work for over a year. The patch from the video has been almost entirely re"written" with more functionality, way better rendering and even being able to export the created 3D objects to Autodesk Maya.

The problem with storing midi notes is in the way they are played. You can have 1 or a dozen notes playing at the same time, all for different lengths of time. Using a single store node for that was somewhat possible, but i finally gave up on that idea, because since the x64 version of vvvv, memory is not an issue as much anymore.

To reliably save all midi notes you need a store node for each note, because only 1 note can play at one time. This is literally a process of using getslice to get each of the 128 input notes from midi and then storing each note. But of course you dont want to just store the velocity - at least in my case not. You also want to store when the note was played and how long for. So storing that info for one note is quite easy using a Togedge, stopwatch and a global timer. You need to use the insert pin once the note starts playing and use the set pin for as long as it is playing. I use the format: NoteID,Count,Velocity,Time,Length. Zip them together and store as a string. Use cons to have one large spread of all notes.

Then you just use unzip again to use the midi data for whatever you need by mapping the stored values to properties of other things, like 3d objects, etc.

I cant really attach my patch for it, as it is way too large to understand and it requires a few special drivers and midi controllers.

I am attaching the subpatch used for storing with some explanation.

In your example you are still doing something wrong with the store node. The binsize pin should be equal to the notes playing at a given time, otherwise you are storing lots of zeros. That said vvvv is very good at storing data, I can store a few thousand and have them rendered with MRE and SSOA without noticable lag.

midi_store.v4p (32.0 kB)

Heh, I was counting a little on the possibility of “the guy from video” seeing this as I know it from clicking a link over there -->
;)

But, man, fantastic! It was in fact the particularities of midi values throwing me off track here. Will try it out later! Cool, thanks a lot!

“Flag this reply as a solution”?
Very.

thought I’d leave this here. Thanks again!!
(Now onto what to do with it…)

@purf: Looking good already. Now onto the fun stuff, ey ;)

Let me know if you need any more help with it - it might save you some frustration. Saying that, spending the last year or so working on it really built up those vvvv skills.

Current node count on my patch: >2000, subpatch count: >200

Good luck and have fun!

Update:

Just noticed i forgot one node in the sample patch. Before the Togedge that determines when a note starts and ends, there needs to be a > node, so it triggers an output of 1 when a note of any velocity above 0 is played. Otherwise Togedge only gets triggered by notes of velocity 0.5 and above.

Here is the updated patch.

midi_store2.v4p (33.5 kB)

I had caught the missing >.
And then I spent some time staring at Unzip before realizing I have to Separate first ;) But oh well. Works beautifully now. Flying around in compositions with an XBox controller is quite fun.

Now if only I could actually play the piano…

Oh yeah sorry i forgot to mention the separate. Oh well it seems like you know what you’re doing ;)

Funnily enough the whole camera movement thing is on my list of things to improve next. I think i will use the 3Dconnexion Spacemouse Pro or the as of yet fairly unused leap motion sitting on my desk for that.

If you can’t play the piano very well there is always midi files out there. If you want to find some midi files with looots of notes, just search for synthesia on youtube, they usually have the midi file in the description. You just need a midi routing driver for that, as - very strangely - you can’t get the midi notes straight from a midi file, at least i haven’t found a way.