smoothly rotating an image over time using midi data

grapejuice's picture

hello all,

i am trying to using midi data to smoothly rotate a image on a billboard in a loop once every x bars. qc is receiving midi data via iac bus from ableton.

using a linear cc curve which climbs from 0-1 (x360) over the length of the bar (s) should do it, but when i watch this number as a string i see the frequency at which qc is reading this number is not high enough to capture the rotation at full resolution, therefore the image moves in choppy fashion.

this same lack of sufficient resolution results in qc being unable to make a stable calculation of bpm using the two bpm calculator patches others have built. so i can't use the midi clock receiver and/or either of those bpm calculators to generate a non-choppy interpolation 0 - 360 using the interpolation patch with external timebase or other calculation techniques I'm familiar with.

is there any other way to do this? some other calculation method? some way to stabilize the calculation of bmp? anything? for all other modulations this lack of smoothness is not an issue for me, but i really need interpolation to be smooth for continuous rotation.

anyone?

thanks a bunch

r.

usefuldesign.au's picture
Re: smoothly rotating an image over time using midi data

You have to be careful sweeping the period of an interpolate patch in realtime as a tiny change gets extrapolated according to the composition's patchtime resulting in a recalculation of current interpolate position. Hope that makes sense to you. I'm just guessing that's your problem. Best if you post a comp.

Many ways around it if it is but I've forgotten the tricks I've used in past and I'm logging out. Will check back tomorrow.

jersmi's picture
Re: smoothly rotating an image over time using midi data

instead of using midi cc values, maybe you could set up a stopwatch/interpolation patch and trigger loop start at bar x with interpolation. you'd need the math to make interpolation duration correspond to bars (based on bpm).

grapejuice's picture
Re: smoothly rotating an image over time using midi data

here is a clip showing the problem.

neither use an interpolation patch because of the same problem that creates the choppy motion in the clip - qc does not seem to able to read midi data at a great enough resolution to make smooth rotation possible - you can see the choppy movement.

you'll need ableton sending both clock and an midi clip with an envelope going 0-127 on the modulation wheel to see it work.

thanks for any help.

PreviewAttachmentSize
mididatarotationchoppy.qtz6.26 KB

grapejuice's picture
Re: smoothly rotating an image over time using midi data

thanks very much for the suggestion - i've tried something similar.

unfortunately i have not encountered a bmp calculator that gives a steady bmp from midi sync/notes etc data.

the essential problem as my totally uneduated eyes see it is that qc's 'sampling rate'of incoming midi data is to slow to capture data at a consistent/great enough resolution so as to put out smooth interpolating values and or steady tempo based calculations.

see the composition i uploaded above.

it's completely mystifying for me knowing that so many vj types use qc synced to midi and yet the data calculations are so rough. probably i'm just missing something.

if anyone out there has a solid midi-clock or midi-data type patch i'd love to see it!

anyone?

thanks a bunch

r!

franz's picture
Re: smooth ?

Hi, sorry if i seem so obvious, but why don't you insert a smooth patch in your chain ?

The smooth patch will actually SMOOTH out your value ....

keep in mind that midi is 7 bits (128 levels). So your minimum rotation increment will be 360/128= 2.8 degrees.

