{"id":8258,"date":"2013-11-29T12:51:14","date_gmt":"2013-11-29T12:51:14","guid":{"rendered":"http:\/\/zerokidz.com\/ideas\/?p=8258"},"modified":"2014-05-18T16:20:27","modified_gmt":"2014-05-18T20:20:27","slug":"pid-controller-in-max","status":"publish","type":"post","link":"https:\/\/reactivemusic.net\/?p=8258","title":{"rendered":"PID controller in Max"},"content":{"rendered":"<p>Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue.<\/p>\n<p><a href=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-8259\" title=\"Screen Shot 2013-11-29 at 7.49.01 AM\" src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png\" alt=\"\" width=\"300\" height=\"176\" srcset=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png 300w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-1024x601.png 1024w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-500x293.png 500w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM.png 1171w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Tried using fiddle~ for frequency detection (as the sensor input) but it provides faulty data below about 200hz &#8211; and that totally messes up the PID. so I am just using the actually frequency being used to set the oscillator as the response sensor.<\/p>\n<p>update: \u00a0Tristan Jehan wrote a Max external that extends lower frequency range of \u00a0[fiddle~]. It would be worth trying for this patch.<\/p>\n<p>The PID algorithm is written in javascript.<\/p>\n<h4>download<\/h4>\n<p><a href=\"https:\/\/github.com\/tkzic\/max-projects\">https:\/\/github.com\/tkzic\/max-projects<\/a><\/p>\n<p>folder: pid-controller<\/p>\n<p>patch:\u00a0pid-mrmapes2.maxpat<\/p>\n<p>javascript code:\u00a0<span style=\"line-height: 1.6;\">pid.js<\/span><\/p>\n<h3>Instructions<\/h3>\n<ul>\n<li>turn on audio<\/li>\n<li>change test interval to something like 20<\/li>\n<li>click on message boxes to change set point. Listen and watch results<\/li>\n<li>try different presets &#8211; which alter PID settings and then try changing the set point. For example, with the 2nd preset you will see overshoot and oscillation during settling phase.<\/li>\n<\/ul>\n<h3>more about PID controllers<\/h3>\n<p><a href=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/300px-PID_en_updated_feedback.svg_.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8270\" title=\"300px-PID_en_updated_feedback.svg\" src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/300px-PID_en_updated_feedback.svg_.png\" alt=\"\" width=\"300\" height=\"200\" \/><\/a><\/p>\n<p>wikipedia page:<a href=\"http:\/\/en.wikipedia.org\/wiki\/PID_controller\">\u00a0http:\/\/en.wikipedia.org\/wiki\/PID_controller<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue. Tried using fiddle~ for frequency &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/reactivemusic.net\/?p=8258\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;PID controller in Max&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[21,273,28],"tags":[344,190,26],"class_list":["post-8258","post","type-post","status-publish","format-standard","hentry","category-dsp","category-max-projects","category-maxmsp","tag-dsp","tag-portfolio","tag-sensors"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PID controller in Max - reactive music<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/reactivemusic.net\/?p=8258\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PID controller in Max - reactive music\" \/>\n<meta property=\"og:description\" content=\"Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue. Tried using fiddle~ for frequency &hellip; Continue reading &quot;PID controller in Max&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/reactivemusic.net\/?p=8258\" \/>\n<meta property=\"og:site_name\" content=\"reactive music\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-29T12:51:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-05-18T20:20:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png\" \/>\n<meta name=\"author\" content=\"Tom Zicarelli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tom Zicarelli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258\"},\"author\":{\"name\":\"Tom Zicarelli\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"headline\":\"PID controller in Max\",\"datePublished\":\"2013-11-29T12:51:14+00:00\",\"dateModified\":\"2014-05-18T20:20:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258\"},\"wordCount\":208,\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png\",\"keywords\":[\"DSP\",\"portfolio\",\"sensors\"],\"articleSection\":[\"DSP\",\"max-projects\",\"Max\\\/MSP\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258\",\"name\":\"PID controller in Max - reactive music\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png\",\"datePublished\":\"2013-11-29T12:51:14+00:00\",\"dateModified\":\"2014-05-18T20:20:27+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/reactivemusic.net\\\/?p=8258\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#primaryimage\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/Screen-Shot-2013-11-29-at-7.49.01-AM.png\",\"contentUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/Screen-Shot-2013-11-29-at-7.49.01-AM.png\",\"width\":\"1171\",\"height\":\"688\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=8258#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/reactivemusic.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PID controller in Max\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/\",\"name\":\"reactive music\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/reactivemusic.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\",\"name\":\"Tom Zicarelli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g\",\"caption\":\"Tom Zicarelli\"},\"sameAs\":[\"http:\\\/\\\/tomzicarelli.com\"],\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PID controller in Max - reactive music","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/reactivemusic.net\/?p=8258","og_locale":"en_US","og_type":"article","og_title":"PID controller in Max - reactive music","og_description":"Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue. Tried using fiddle~ for frequency &hellip; Continue reading \"PID controller in Max\"","og_url":"https:\/\/reactivemusic.net\/?p=8258","og_site_name":"reactive music","article_published_time":"2013-11-29T12:51:14+00:00","article_modified_time":"2014-05-18T20:20:27+00:00","og_image":[{"url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png","type":"","width":"","height":""}],"author":"Tom Zicarelli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tom Zicarelli","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/reactivemusic.net\/?p=8258#article","isPartOf":{"@id":"https:\/\/reactivemusic.net\/?p=8258"},"author":{"name":"Tom Zicarelli","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"headline":"PID controller in Max","datePublished":"2013-11-29T12:51:14+00:00","dateModified":"2014-05-18T20:20:27+00:00","mainEntityOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=8258"},"wordCount":208,"image":{"@id":"https:\/\/reactivemusic.net\/?p=8258#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png","keywords":["DSP","portfolio","sensors"],"articleSection":["DSP","max-projects","Max\/MSP"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/reactivemusic.net\/?p=8258","url":"https:\/\/reactivemusic.net\/?p=8258","name":"PID controller in Max - reactive music","isPartOf":{"@id":"https:\/\/reactivemusic.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=8258#primaryimage"},"image":{"@id":"https:\/\/reactivemusic.net\/?p=8258#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM-300x176.png","datePublished":"2013-11-29T12:51:14+00:00","dateModified":"2014-05-18T20:20:27+00:00","author":{"@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"breadcrumb":{"@id":"https:\/\/reactivemusic.net\/?p=8258#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/reactivemusic.net\/?p=8258"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/reactivemusic.net\/?p=8258#primaryimage","url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM.png","contentUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/11\/Screen-Shot-2013-11-29-at-7.49.01-AM.png","width":"1171","height":"688"},{"@type":"BreadcrumbList","@id":"https:\/\/reactivemusic.net\/?p=8258#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/reactivemusic.net\/"},{"@type":"ListItem","position":2,"name":"PID controller in Max"}]},{"@type":"WebSite","@id":"https:\/\/reactivemusic.net\/#website","url":"https:\/\/reactivemusic.net\/","name":"reactive music","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/reactivemusic.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571","name":"Tom Zicarelli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0da58cf21a2707dd335b204b8ed3cd9194dcbf9d9814ac5d71195a65c76c8a72?s=96&d=mm&r=g","caption":"Tom Zicarelli"},"sameAs":["http:\/\/tomzicarelli.com"],"url":"https:\/\/reactivemusic.net\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/8258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8258"}],"version-history":[{"count":13,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/8258\/revisions"}],"predecessor-version":[{"id":8261,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/8258\/revisions\/8261"}],"wp:attachment":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}