Selecting Movies based on volume

May 3, 2006 at 2:08pm

Selecting Movies based on volume

OK, me again. Still with similar problems. Unfortunately Ive spent so long actually makign the animations for my patch that I havent had te time to learn Jitter that much. Im sure this problem could be quite simply solved.

My patch selects movies 1, 2, 3, 4, 5 based on how much sound the microphone picks up. The Patch selects a movie every 2 seconds. The movies are of a man: 1.stood around, 2.Shy on the edge of the dance floor, 3. Dancing… etc etc. Every 2 seconds of each movie the man is in the same position. This is so that if i choose to I can make the man change between standing still and dancing like crazy completly smoothly.

I hope that makes sense.

My Problem is each movie is 2 minutes (each one loops after 2 minutes) and I want each movie to run ALL THE TIME in syncronistation So that for example if the patch changes from movie 1 to movie 3 at 12 seconds into the animation when it makes the transition movie 3 carries on from 12 seconds. Currently whenever the patch checks for sound (Every 2 seconds) It restarts the mmovie to the begining. Which negates about 99% of thr aniamtion work ive done with this charcter.

The Solution probably lies in swapping the orders it does thigns round, or in a function im not aware of. Heres the patch. Any and all help, or nudges in the right direction are much apreciated. Thannks in advance

Patch:

