{"id":712,"date":"2013-03-12T06:41:54","date_gmt":"2013-03-12T06:41:54","guid":{"rendered":"http:\/\/aaron-sherwood.com\/blog\/?p=712"},"modified":"2022-09-23T08:16:37","modified_gmt":"2022-09-23T08:16:37","slug":"moshi-moshi-aka-wife-alert","status":"publish","type":"post","link":"https:\/\/aaron-sherwood.com\/blog\/?p=712","title":{"rendered":"Moshi Moshi (aka wife alert)"},"content":{"rendered":"<p>I have a hard time getting in touch with my wife. Usually when I call, the phone is in the other room or switched on vibrate and she hardly ever picks up. I decided to try a little more earnestly to get her attention (this may end up being really good, or really bad). I set out making what I call Moshi Moshi (Japanese for &#8216;hello&#8217; on the telephone). Now, whenever I call her, our house is filled with a warm embrace of music. She also gets an email letting her know I&#8217;m trying to reach her. We&#8217;ll see how it works out&#8230;<\/p>\n<div style=\"padding:56.25% 0 0 0;position:relative;\"><iframe src=\"https:\/\/player.vimeo.com\/video\/61599859?h=5cb59b8483&amp;title=0&amp;byline=0&amp;portrait=0\" style=\"position:absolute;top:0;left:0;width:100%;height:100%;\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture\" allowfullscreen=\"\"><\/iframe><\/div>\n<p><script src=\"https:\/\/player.vimeo.com\/api\/player.js\"><\/script><\/p>\n<p>I used Asterisk, Ruby, Sinatra, and an Arduino Due with an ethernet shield to make Moshi Moshi. When I call Kiori a Ruby script makes a post request to a Sinatra app that logs the call in a yaml file, and sends an email to her letting her know I&#8217;m calling. Every 10 seconds the Arduino is polling a web page served from the Sinatra app, which pulls data from the yaml file. If a new call comes in, a music file I created is played in our apartment from the Due (which can play audio files). There is a button on the hardware interface she can press to mute it.<\/p>\n<p><a title=\"moshi moshi (wife alert) by AaronSherwood, on Flickr\" href=\"http:\/\/www.flickr.com\/photos\/asherwood\/8551085926\/\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm9.staticflickr.com\/8252\/8551085926_e595b654f6_c.jpg\" alt=\"moshi moshi (wife alert)\" width=\"800\" height=\"534\"><\/a><br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/asherwood\/sets\/72157632978189872\/with\/8551085926\/\" style=\"text-decoration:underline\">more photos<\/a><\/p>\n<p>One of the challenging parts was actually getting the audio file to play more than once on the Due (seems like it should be simple right?). I discovered if I set the pre buffering to 0 (the examples set it to 100) then it worked fine:&nbsp;Audio.begin(88200, 0);<\/p>\n<p>Code:<br \/>\n<!--more--><\/p>\n<p><script src=\"https:\/\/gist.github.com\/aaronsherwood\/5131236.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a hard time getting in touch with my wife. Usually when I call, the phone is in the other room or switched on vibrate and she hardly ever picks up. I decided to try a little more earnestly &hellip; <a href=\"https:\/\/aaron-sherwood.com\/blog\/?p=712\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,45,3,23,38,6],"tags":[114,118,61,60,43],"class_list":["post-712","post","type-post","status-publish","format-standard","hentry","category-asterisk","category-digital-fabrication","category-itp","category-itp-group-blog","category-redial-telephony","category-web","tag-arduino","tag-asterisk","tag-due","tag-ruby","tag-telephony"],"_links":{"self":[{"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=712"}],"version-history":[{"count":9,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/712\/revisions"}],"predecessor-version":[{"id":1882,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/712\/revisions\/1882"}],"wp:attachment":[{"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aaron-sherwood.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}