{"id":4710,"date":"2013-01-07T02:01:00","date_gmt":"2013-01-07T02:01:00","guid":{"rendered":"http:\/\/zerokidz.com\/ideas\/?p=4710"},"modified":"2014-06-24T20:59:07","modified_gmt":"2014-06-25T00:59:07","slug":"conversation-with-a-robot-in-max","status":"publish","type":"post","link":"https:\/\/reactivemusic.net\/?p=4710","title":{"rendered":"Conversation with a robot in Max"},"content":{"rendered":"<p><a href=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Screen Shot 2013-01-06 at 8.55.16 PM\" src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.png\" alt=\"\" width=\"300\" height=\"167\" \/><\/a><\/p>\n<p>This project brings together several examples of API programming with Max. The pandorabots.api patch contains an example of using curl to generate an XML response file, then converts XML to JSON using a Python script. The resulting JSON file is read into Max and parsed using the [js] object.<\/p>\n<p>Here is an audio recording of my conversation (using Max) with a text chatbot named &#8216;Chomsky&#8217;<\/p>\n\t<audio id=\"wp_mep_1\"      controls=\"controls\" preload=\"none\"  >\r\n\t\t\r\n\t\t<source src=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/conversation-with-robot.mp3\" type=\"audio\/mp3\" \/>\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t<\/audio>\r\n<script type=\"text\/javascript\">\r\njQuery(document).ready(function($) {\r\n\t$('#wp_mep_1').mediaelementplayer({\r\n\t\tm:1\r\n\t\t\r\n\t\t,features: ['playpause','current','progress','duration','volume','tracks','fullscreen']\r\n\t\t,audioWidth:400,audioHeight:30\r\n\t});\r\n});\r\n<\/script>\r\n\n<div>&#8216;Chomsky&#8217; lives at\u00a0<a href=\"http:\/\/pandorabots.com\/\">http:\/\/pandorabots.com<\/a>.<\/div>\n<div><\/div>\n<p>My voice gets recorded by Max then converted to text by the Google speech-api.<\/p>\n<p>The text is passed to the Pandorabots API. The chatbot response gets spoken by the aka.speech external which uses the Mac OS built-in text-to-speech system.<\/p>\n<p>Note: T<span style=\"line-height: 1;\">he above recording was processed with a &#8216;silence truncate&#8217; effect because there were \u00a03-5 second delays between responses. In realtime it has the feel of the Houston\/Apollo dialogs.<\/span><\/p>\n<p><span style=\"line-height: 1.6;\">pandorabots-api.maxpat (which handles chatbot responses) gets text input from speech-to-google-text-api2.maxpat\u00a0&#8211; a patch that converts speech to text using the Google speech-API.<\/span><\/p>\n<div><\/div>\n<p><a href=\"https:\/\/reactivemusic.net\/?p=4690\">https:\/\/reactivemusic.net\/?p=4690<\/a><\/p>\n<p>The output (responses from chatbot) get sent to twitter-search-to-speech2.maxpat which &#8220;speaks&#8221; using the Mac OS \u00a0text-to-speech program using the aka.speech external.<\/p>\n<h3>files<\/h3>\n<p>Max<\/p>\n<ul>\n<li>speech-to-google-text-api2.maxpat<\/li>\n<li>JSON-google-speech.js<\/li>\n<li>pandorabots-api.maxpat<\/li>\n<li>JSON-pandorabot.js<\/li>\n<li>text-to-speech2.maxpat<\/li>\n<\/ul>\n<h3>externals:<\/h3>\n<ul>\n<li>[aka.speech] and [aka.shell] from\u00a0<a href=\"http:\/\/www.iamas.ac.jp\/~aka\/max\/\">http:\/\/www.iamas.ac.jp\/~aka\/max\/<\/a>\u00a0&#8211; download this external and add the folder to Options | File Preferences, in Max<\/li>\n<\/ul>\n<h3>[authorization]<\/h3>\n<ul>\n<li>none required<\/li>\n<\/ul>\n<h3>external programs:<\/h3>\n<ul>\n<li>sox: sox audio conversion program must be in the computer&#8217;s executable file path, ie., \/usr\/bin &#8211; or you can rewrite the [sprintf] input to [aka.shell] with the actual path. Get sox from:\u00a0<a href=\"http:\/\/sox.sourceforge.net\">http:\/\/sox.sourceforge.net<\/a><\/li>\n<li>xml2json (python) in tkzic\/internetsensors\/: xml2json\/xml2json.py and xml2json\/setup.py (for translating XML to JSON) &#8211; [NOTE] you will need to change the path in the [sprintf] object in pandorabots.api to point to the folder containing this python script.<\/li>\n<\/ul>\n<h3>instructions<\/h3>\n<ul>\n<li>Open the three Max patches.\n<ul>\n<li>speech-to-google-text-api2.maxpat<\/li>\n<li>pandorabots-api.maxpat<\/li>\n<li>text-to-speech2.maxpat<\/li>\n<\/ul>\n<\/li>\n<li>Clear the custid in the pandorabots-api patch<\/li>\n<li>Start audio in the Google speech patch. Then toggle the mic button and say something.<\/li>\n<li>After the first response, go to the pandorabots-api patch and click the new custid &#8211; so that the chatbot retains the thread of the conversation.<\/li>\n<\/ul>\n<h3>download:<\/h3>\n<p>The files for this project can be downloaded from the intenet-sensors archive at github<\/p>\n<p><a href=\"https:\/\/github.com\/tkzic\/internet-sensors\">https:\/\/github.com\/tkzic\/internet-sensors<\/a><\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This project brings together several examples of API programming with Max. The pandorabots.api patch contains an example of using curl to generate an XML response file, then converts XML to JSON using a Python script. The resulting JSON file is read into Max and parsed using the [js] object. Here is an audio recording of &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/reactivemusic.net\/?p=4710\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Conversation with a robot 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":[143],"tags":[161,178,46,90,6,345,190,25,176,138,137,12],"class_list":["post-4710","post","type-post","status-publish","format-standard","hentry","category-interactive-media-art","tag-api","tag-chatbot","tag-connections","tag-how-to","tag-interactive-media","tag-maxmsp","tag-portfolio","tag-programming","tag-speech","tag-speech-to-text","tag-text-to-speech","tag-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Conversation with a robot 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=4710\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Conversation with a robot in Max - reactive music\" \/>\n<meta property=\"og:description\" content=\"This project brings together several examples of API programming with Max. The pandorabots.api patch contains an example of using curl to generate an XML response file, then converts XML to JSON using a Python script. The resulting JSON file is read into Max and parsed using the [js] object. Here is an audio recording of &hellip; Continue reading &quot;Conversation with a robot in Max&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/reactivemusic.net\/?p=4710\" \/>\n<meta property=\"og:site_name\" content=\"reactive music\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-07T02:01:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-06-25T00:59:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.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=4710#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710\"},\"author\":{\"name\":\"Tom Zicarelli\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"headline\":\"Conversation with a robot in Max\",\"datePublished\":\"2013-01-07T02:01:00+00:00\",\"dateModified\":\"2014-06-25T00:59:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710\"},\"wordCount\":418,\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/01\\\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.png\",\"keywords\":[\"API\",\"chatbot\",\"connections\",\"how to\",\"interactive media\",\"Max\\\/MSP\",\"portfolio\",\"programming\",\"speech\",\"speech to text\",\"text to speech\",\"web development\"],\"articleSection\":[\"interactive media art\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710\",\"name\":\"Conversation with a robot in Max - reactive music\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/01\\\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.png\",\"datePublished\":\"2013-01-07T02:01:00+00:00\",\"dateModified\":\"2014-06-25T00:59:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/#\\\/schema\\\/person\\\/56224d281582df7e5518e037ca63e571\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/reactivemusic.net\\\/?p=4710\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#primaryimage\",\"url\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/01\\\/Screen-Shot-2013-01-06-at-8.55.16-PM.png\",\"contentUrl\":\"https:\\\/\\\/reactivemusic.net\\\/wp-content\\\/uploads\\\/2013\\\/01\\\/Screen-Shot-2013-01-06-at-8.55.16-PM.png\",\"width\":\"1172\",\"height\":\"656\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/reactivemusic.net\\\/?p=4710#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/reactivemusic.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Conversation with a robot 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":"Conversation with a robot 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=4710","og_locale":"en_US","og_type":"article","og_title":"Conversation with a robot in Max - reactive music","og_description":"This project brings together several examples of API programming with Max. The pandorabots.api patch contains an example of using curl to generate an XML response file, then converts XML to JSON using a Python script. The resulting JSON file is read into Max and parsed using the [js] object. Here is an audio recording of &hellip; Continue reading \"Conversation with a robot in Max\"","og_url":"https:\/\/reactivemusic.net\/?p=4710","og_site_name":"reactive music","article_published_time":"2013-01-07T02:01:00+00:00","article_modified_time":"2014-06-25T00:59:07+00:00","og_image":[{"url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.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=4710#article","isPartOf":{"@id":"https:\/\/reactivemusic.net\/?p=4710"},"author":{"name":"Tom Zicarelli","@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"headline":"Conversation with a robot in Max","datePublished":"2013-01-07T02:01:00+00:00","dateModified":"2014-06-25T00:59:07+00:00","mainEntityOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=4710"},"wordCount":418,"image":{"@id":"https:\/\/reactivemusic.net\/?p=4710#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.png","keywords":["API","chatbot","connections","how to","interactive media","Max\/MSP","portfolio","programming","speech","speech to text","text to speech","web development"],"articleSection":["interactive media art"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/reactivemusic.net\/?p=4710","url":"https:\/\/reactivemusic.net\/?p=4710","name":"Conversation with a robot in Max - reactive music","isPartOf":{"@id":"https:\/\/reactivemusic.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/reactivemusic.net\/?p=4710#primaryimage"},"image":{"@id":"https:\/\/reactivemusic.net\/?p=4710#primaryimage"},"thumbnailUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM-300x167.png","datePublished":"2013-01-07T02:01:00+00:00","dateModified":"2014-06-25T00:59:07+00:00","author":{"@id":"https:\/\/reactivemusic.net\/#\/schema\/person\/56224d281582df7e5518e037ca63e571"},"breadcrumb":{"@id":"https:\/\/reactivemusic.net\/?p=4710#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/reactivemusic.net\/?p=4710"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/reactivemusic.net\/?p=4710#primaryimage","url":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM.png","contentUrl":"https:\/\/reactivemusic.net\/wp-content\/uploads\/2013\/01\/Screen-Shot-2013-01-06-at-8.55.16-PM.png","width":"1172","height":"656"},{"@type":"BreadcrumbList","@id":"https:\/\/reactivemusic.net\/?p=4710#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/reactivemusic.net\/"},{"@type":"ListItem","position":2,"name":"Conversation with a robot 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\/4710","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=4710"}],"version-history":[{"count":28,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/4710\/revisions"}],"predecessor-version":[{"id":16729,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=\/wp\/v2\/posts\/4710\/revisions\/16729"}],"wp:attachment":[{"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/reactivemusic.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}