max v2;
#N vpatcher 4 141 1235 918;
#P origin 22 52;
#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P newex 475 549 71 9109514 prepend read;
#P message 589 513 37 9109514 5.mov;
#P message 530 514 37 9109514 4.mov;
#P message 467 514 37 9109514 3.mov;
#P message 405 514 37 9109514 2.mov;
#P message 342 514 37 9109514 1.mov;
#P user ezadc~ 309 50 353 83 0;
#P number 509 433 35 10 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 435 429 56 9109514 qlim 1000;
#P toggle 320 458 34 0;
#P newex 389 552 44 9109514 metro 5;
#P newex 475 584 103 9109514 jit.qt.movie 768 576;
#P comment 428 134 73 9109514 milli seconds;
#P window setfont “Proportional Serif” 10.;
#P comment 628 296 18 9175050 dB;
#P window linecount 2;
#P comment 585 269 45 9175050 Note-on Threshold;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 588 295 41 10 -120. 0. 3 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 520 463 22 0;
#P window setfont “Fixedwidth Serif” 12.;
#P user jit.fpsgui 475 659 79 9240588 0;
#P window linecount 1;
#P newex 475 628 246 9240588 jit.window dancingman @pos 800 100;
#B color 5;
#P message 677 462 101 9240588 fullscreen $1;
#P toggle 677 443 15 0;
#P newex 677 417 52 9240588 sel 27;
#P newex 677 392 40 9240588 key;
#P user panel 652 378 149 133;
#X brgb 209 171 138;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont “Sans Serif” 10.;
#P newex 435 464 80 9109514 select 0 1 2 3 4;
#P newex 435 403 42 9109514 * 4.999;
#P window setfont “Sans Serif” 12.;
#P window linecount 2;
#P comment 405 163 62 9109516 Amplitude Tracking;
#P window setfont “Proportional Serif” 10.;
#P window linecount 1;
#P comment 324 382 105 9175050 expanded note amplitude;
#P window setfont “Fixedwidth Serif” 10.;
#N vpatcher 304 73 596 307;
#P window setfont “Proportional Serif” 10.;
#P comment 9 177 74 9175050 amplitude on a logarithmic curve;
#P comment 110 162 92 9175050 expanded level , in dB;
#N comlet (float) log10 amplitude;
#P outlet 33 162 15 0;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 141 38 9240586 !- 1.;
#P window setfont “Proportional Serif” 10.;
#P comment 116 97 80 9175050 set floor threshold;
#P comment 101 77 83 9175050 clip if out of range;
#P comment 111 56 81 9175050 optional gain/trim;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 74 68 9240586 minimum 0.;
#N comlet (float) expanded level;
#P outlet 95 162 15 0;
#P window setfont “Proportional Serif” 10.;
#P comment 157 21 63 9175050 threshold (dB);
#P comment 87 21 68 9175050 input gain (dB);
#P comment 8 21 70 9175050 input level (dB);
#P comment 145 144 131 9175050 expand to occupy full dB range;
#P comment 127 113 130 9175050 calculate level as a percentage of the above-threshold range;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 53 78 9240586 + 0.;
#P newex 33 95 83 9240586 maximum -120.;
#P newex 95 141 50 9240586 * -120.;
#P newex 33 116 94 9240586 / 1.;
#N comlet (float) threshold dB;
#P inlet 163 35 15 0;
#N comlet (float) input gain/trim dB;
#P inlet 101 35 15 0;
#N comlet (float) dB;
#P inlet 33 35 15 0;
#P connect 0 0 6 0;
#P connect 6 0 13 0;
#P connect 13 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 17 0;
#P connect 17 0 18 0;
#P fasten 3 0 4 0 38 137 100 137;
#P connect 4 0 12 0;
#P connect 1 0 6 1;
#P fasten 2 0 5 1 168 91 111 91;
#P fasten 2 0 3 1 168 112 122 112;
#P pop;
#P newobj 486 341 159 9240586 patcher dBexpander;
#P window setfont “Proportional Serif” 10.;
#P comment 258 226 52 9175050 Peak Level;
#P comment 421 294 65 9175050 expanded level;
#P comment 215 269 95 9175050 Level as Pct. of Max.;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 309 269 59 10 0. 1. 3 141 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 304 73 596 307;
#P window setfont “Proportional Serif” 10.;
#P comment 9 177 74 9175050 amplitude on a logarithmic curve;
#P comment 110 162 92 9175050 expanded level , in dB;
#N comlet (float) log10 amplitude;
#P outlet 33 162 15 0;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 141 38 9240586 !- 1.;
#P window setfont “Proportional Serif” 10.;
#P comment 116 97 80 9175050 set floor threshold;
#P comment 101 77 83 9175050 clip if out of range;
#P comment 111 56 81 9175050 optional gain/trim;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 74 68 9240586 minimum 0.;
#N comlet (float) expanded level;
#P outlet 95 162 15 0;
#P window setfont “Proportional Serif” 10.;
#P comment 157 21 63 9175050 threshold (dB);
#P comment 87 21 68 9175050 input gain (dB);
#P comment 8 21 70 9175050 input level (dB);
#P comment 145 144 131 9175050 expand to occupy full dB range;
#P comment 127 113 130 9175050 calculate level as a percentage of the above-threshold range;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 33 53 78 9240586 + 0.;
#P newex 33 95 83 9240586 maximum -120.;
#P newex 95 141 50 9240586 * -120.;
#P newex 33 116 94 9240586 / 1.;
#N comlet (float) threshold dB;
#P inlet 163 35 15 0;
#N comlet (float) input gain/trim dB;
#P inlet 101 35 15 0;
#N comlet (float) dB;
#P inlet 33 35 15 0;
#P connect 0 0 6 0;
#P connect 6 0 13 0;
#P connect 13 0 5 0;
#P connect 5 0 3 0;
#P connect 3 0 17 0;
#P connect 17 0 18 0;
#P fasten 3 0 4 0 38 137 100 137;
#P connect 4 0 12 0;
#P connect 1 0 6 1;
#P fasten 2 0 5 1 168 91 111 91;
#P fasten 2 0 3 1 168 112 122 112;
#P pop;
#P newobj 309 248 159 9240586 patcher dBexpander;
#P window setfont “Proportional Serif” 10.;
#P comment 224 250 86 9175050 expand to full range;
#P comment 245 208 65 9175050 translate to dB;
#P comment 238 187 72 9175050 Peak Amplitude;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 458 269 38 9240586 t b f;
#P flonum 435 383 41 10 0. 1. 3 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Proportional Serif” 10.;
#P comment 551 294 18 9175050 dB;
#P comment 373 226 18 9175050 dB;
#P comment 503 226 18 9175050 dB;
#P comment 432 226 18 9175050 dB;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 309 226 65 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 486 294 65 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 452 225 53 10 -120. -0.001 3 141 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 40 55 409 213;
#P window setfont “Proportional Serif” 10.;
#P comment 9 29 329 9175050 Convert a linear amplitude to amplitude in decibels. 0dB = 1. (full amplitude);
#P comment 125 50 141 9175050 amplitude expressed as a decimal ; 1. = full amplitude;
#N comlet (float) amplitude;
#P outlet 110 105 15 0;
#N comlet (float) decibels;
#P inlet 110 50 15 0;
#P window setfont “Fixedwidth Serif” 10.;
#P newex 110 76 122 9240586 expr 20.*log10($f1);
#P window setfont “Proportional Serif” 10.;
#P comment 125 94 141 9175050 amplitude expressed in decibels ; 0dB = full amplitude;
#P connect 2 0 1 0;
#P connect 1 0 3 0;
#P pop;
#P newobj 309 205 50 9240586 p AtodB;
#P number 390 133 35 10 0 0 65 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P user multiSlider 400 314 82 62 -120. 0. 1 3945 15 0 0 2 0 0 1;
#M frgb 0 0 0;
#M brgb 0 255 0;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P window setfont “Proportional Serif” 10.;
#P comment 392 212 49 9175050 Gain/Trim;
#P window setfont “Fixedwidth Serif” 10.;
#P flonum 392 227 41 10 0 0 0 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P objectname peakgain;
#P flonum 309 187 59 10 0. 1. 3 141 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 309 166 91 9240586 peakamp~;
#B color 5;
#P window setfont “Proportional Serif” 10.;
#P window linecount 2;
#P comment 451 200 55 9175050 Noise Floor Threshold;
#P user panel 212 162 305 128;
#X brgb 127 255 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 398 290 86 88;
#X brgb 127 255 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P user panel 484 290 84 24;
#X brgb 127 255 255;
#X frgb 0 0 0;
#X border 0;
#X rounded 0;
#X shadow 0;
#X done;
#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P comment 275 131 112 9109514 check peak amp every;
#P window linecount 2;
#P comment 58 481 173 9109514 Try this in a room with a microphone;
#B color 13;
#P window setfont “Sans Serif” 12.;
#P window linecount 13;
#P comment 59 261 137 9109516 Settings: Sound Input (Pendulum) Place microphone near speaker Gain/Trim: -5 dB Noise Floor Threshold: -36 dB Min Note Duration: 20 ms Note-on Threshold: -120dB These settings are for playing all 5 movies when using a microphone placed in front of the speaker.;
#B color 12;
#P background;
#P fasten 53 1 7 0 348 100 314 100;
#P connect 53 0 7 0;
#P connect 7 0 8 0;
#P connect 8 0 13 0;
#P connect 13 0 16 0;
#P connect 16 0 26 0;
#P connect 26 0 27 0;
#P connect 35 0 54 0;
#P fasten 9 0 26 1 397 244 388 244;
#P fasten 50 0 49 0 325 545 394 545;
#P connect 12 0 7 1;
#P fasten 22 1 11 0 491 290 405 290;
#P connect 35 1 55 0;
#P fasten 31 0 21 0 491 380 440 380;
#P connect 21 0 34 0;
#P connect 34 0 51 0;
#P connect 51 0 35 0;
#P fasten 14 0 26 2 457 244 462 244;
#P connect 26 1 22 0;
#P connect 35 2 56 0;
#P connect 54 0 59 0;
#P connect 55 0 59 0;
#P connect 56 0 59 0;
#P connect 57 0 59 0;
#P connect 58 0 59 0;
#P connect 59 0 48 0;
#P connect 49 0 48 0;
#P connect 48 0 41 0;
#P fasten 40 0 41 0 682 618 480 618;
#P connect 41 0 42 0;
#P connect 22 1 15 0;
#P connect 15 0 31 0;
#P fasten 51 0 52 0 440 459 503 459 503 421 514 421;
#P fasten 51 0 43 0 440 459 525 459;
#P connect 35 3 57 0;
#P connect 35 4 58 0;
#P fasten 44 0 31 2 593 337 639 337;
#P connect 37 0 38 0;
#P connect 38 0 39 0;
#P connect 39 0 40 0;
#P pop;

