{"id":1791,"date":"2011-09-24T21:01:55","date_gmt":"2011-09-24T21:01:55","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=1791"},"modified":"2017-03-14T21:43:30","modified_gmt":"2017-03-14T21:43:30","slug":"making-a-birthday-e-card","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=1791","title":{"rendered":"Making a birthday e-card"},"content":{"rendered":"<p>Today is <a href=\"http:\/\/www.cookingcakesandchildren.com\/\">Amy&#8217;s<\/a> birthday &#8211; which means that I&#8217;ve been helping the kids with present making.<\/p>\n<p><a href=\"https:\/\/picasaweb.google.com\/dale.lane\">Grace&#8217;s<\/a> idea for a homemade birthday card was particularly geeky, so I thought it was worth a quick post. <\/p>\n<p>The idea was that she&#8217;d design an e-card, and record a variety of voice clips, which would be played when you clicked on various bits of the card. She did after-school French lessons last term, and she hears some Greek from my mum, so she&#8217;s kind of interested in the idea of other languages. So we came up with the idea of a card with a Happy Birthday message in lots of different languages. <\/p>\n<p>It turned out that my multi-lingual efforts to assist her were a bit lame, so I convinced her to scale it down from &#8220;Happy Birthday&#8221; in dozens of languages to &#8220;I love you&#8221; in nine langauges. We settled on a design with a bunch of flags &#8211; clicking on a flag plays Grace&#8217;s voice saying &#8220;I love you&#8221; in that language. <\/p>\n<p>It looked like this, but click through <a href=\"http:\/\/dalelane.co.uk\/drpbx\/20110924\/index.html\">here for the live version<\/a>. <\/p>\n<p><a href=\"http:\/\/www.flickr.com\/photos\/dalelane\/6178938132\/\" title=\"flagscard by dalelane, on Flickr\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm7.static.flickr.com\/6166\/6178938132_c663ba030d.jpg\" width=\"450\" height=\"318\" alt=\"flagscard\"\/><\/a><\/p>\n<p>It was pretty simple, but I thought I&#8217;d share a few comments about how we did it. <\/p>\n<p><!--more-->The voice clips were recorded using <a href=\"http:\/\/audacity.sourceforge.net\/\">audacity<\/a> &#8211; which also handled exporting it to the various formats (ogg, mp3, wav) to keep various browsers happy.<\/p>\n<p><a href=\"http:\/\/www.forvo.com\/\">Forvo<\/a> was invaluable with getting the pronunciation right (ish). You can find audio clips of words in loads of languages, recorded by several different speakers. For example, we found <a href=\"http:\/\/www.forvo.com\/word\/jag_%C3%A4lskar_dig\/\">a page with two recordings of the Swedish for &#8220;I love you&#8221;<\/a>. Grace listened to these several times before recording her own. It&#8217;s a very neat little site &#8211; both in the community-driven way that the pronunciations are recorded, as well as the way the page is implemented with neat inline play buttons that just worked. <\/p>\n<p>Grace&#8217;s original idea for the card involved making a proper web page, with animated bits moving around. Again\u00e2\u20ac\u00a6 I had to convince her to scale it down &#8211; she&#8217;s only six, so I wasn&#8217;t sure she&#8217;d pick up enough web dev skills in time for Amy&#8217;s birthday! \ud83d\ude42 <\/p>\n<p>We settled on her drawing her design for the card on paper, then I scanned it in as a large graphic, and used an <a href=\"http:\/\/en.wikipedia.org\/wiki\/Image_map\">HTML image map<\/a> to identify the flags and make them clickable. <\/p>\n<p>Playing the sound recordings is ridiculously easy now in the age of HTML5. (Remember, that we didn&#8217;t need to support a wide range of browsers &#8211; we needed something that would work on Amy&#8217;s computer, so it&#8217;s a pretty narrow target.) <\/p>\n<p>Each audio recording was defined like this:<\/p>\n<pre style=\"border: thin solid silver; background-color: #eeeeee; padding: 0.7em; font-size: 1.1em; overflow: auto;\">&lt;audio id=\"english\" preload=\"auto\"&gt;\r\n    &lt;source src=\"sounds\/english.ogg\" type=\"audio\/ogg\"\/&gt;\r\n    &lt;source src=\"sounds\/english.mp3\" type=\"audio\/mpeg\" \/&gt;\r\n&lt;\/audio&gt;<\/pre>\n<p>Between ogg and mp3 files, that covers the bases for most recent browsers &#8211; a browser should just use the first one in the list that it can cope with. <\/p>\n<p>Then you can play it with a little bit of JavaScript:<\/p>\n<pre style=\"border: thin solid silver; background-color: #eeeeee; padding: 0.7em; font-size: 1.1em; overflow: auto;\">document.getElementById(\"english\").play();<\/pre>\n<p>Finally, so that Amy could keep a copy of it on her computer without needing to be online, I used offline storage.<\/p>\n<p>This means starting the web page with:<\/p>\n<pre style=\"border: thin solid silver; background-color: #eeeeee; padding: 0.7em; font-size: 1.1em; overflow: auto;\">&lt;!DOCTYPE HTML&gt;\r\n&lt;html manifest=\"cache.manifest\"&gt;<\/pre>\n<p>And creating a <a href=\"http:\/\/dalelane.co.uk\/drpbx\/20110924\/cache.manifest\">cache.manifest<\/a> file with a list of all the files that are used in the page. <\/p>\n<p>That was pretty much it. Grace enjoyed making it. She&#8217;s clearly turning into a massive geek, but at least she&#8217;s a creative geek. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today is Amy&#8217;s birthday &#8211; which means that I&#8217;ve been helping the kids with present making. Grace&#8217;s idea for a homemade birthday card was particularly geeky, so I thought it was worth a quick post. The idea was that she&#8217;d design an e-card, and record a variety of voice clips, which would be played when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,328],"tags":[],"class_list":["post-1791","post","type-post","status-publish","format-standard","hentry","category-code","category-kids"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1791","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1791"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1791\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}