Using simple math to iterate through these indexes (Composition included)

mbira's picture

Hi guys, Sorry to keep exploding the forum. :-D I've got a gig coming up in a week and a half, and I really want to be done with this soon so we can get visuals happening.

I'm attaching the .qts that I have so far.

My commenting is in the composition. Trying to figure out how to switch the index value of the midi note based on the note played (after filtering by velocity).

PreviewAttachmentSize
TestingMath.qtz8.5 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

mbira's picture
Re: Using simple math to iterate through these indexes ...

Well I do see one simple refactor would be to add a second input splitter after the top conditionals to get rid of the other three conditionals...

cradle's picture
Re: Using simple math to iterate through these indexes ...

Are you against using Javascript?

I'd be quite suited to this type of task...

The other thing that springs to mind is, that if you are mapping midi value to video (1->1) then it would seem to me that a simpler method would be to have each video as its own player (simply drag it from Finder into the QC editor), you could then (for example) just map the conditional directly to the "enabled" of a billboard per video ...

Sometimes code speaks louder than words... see if this sample helps you get out of 'math think' :)

This code won't run, but it should show clearly how you would most likely better approach this scenario (you don't HAVE to use javascript, but it simplifies it a lot, if forced to NOT use javascript I would likely have used an iterator over a Kineme Struct)...

PreviewAttachmentSize
Thinking Like a Quartz Composer.qtz10.34 KB

mbira's picture
Re: Using simple math to iterate through these indexes ...

Thanks! I'm on my phone now so I can't look at this till tonight...I wish there was a iPhone app for that. :-D

dust's picture
Re: Using simple math to iterate through these indexes ...

i like to use note numbers for index

dust's picture
Re: Using simple math to iterate through these indexes ...

here is a macro that converts midi indexes to note numbers or freq in a given octave and tuning. this macro is using conditionals and multi-plexors like your patch.

mbira's picture
Re: Using simple math to iterate through these indexes ...

@dust. You're sending me down another rabbit hole. :-D

Am I correct that "all" that patch does is convert midi numbers to note numbers? It still doesn't listen for or relate to velocity-right?

dust's picture
Re: Using simple math to iterate through these indexes ...

correct its not really listening per say like the watcher patch. i find it handy as i'm always forgetting which note is which midi note index number. i think there is a kineme midi tools patch that inputs the midi note number your playing. i suggest using that on the index for your movie loaders. so note c at octave 0 would trigger the first image.

cradle's picture
Re: Using simple math to iterate through these indexes ...

I feel like a knob 'literary nazi-ing' all over a local like yourself... I just know that I'd like to know I was wrong in this instance :P

It's "per se", and it doesn't even have an accent, cos it's Latin, not French or whatnot.

My apologies for being pedantic :D

dust's picture
Re: Using simple math to iterate through these indexes ...

no need to apologize my friend i have my own mental disorders i have to deal with. fortunately pedantry is not one of them. but thank you for the edit and correction.

i will try and be a little more formal on here but some times spelling messes my cadence up as i sort of rant in a stream of consciousness sometimes. i try not to do this on the ipad as typing with it makes me look like a complete idiot.

mbira's picture
Re: Using simple math to iterate through these indexes ...

OK. I have created a working version. I'm pretty happy with it (it works). It also seems to use very few patches-which I suppose is a good thing.

It's not easily extensible-having to load a movie and billboard for each video, but for now it will do. I'd like to eventually refactor this to work with the directory scanner (I really like the idea of the scanner as that puts all the burden on simply having one folder in good order).

I'd also prefer to use something like the global midi receiver, but it seems buggy on my system and has randomly quit responding occasionally, and I can't have that happen on stage.

All that is remaining is for me to wrap my head around the alpha channel and the mask effect for the billboards and I'll use a smoother (I guess) for the fade in and fade out.

PreviewAttachmentSize
First Working Example.qtz10.21 KB

dust's picture
Re: Using simple math to iterate through these indexes ...

yeah i have found that an older version of midi tools works in sl better than the newer versions. i think 2007. im attaching a screen shot of the version and build number that seems to be working the best for me in qc.

PreviewAttachmentSize
Screen shot 2010-11-24 at 2.14.25 AM.png
Screen shot 2010-11-24 at 2.14.25 AM.png123.12 KB

cradle's picture
Re: Using simple math to iterate through these indexes ...

An advantage of not using a scanner, is that it's much easier to (for example) change just one video at run time.

The main advantages of not abstracting to a scanner are that of real time editing, triggering a rescan can have (and will) cascading affects on the rest of your composition, whereas adding/deleting/moving any videos in a hard wired composition affects only the videos themselves.

If you don't need, don't plan on, or don't want to be editing real time (and want it all pre-programmed as much as possible, more 'black box') then the scanner will be far less patches.

Just thought I'd heads up on the advantages of not prematurely optimising to a scanner (as us programmers often wont) as I didn't expect to appreciate the freedom a real-time soft-wired editor gives (i.e. not programatic) until you need to change that one value, or that one video, or that last minute change.

Just a thought :)

Well done on the composition so far - it's scary, but look into multiplexors, and demultiplexors. Demultiplexors with default value and smoothing can provide a succinct alpha controller if you're using multiple billboards. Enough waxing lyrical...

jersmi's picture
Re: Using simple math to iterate through these indexes ...

Here's a virtual macro using a conditional and a multiplexer.

PreviewAttachmentSize
Logic Gate.qtz3.83 KB