Richard

#25762
May 4, 2006 at 9:58am

I dont get it. I posted the problem in depth, and it seems like an easy one to solve yet no ones replied? Hmmmf

Just to clarify:

BAsically I want to be able to play 5 movies in syncronisation and have the Patch select between movie every 2 seconds however when the patch selects the movie i dont want it to restart to the begining of the movie.

Richard

#76223
May 4, 2006 at 12:28pm

first, it’s always better to isolate. if you have a jitter question,
strip out the non-relevant stuff to your question when you’re posting
a patch. this has two results: 1) we’re going to have an easier
way of understanding what your question is, and we’re going to be
more likely to answer! 2) in reframing the patch so the problem is
isolated, you may have an insight into what the solution is.

anyway, you have two ways of doing this, at least.

1) take a look at the poly~-for-movies example in the jitter/
quicktime examples folder. it demonstrates how to use the poly~
structure to maintain multiple copies of jit.qt.movie…

2) also consider this method. when you switch, send a gettime
message to the soon-to-be-inactive jit.qt.movie. then use the time
value on the new movie.

#76224
May 4, 2006 at 12:52pm

hello,

some nudges:

maybe you would want to load all five movies in different jit.qt.movie
objects, and cleverly switch between them(to avoid frame drops).

you would load all five movies in appropriate jit.qt.movie objects, and stop
them(@autostart 0), to avoid file reading overhead.
then, you play only one of them(and bang only that one), and send it to
output. at the moment of transition, you could get current clip time using
‘gettime’ message to jit.qt.movie object, and send that to next playing clip
using ‘time’ message.
please read jit.qt.movie reference&help file, there are some other things
that might speed things even more(loadram, direct to window…)

