{"id":20135,"date":"2021-02-16T12:34:57","date_gmt":"2021-02-16T17:34:57","guid":{"rendered":"https:\/\/reactivemusic.net\/?p=20135"},"modified":"2021-02-16T12:34:57","modified_gmt":"2021-02-16T17:34:57","slug":"mbta-api-in-max","status":"publish","type":"post","link":"https:\/\/reactivemusic.net\/?p=20135","title":{"rendered":"MBTA API in Max"},"content":{"rendered":"<p class=\"lead\">Sonification of Mass Ave buses, from Nubian to Harvard.<\/p>\n<p class=\"lead\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-20136\" src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png\" alt=\"\" width=\"300\" height=\"163\" srcset=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png 300w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-1024x557.png 1024w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-768x418.png 768w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-1536x836.png 1536w, https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-2048x1115.png 2048w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Updated for Max8 and Catalina<\/p>\n<p>This patch requests data from MBTA API to get the current location of buses &#8211; using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results might be more interesting to poll at a slower rate, because the updates don&#8217;t seem that frequent. And buses tend to stop a lot.<\/p>\n<p>Original project link from 2014:\u00a0<a href=\"https:\/\/reactivemusic.net\/?p=17524\">https:\/\/reactivemusic.net\/?p=17524<\/a><\/p>\n<p>MBTA developer website: <a href=\"https:\/\/www.mbta.com\/developers\">https:\/\/www.mbta.com\/developers<\/a><\/p>\n<p>This project uses version 3 of the API. There are quality issues with the realtime data. For example, there are bus stops not associated with the route. The direction_id and stop_sequence data from the buses is often wrong. Also, buses that are not in service are not removed from the vehicle list or indicated as such.<\/p>\n<p>The patch uses a [multislider] object to graph the position of the buses along the route &#8211; but due to the data problems described above, the positions don&#8217;t always reflect the current latitude\/longitude coordinates or the bus stop name.<\/p>\n<h5>download<\/h5>\n<p><a href=\"https:\/\/github.com\/tkzic\/internet-sensors\">https:\/\/github.com\/tkzic\/internet-sensors<\/a><\/p>\n<p>folder: mbta<\/p>\n<p>patches:<\/p>\n<ul>\n<li>mbta.maxpat<\/li>\n<li>mbta.js<\/li>\n<li>poly-oscillator.maxpat<\/li>\n<\/ul>\n<h5>authentication<\/h5>\n<p>You will need\u00a0 to replace the API key in the message object at the top of the patch with your own key. Or you can probably just remove it. The key distributed with the patch is fake. You can request your own developer API key from MBTA. It&#8217;s free.<\/p>\n<h5>instructions<\/h5>\n<ul>\n<li>Open mbta.maxpat<\/li>\n<li>Open the Max console window so you can see what&#8217;s happening with the data<\/li>\n<li>click on the yellow [getstops] message to get the current bus stop data<\/li>\n<li>Toggle the metro (at the top of the patch) to start polling<\/li>\n<li>Turn on the audio (click speaker icon) and turn up the gain<\/li>\n<\/ul>\n<p>Note: there will be more buses running during rush hours in Boston. \u00a0Try experimenting with the polling rate and ramp length in the poly-oscillator patch. Also, you can experiment with the pitch range.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sonification of Mass Ave buses, from Nubian to Harvard. Updated for Max8 and Catalina This patch requests data from MBTA API to get the current location of buses &#8211; using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/reactivemusic.net\/?p=20135\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MBTA API 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":[230,143,275,28],"tags":[161,214,6,168,345,190,25,12],"class_list":["post-20135","post","type-post","status-publish","format-standard","hentry","category-development","category-interactive-media-art","category-internet-sensors","category-maxmsp","tag-api","tag-data-sonification","tag-interactive-media","tag-javascript","tag-maxmsp","tag-portfolio","tag-programming","tag-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MBTA API 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=20135\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MBTA API in Max - reactive music\" \/>\n<meta property=\"og:description\" content=\"Sonification of Mass Ave buses, from Nubian to Harvard. Updated for Max8 and Catalina This patch requests data from MBTA API to get the current location of buses &#8211; using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results &hellip; Continue reading &quot;MBTA API in Max&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/reactivemusic.net\/?p=20135\" \/>\n<meta property=\"og:site_name\" content=\"reactive music\" \/>\n<meta property=\"article:published_time\" content=\"2021-02-16T17:34:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135\"},\"author\":{\"name\":\"Tom Zicarelli\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"headline\":\"MBTA API in Max\",\"datePublished\":\"2021-02-16T17:34:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135\"},\"wordCount\":352,\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png\",\"keywords\":[\"API\",\"data sonification\",\"interactive media\",\"javascript\",\"Max\\\/MSP\",\"portfolio\",\"programming\",\"web development\"],\"articleSection\":[\"development\",\"interactive media art\",\"internet-sensors\",\"Max\\\/MSP\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135\",\"name\":\"MBTA API in Max - reactive music\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png\",\"datePublished\":\"2021-02-16T17:34:57+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/reactivemusic.net\\\/?p=20135\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#primaryimage\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/Screen-Shot-2021-02-16-at-12.12.09-PM.png\",\"contentUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/Screen-Shot-2021-02-16-at-12.12.09-PM.png\",\"width\":2778,\"height\":1512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=20135#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/reactivemusic.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MBTA API 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":"MBTA API 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=20135","og_locale":"en_US","og_type":"article","og_title":"MBTA API in Max - reactive music","og_description":"Sonification of Mass Ave buses, from Nubian to Harvard. Updated for Max8 and Catalina This patch requests data from MBTA API to get the current location of buses &#8211; using the Max js object. Latitude and Longitude data is mapped to oscillator pitch. Data is polled every 10 seconds, but it seems like the results &hellip; Continue reading \"MBTA API in Max\"","og_url":"https:\/\/reactivemusic.net\/?p=20135","og_site_name":"reactive music","article_published_time":"2021-02-16T17:34:57+00:00","og_image":[{"url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png","type":"","width":"","height":""}],"author":"Tom Zicarelli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tom Zicarelli","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/reactivemusic.net\/?p=20135#article","isPartOf":{"@id":"https:\/\/reactivemusic.net\/?p=20135"},"author":{"name":"Tom Zicarelli","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"headline":"MBTA API in Max","datePublished":"2021-02-16T17:34:57+00:00","mainEntityOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=20135"},"wordCount":352,"image":{"@id":"https:\/\/reactivemusic.net\/?p=20135#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png","keywords":["API","data sonification","interactive media","javascript","Max\/MSP","portfolio","programming","web development"],"articleSection":["development","interactive media art","internet-sensors","Max\/MSP"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/reactivemusic.net\/?p=20135","url":"https:\/\/reactivemusic.net\/?p=20135","name":"MBTA API in Max - reactive music","isPartOf":{"@id":"https:\/\/reactivemusic.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=20135#primaryimage"},"image":{"@id":"https:\/\/reactivemusic.net\/?p=20135#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM-300x163.png","datePublished":"2021-02-16T17:34:57+00:00","author":{"@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"breadcrumb":{"@id":"https:\/\/reactivemusic.net\/?p=20135#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/reactivemusic.net\/?p=20135"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/reactivemusic.net\/?p=20135#primaryimage","url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM.png","contentUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2021\/02\/Screen-Shot-2021-02-16-at-12.12.09-PM.png","width":2778,"height":1512},{"@type":"BreadcrumbList","@id":"https:\/\/reactivemusic.net\/?p=20135#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/reactivemusic.net\/"},{"@type":"ListItem","position":2,"name":"MBTA API 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\/20135","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=20135"}],"version-history":[{"count":1,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/20135\/revisions"}],"predecessor-version":[{"id":20137,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/20135\/revisions\/20137"}],"wp:attachment":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}