see your patch... (if it still isn't smooth enough, you could pair two midi CCs, and code the data on 7+7= 14 bits of signal precision. We often do this with DMX moving lights, to gain precision on rotations. )

PreviewAttachmentSize
mididatarotation smoothed.qtz7.92 KB

grapejuice's picture
Re: smooth ?

Yes, I'm afraid I don't understand how to utilize the smooth patch in this situation, though I tried a few guesses.

In the smoothed patch you have sent me the 'RIGHT' wheel (MIDI Clock input) climbs from appoximately 90 degrees to somewhere in the 300's and then spins BACKWARDS very quickly with some tension and repeats.

The LEFT wheel climbs from 0-360, but then when it reaches the end of the loop it does a similar tensioned back spin before resuming climb.

Is this the intention? Is there some specific value for the increasing and decreasing durations on the 'smooth' patches i should be using?

Sorry if I'm a bit dim!

Could you give me an example of how to combine two CC curves to increase the precision/increment. I would really like this circle to rotate smoothly, and also my next step is translating MIDI to DMX!

thanks

r.

psonice's picture
Re: smooth ?

That's a "feature" of the smooth patch that I've struggled with before.

Basically, it will smooth the input, so while it goes from 0 - 360 you'll get your desired nice, smooth increase. Then, the input goes instantly from 360 back to 0, i.e. it's just gone backwards a complete revolution. It'll spin backwards smoothly, but you want it to keep going.

The 'solution' is for the input value to not count 0-360, but start at 0 and keep going up forever. I've attached a quick method of making it do that (cut down a fair bit from my own method, which had to deal with nasty situations where the spinning wasn't constant or always in the same direction ;( ) You should be able to pretty much copy + paste this in, and just put it between the midi source and the smooth patch.

edit if it's still not smoothing properly, increase the length of the queue (to e.g. 5) and set the bottom index member to be the last index in the queue (i.e. 4). That makes it more reliable.

PreviewAttachmentSize
Smooth Revolve.qtz5.19 KB

gtoledo3's picture
Re: smoothly rotating an image over time using midi data

I would try to solve it by using only the signal for beat 1 (for example-could be any beat) and something like the "signal" patch.

I would have a multiplexer setup hooked to whatever I wanted to rotate. On input 0, I wouldn't have anything hooked up. On input 1, I would hook up on lfo or interpolation to do the spin. So, then you need to get something going so that beat 1 triggers the index switch.

If you need it to synch up more, you can do some rigamarole with patch time triggering, or some math that would grab your basic speed from your last measure played, and apply that to the next measure to derive the basic duration that your rotation should take to do a 360 degree spin.

Without seeing your exact scenario/qtz it's kind of pissing in the wind to suggest anything, but that might lead you to some thoughts.

grapejuice's picture
Re: smoothly rotating an image over time using midi data

i've gone down this route before, though not in the same fashion you're suggesting, but i've never able to make it accurately sync. i have attached a very basic composition showing the 'rotating object' element that i am having trouble with. my compositions are not much more complicated then this, if you can believe it :) - there might just be three or four such rotating objects layered on top of each other to achieve 'moire' type patterns. there are other features oscillating, such as color values etc, but since these do not have to change as degrees of a circle the 'choppiness' of midi into qc is n/a.

so a composition like this is fed midi data from ableton, which happens to be recieving it's trigger messages from another source, but that's not super important. for exmaple a four bar looped midi clip is triggered which would input values into a qc comp like the attached one and loop. one of these values would be the rotation of the circle. at loop position bar 1 beat one the midi cc value is at 0 and climb linearly to 127 at position bar 4 beat 4, then starts again, giving the illusion of a perpetually rotating circle which does a full rotation over the length of the loop, so long as the loop is playing. i might use the same midi loop to drive the same composition, but in two different songs, so i can't really have any standing numbers related to tempo in there, and also the composition has to begin working at beat 1 of a song, so it doesn't allow for calculations based on previous measures.

i've just made the obvious and important discovery that on ableton 'pitch wheel' cc messages are 14 bit, so that's helping with the smoothness quite a bit, but it's not quite as perfect as a qc lfo or interpolation would do.

would adding some sort of app that can send or translate OSC messages from ableton's be of help? i don't know anything about osc except that can send less limited data then midi. essentially the 'rotation' function is the only one where i need total data/timing accuracy and precision.

thank you, and everyone else for their patient and wise answers!

r.

PreviewAttachmentSize
simplemidirotationexample.qtz3.21 KB

psonice's picture
Re: smoothly rotating an image over time using midi data

No midi devices here to test, but surely 14 bit + the smooth patch is enough? I tried the smooth macro I posted above down to around 6 bit, and it looked good.

psonice's picture
Re: smoothly rotating an image over time using midi data

I modified your composition a little to include the smooth macro. I've added a 'fake midi data' macro too, so I can test it.

In the patch parameters, try turning smoothing on/off - for me it goes from horrible + stuttery to smooth. It should work as well with midi data.

The sensitivity setting is a bit odd - if it's too low, the sprite spins at crazy high speed, if it's too high you'll see it spinning backwards as it passes 360. It shouldn't need adjusting much though.

PreviewAttachmentSize
simplemidirotationexampleplus.qtz9.74 KB

grapejuice's picture
Re: smoothly rotating an image over time using midi data

Thank you, thank you, thank you, thank you!

Yes, it works perfectly now. There still seems to be the occasional and very minor 'skip' (we're talking half a degree at most), not that i am complaining, and once i have the 'moire' effect going it's unnoticeable. This is with 14 bit, and sensitivity on '10' does not cause any backwards dialing in the comp.

May I be so bold as to ask if you happened to know how I might alter the patch to allow 'mirrored loop' type rotation? (0 to 360 then backwards down to 0)? Something to do with the increase/decrease intervals?

Is your masterful use of 'smoothing' techniques common trade for non-newb qc users, or is this patch something others might find useful? Should I post it up somewhere?

Thank you again, amazing!

franz's picture
Re: smooth ?

ultra-nice macro !

psonice's picture
Re: smoothly rotating an image over time using midi data

Now with mirroring goodness. I've no idea if anyone else is using something like this, but feel free to put it wherever you want :)

PreviewAttachmentSize
simplemidirotationexampleplus2.qtz12.17 KB

psonice's picture
Re: smooth ?

cybero's picture
Re: smoothly rotating an image over time using midi data

Cheers for that psonice, I'm just getting my head round my Audio midid setup, really useful.

jersmi's picture
Re: smoothly rotating an image over time using midi data

hey, that's a good one, psonice.

i just had a look at how i did this a while back-- i totally forgot-- i used Plogue Bidule as a plugin within ableton to send current bpm via OSC. this made it really easy to trigger/input multiples of bpm to the duration of an interpolation patch.

grapejuice's picture
Re: smoothly rotating an image over time using midi data

thanks again, a real integral function of my project now not sucking!

and then if you do an output splitter before the sprite into various math patches you can use the same single pitch wheel curve to rotate many objects in different ways (x -1 for backwards at the same speed, x 0.5 for half as fast, x 2 for twice as fast etc.) - which is the exact functionality i was looking for - replacing the interpolation tool with a midi loop locked to tempo. fantastic.

grapejuice's picture
Re: smoothly rotating an image over time using midi data

that's a really good idea. i might turn to bidule/osc soon if i run up against other midi snags.

grapejuice's picture
Re: smoothly rotating an image over time using midi data

i'm hoping somone will find this reply in a deep nerd-excavation of the internet...

i've come up with another solution to this problem...

from your midi source send a standard linear lfo cc from that goes 0-1 (and back down again if you want). this goes into the 'patch time' input of the 'timelines' patch, which has to be activated by right clicking the patch and setting the timebase to 'external'.

in the 'timebase' patch draw your desired curve to rotate the circle (linear 0-360 as one example).

this seems to be working well using 'pitch bend' as the cc in abelton, which is 14 bit. haven't tried with lower bit cc's.

nice one!