{"id":50,"date":"2011-12-17T07:40:03","date_gmt":"2011-12-17T07:40:03","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMDG3x00_D11\/?p=50"},"modified":"2011-12-17T07:40:03","modified_gmt":"2011-12-17T07:40:03","slug":"kaiju-video-smasher-software-dev-2","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2011\/12\/17\/kaiju-video-smasher-software-dev-2\/","title":{"rendered":"Kaiju Video Smasher: Software Dev 2"},"content":{"rendered":"<p>The last piece of the controller puzzle is now left to puredata. I need to parse the incoming serial stream from the arduino and run those values into the videoFilePlayer object that was created in the <a href=\"http:\/\/electronicarts.joshuarosenstock.com\/wiki\/Tutorial_1:_Video_Player\">first video tutorial<\/a>.<\/p>\n<p><strong>Serial Parsing<\/strong><\/p>\n<p>This bit took me the longest to get working. There are lots of serial reading objects out there but very few of them have documentation or sample patches, so you&#8217;re really left in the dark on how to get them to work. One that I got to\u00a0<span class=\"Apple-style-span\" style=\"color: #000000\"><a href=\"http:\/\/wiki.puredata.info\/en\/convert.ascii2pd\">convert.ascii2pd<\/a>\u00a0which is part of the\u00a0<a title=\"pdmtl\" href=\"http:\/\/wiki.puredata.info\/en\/pdmtl\">pdmtl<\/a>\u00a0library. Here&#8217;s a simple example of how to use the object:<a href=\"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/serial_parsing_example.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-51\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/serial_parsing_example-300x228.png\" alt=\"\" width=\"300\" height=\"228\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/serial_parsing_example-300x228.png 300w, https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/serial_parsing_example-394x300.png 394w, https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/serial_parsing_example.png 397w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\u00a0[<a href=\"http:\/\/www.joshuarosenstock.com\/teaching\/electronic_arts\/patches\/serial_parsing_example.pd\">Download the patch<\/a>]<\/span><\/p>\n<p>Now that I can get the flex values, all I have to do is smooth them over and plug them into some video and audio player objects.<\/p>\n<p>Fast forward a couple hours and I have this: [the final GUI]<\/p>\n<p><a href=\"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/kaiju-vid-smash-gui1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-53\" src=\"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/kaiju-vid-smash-gui1.png\" alt=\"\" width=\"852\" height=\"592\" srcset=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/kaiju-vid-smash-gui1.png 852w, https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/kaiju-vid-smash-gui1-300x208.png 300w, https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-content\/uploads\/2011\/12\/kaiju-vid-smash-gui1-431x300.png 431w\" sizes=\"(max-width: 852px) 100vw, 852px\" \/><\/a><\/p>\n<p>Now since I didn&#8217;t have time to document the process here I&#8217;ll go into each component and how it works.<\/p>\n<p>Starting from the upper with and going clockwise:<\/p>\n<ul>\n<li>The standard GEMWIN and PD DSP controls, you&#8217;ll see these on any patch that uses GEM or audio computation. They open the GEM window and start the visual process and start\/stop the computation of audio,\u00a0respectively.<\/li>\n<li>Serial controls. Just like I described above, this section parses the serial stream from the arduino and smooths it a bit and rounds in to an int value and sends it off to any area that\u00a0receiving\u00a0data from the flexvalue label.<\/li>\n<li>Name and description. I&#8217;m using canvas objects to make the colored background by the way.<\/li>\n<li>Flex value to frame num conversion. This area just divides the total number of frames by the maximum possible flex value [1024] so we can get a mapping of flex to frames.<\/li>\n<li>Audio controls. This section allows the user to load an audio file and have it be scrubbed\/played by the current [scaled] flex value that&#8217;s being sent around. The played audio is then sent to the speakers.<\/li>\n<li>Video controls. Lastly, this section has a video file open dialog which feeds into a generic videoFilePlayer object from the wiki tutorials. The plyback of the opened video is controlled by a looper that takes a start and end position and continuously loops those frames. The flexvalue is used to change the start position of the loop and the rest of the info [loop length, playback speed] is supplied by the user.<\/li>\n<\/ul>\n<div>Here&#8217;s a short performance video of the system in action:<\/div>\n<div>http:\/\/vimeo.com\/33819194<\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last piece of the controller puzzle is now left to puredata. I need to parse the incoming serial stream from the arduino and run those values into the videoFilePlayer object that was created in the first video tutorial. Serial &hellip; <a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2011\/12\/17\/kaiju-video-smasher-software-dev-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/50"}],"collection":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":0,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/50\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=50"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=50"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}