best,
nesa

#76225
May 4, 2006 at 3:04pm

i am very new to msp/jitter (less than a year). that being said, here is possible work around. you will have to modify it so that it suits your specific patch, but if all you want to do is play a collection of movies at the same time and switch between them, why not use a fader.

I was also wonder if a set of “if then” scenarios would work. like if the movie 1 was above 400 frames at the moment that your audio threshold “level 3″ was reached, the movie would play backwards for 400 frames, or to the closest frame that your animation can synch up. at this point you could cross fade the movies.

does this make sense?

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

max v2;
#N vpatcher 313 126 1182 638;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 59 38 100 196617 threshold 2;
#P button 60 53 35 0;
#P button 8 51 36 0;
#P newex 47 118 48 196617 loadbang;
#P message 68 137 26 196617 100;
#P message 40 137 14 196617 0;
#P number 498 163 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Lucida Grande” 10.;
#P message 702 218 78 67108874 read four.mov;
#P newex 692 245 128 67108874 jit.qt.movie 320 240;
#P message 557 218 84 67108874 read three.mov;
#P newex 543 244 128 67108874 jit.qt.movie 320 240;
#P window setfont “Sans Serif” 9.;
#P newex 437 280 155 196617 switch 3;
#P window setfont “Lucida Grande” 10.;
#P newex 61 266 83 67108874 prepend xfade;
#P window linecount 2;
#P comment 266 69 55 67108874 Play Movie;
#P window linecount 1;
#P message 418 218 76 67108874 read two.mov;
#P message 264 218 76 67108874 read one.mov;
#P window linecount 2;
#P comment 117 224 32 67108874 Mixer;
#P window linecount 1;
#P comment 205 208 15 67108874 B;
#P comment 46 208 15 67108874 A;
#P toggle 209 41 54 0;
#P message 343 170 38 67108874 start;
#P message 308 170 32 67108874 stop;
#P newex 308 149 80 67108874 select 0 1;
#P newex 233 149 53 67108874 metro 50;
#P newex 402 245 128 67108874 jit.qt.movie 320 240;
#P newex 250 245 128 67108874 jit.qt.movie 320 240;
#P newex 397 152 53 67108874 loadbang;
#P comment 114 123 104 67108874 Set Transition Time;
#B frgb 182 16 51;
#P comment 155 140 20 67108874 ms;
#P number 113 140 42 10 0 0 1 1024 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 61 248 35 10 0. 1. 131 1024 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 61 157 62 67108874 pack;
#P newex 61 179 64 67108874 line 0 1000;
#P newex 61 227 43 67108874 * 0.01;
#P user hslider 61 203 18 128 101 1 0 0;
#P newex 316 335 162 67108874 jit.xfade;
#B color 5;
#P window setfont “Sans Serif” 9.;
#P comment 534 163 248 196617 < < #P comment 1 38 100 196617 threshold 1;
#P window linecount 6;
#P comment 337 37 289 196617 something like this could work i suppose. you need to name the message boxes after the names of your movies (unless your movies are named “one.mov” “two.mov. three…. /// you may also need to make another set of switches” , each with its own copy of all of your movies. this is a very crude way to do this , but if you are in a hurry , it may work for now.;
#P connect 36 0 33 0;
#P connect 33 0 7 0;
#P connect 34 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 5 0;
#P connect 5 0 8 0;
#P connect 8 0 26 0;
#P connect 37 0 34 0;
#P connect 35 0 34 0;
#P connect 9 0 7 1;
#P connect 19 0 15 0;
#P fasten 18 0 13 0 348 215 255 215;
#P fasten 17 0 13 0 313 215 255 215;
#P fasten 15 0 13 0 238 241 255 241;
#P connect 23 0 13 0;
#P fasten 12 0 23 0 402 214 269 214;
#P fasten 19 0 16 0 214 145 313 145;
#P connect 16 0 17 0;
#P connect 27 0 3 0;
#P fasten 26 0 3 0 66 287 321 287;
#P connect 16 1 18 0;
#P fasten 18 0 14 0 348 215 407 215;
#P fasten 17 0 14 0 313 215 407 215;
#P fasten 15 0 14 0 238 241 407 241;
#P connect 24 0 14 0;
#P fasten 12 0 24 0 402 214 423 214;
#P connect 32 0 27 0;
#P connect 13 0 3 1;
#P fasten 14 0 27 1 407 270 490 270;
#P fasten 28 0 27 2 548 270 538 270;
#P fasten 18 0 28 0 348 215 548 215;
#P fasten 17 0 28 0 313 215 548 215;
#P fasten 15 0 28 0 238 231 548 237;
#P connect 29 0 28 0;
#P fasten 12 0 29 0 402 214 562 214;
#P fasten 30 0 27 3 697 270 586 270;
#P fasten 18 0 30 0 348 215 697 215;
#P fasten 17 0 30 0 313 215 697 215;
#P fasten 15 0 30 0 238 235 697 235;
#P connect 31 0 30 0;
#P fasten 12 0 31 0 402 214 707 214;
#P pop;

