Year 2 sem 2 – Interactive 2 – Exercise 3, Photo Booth

This was the hardest Max patch we wrote up till now as it is logic base and after LPD taught us about the function of different commands –

Clocker(used in the patch to count down the 3,2,1,)
Speedlim (use in this patch to prevent sound from looping endlessly)
Split (used in this patch to split zeros with all other number hence when there is no value = 0 = do nothing)
Gate (I tried to use this, but diden fully understand this so i used IF statement)
Onebang(my favourite) (make sure there is only one bang until it is reset)
Expr (to put mathemathical expression (x1 + x2)/2 )
Pack and Pak

all of these are basic tools and if one can use them to their fullest by chaining up different object, alot of cool stuffs could be done in just these objects.

This is the main piece of patcher in my patch, the rest of the patch are very similar to the previous exercise, so in summary, the flow of this patcher


  • get the square value from face & unpack it
  • find the middle of the square in terms of X value and Y value
  • split into 5 zone
  •  1) Middle Zone (MZ) (the zone where X and y value are around the center, for my patch it is 60 < X < 80 and 50 < Y < 70),
  •  2) X higher than MZ
  •  3) X Lower than MZ
  •  4) Y Higher than MZ
  •  5) Y Lower than MZ
  • For 2 to 5, send the number straight to the audio player
  • And for 1,send the number to audio player while if the value stays in the zone without X or Y going out of the zone for 3 seconds(using counter and if $i1 >= 3000), then take a photo, else stop the timer(and when the timer resumed, it will auto start from 0
  • lastly, I used a single playlist of audio player just because i dont want the patch to play more than one sound clip at any given moment, the only way for different soundclip to play is either
    1) when one clip finish playing and the condition is still the same, it will playback the same soundclip after 2000ms or
    2) when condition changed when a soundclip is playing, it will then stop the current playing soundclip and play another sound clip instantly.


I hope this is relative clear of the flow, through this exercise, I learnt mainly about logic flow, which i think is the most important in every kind of coding.