Skip to content

Examples

OCH edited this page Mar 26, 2023 · 3 revisions

On the control machine, navigate to the examples folder and open the examples.maxproj file.

A series of quick examples appear listed on the Max project window.

Screen Shot 2022-11-28 at 1 13 30 PM

Patch #00.maxpat, that should open automatically, serves as an index of the examples provided.

Screen Shot 2022-11-28 at 1 13 32 PM

EXAMPLES

#01.maxpat

Example 1: Sync playback with 2 Raspberry Pi. First, you can unlock patch and edit the pvm_send objects to change IP and port. Here these settings are embedded into the pvm_send object itself as positional arguments. Change each one to the corresponding Raspberry Pi device IP and port being used - assuming that you'll be using the first display on each device, you may only need to change the IP address. After that is done, you can lock the patch and click the message box file pattern01_h264.mov that will send the file command to both devices, and load the requested file. This file needs to be already saved on the Raspberry Pi devices memory, as instructed on the readme here. Lastly, you can click the toggle to start the video playback on both devices at the same time.

#02.maxpat

Example 2: Sync playback with 4 Raspberry Pi. This example uses a coll object to programmatically initialize the several pvm_send objects here. You can double click the coll object to edit its contents. This is similar to what happens in the main Control Machine patch with the max-init.txt file, as described here. Once that is set, a simple click on the button object above the coll will trigger the output of its contents. This output is routed to each appropriate pvm_send object through a combination of message boxes and a route object. If you unlock the patch you will be able to see this. Lastly, you can click the toggle to start the video playback on all devices at the same time.

#03.maxpat

Example 3: Different offsets with 2 Raspberry Pi. Similar to example #02, this patch uses a coll object to simplify the initialization process. However, here we are adding an additional value to each line in the coll. This value will programmatically set the set_position value of each device. Read more about this value on our other wiki page here. By sending 0.0 to the first device and 0.5 to second device, we can make sure that they are offset by exactly half the length of the video. After setting everything, by clicking the button above the coll object, you click the toggle to start the synchronized video playback on both devices.

#04.maxpat

Example 4: Different offsets with 4 Raspberry Pi. Similar to example #03, this patch uses a coll object with an additional value for setting the set_position value of four PVM devices. Respectivelly, 0.0, 0.25, 0.5, and 0.75. Starting the synchronized video playback of all four devices should keep them 1/4 of the length of the video appart.

#05.maxpat

Example 5: Different rates with 4 Raspberry Pi. This example still uses a coll object to initialize all the devices, but with an additional value not to set the set_position value but the set_rate value. This value, as explained here, changes the speed of video playback. By sending 4. to the first device it will make it play 4 times the original speed of the video. The second device will play at 2 times the original speed of the video. The third device will play at original speed. And the fourth device, receiving value 0.5, will play at half the original speed of the video. Because of the proportions between these values, and the synced playback start, the first device should complete 8 cycles, the second one completes 4, the third one 2 cycles, during the time it takes the fourth device to complete one cycle.

#06.maxpat

Example 6: Sync playback with 6 Raspberry Pi and 12 displays. This example is intended to explore both the synchronization of a larger number of devices, as well as the use of both displays on each device. Here we are once again using the coll object to contain all the information necessary to initialize all devices in one go. Each display on each device, is a line on this coll. Additionally, this also offers several other examples. There is an alternative toggle interface for starting and stopping the devices, where the play button has two states (toggle) that correspond to a play and pause states (green or grey), and the stop button is only a one time trigger to command all the devices to stop. There is a number box (see section 3 in the patch) connected to a message box set_rate $1 that illustrates how you can change the rate of all devices in realtime, instead of setting it only once with the coll objects, as in the previous example. Lastly, there is also a number box connected to a p offset_manager patcher, that illustrates how to programmatically change the offset positions of all devices, in realtime, in order to account for a certain number of repetitions. This number box defaults to the value 12 that means that the video in the same cycle phase will be repeated 12 times - that is the same as saying that all displays will show the same video with the same phase. If you set this number to 4, for example, it means that there will be 3 repetitions in the offset patterns. This means that each of the 12 displays will have their offset values to 0., 0.25, 0.5, 0.75, 0., 0.25, 0.5, 0.75, 0., 0.25, 0.5, and 0.75, respectively.

What to explore next?

  • Different rates with different videos.
  • Different start positions with different videos.