#76226
May 4, 2006 at 6:51pm

OK, Thanks both

Joshua, I’m looking into the examples you gave right now. Thanks for them and in future I’ll shorten my posts to make it easier for eeveryone.

Oliver, wow thanks for your patch. I’ve briefly looked at the patch you provided and as far as I can see All I need to do is add jit.window, a 5th jit.qtmovie and the sound input. I am a little bemused as to where the sound input would fit into the patch.

I assume it would connect into switch or jit.xfade?

Thanks both.

WIP still hehe

#76227
May 5, 2006 at 12:36pm

Update:

Thanks for the exelent pointer Joshua. I took half of my existing patch and welded it to half of the poly example patch and it works how i want it too. Max is good like that :D

Oliver I’ll look more into your patch later.

My problem now is two things.

1. Making polymovie to be 768 by 576 px dimensions. The movies are currently playing a defualt?? size of 320 by 640 i assume, this means when i full screen the jit.window to the projector it looks very pixelated.

2. Finding a way Of starting the sound input the second all 5 movies are loaded and start playing so that it will check for sound at the correct moments in the movie.

I am still workign on it but Please pointers in this direction would be very helpfull as im getting close to my deadline now.

if you need to see the patch ill gladly post it

#76228
May 5, 2006 at 3:03pm

if you send adapt 1 to jit.qt.movie it’ll size the matrix to the file
you read in. Don’t have time to test right now, but I assume that’ll
cascade to jit.window at the same size but if not, send getmoviedim to
jit.qt.movie and use the result from its right outlet to set window
size. Also, try sending interp 1 to jit.window to reduce ‘pixelation’
although i think that’s on by default.

best,
dan

p.s. n.b. 12 frames in one movie might not equal 12 frames in the
others if their QT timescale is different. However, sounds like you
probably made your animations the same way and compressed alike too so
this may not be a problem for you.


***
http://danwinckler.com
http://share.dj

http://gunshowimprov.com

#76229
May 5, 2006 at 5:10pm

thanks dan, thats exactly what It needed. I had to set the adapt 1 command up on a metro so that everytime it changes movie the command is sent instantly. Probably not the best way to achieve it but it works and doesnt seem to affect my perfomance that much.

Thankfully I realised the potential problem with movies and framerate very early on in the project and each movie is based from the same animation and exported to exactly the same file type.

Only 1 more problem to fix o/

2. Finding a way of starting the sound input the second all 5 movies are loaded and start playing so that it will check for sound at the correct moments in the movie.

Will start work on that problem later tonight

Thanks for all your help everyone you’re making a very stressfull time for me less stressfull and without your help its so so so doubtfull that id realise the idea.

#76230

You must be logged in to reply to this topic.