{"id":10554,"date":"2015-05-20T18:41:15","date_gmt":"2015-05-20T18:41:15","guid":{"rendered":"http:\/\/www.oracletutoring.ca\/blog\/?p=10554"},"modified":"2018-11-14T05:07:13","modified_gmt":"2018-11-14T05:07:13","slug":"web-programming-sound","status":"publish","type":"post","link":"https:\/\/www.oracletutoring.ca\/blog\/web-programming-sound\/","title":{"rendered":"Web programming:  sound"},"content":{"rendered":"<h1>The tutor discusses his recent discovery of putting sound on a web page.<\/h1>\n<p>When I program, it&#8217;s usually something new &#8211; testing a new function, illustrating the implementation of a new idea, or what have you.  The point:  often, I don&#8217;t know the scope of the problem at first, and it ends up more challenging  than expected.  (An example was when I realized the bell doesn&#8217;t work on my Linux computer; see my post <a href=\"?p=8177\">here<\/a>.)<\/p>\n<p>But statistically, wouldn&#8217;t you expect at least, that some programming problems end up simpler then expected?  Maybe not so often, but it certainly does happen, and here&#8217;s an example: putting sound on a web page.<\/p>\n<p>Perhaps going back to the workaround I developed for my Linux computer&#8217;s bell, I&#8217;ve become fascinated by sound files and how to activate them from programs.  Yesterday I wondered about activating a sound from JavaScript.  I checked around, but nothing jumped.  I came to wonder if incorporating sound on a web page is even easier than I&#8217;d thought.  Can it, I asked, just be done with a file link?  The answer turns out to be yes.<\/p>\n<p>I&#8217;m showing two ways in this post:  one with the <em>&lt;embed&gt;<\/em> tag, the other with the simple <em>&lt;a&gt;<\/em> tag.  The <em>&lt;embed&gt;<\/em> tag plays the sound spontaneously, whereas the <em>&lt;a&gt;<\/em> link you need to click to play the sound.<br \/>\n<script src=\"\/..\/javascripts\/may20.js\"><\/script><br \/>\n<button onclick=\"showembed()\" style=\"display:block;margin:auto\">click here to see embed method<\/button><\/p>\n<div id=\"holder\">\n<\/div>\n<p style=\"text-align:center\"><a href=\"\/..\/sounds\/clink.wav\" >click here for sound (&lt;a&gt; link)<\/a><\/p>\n<p>The sound you hear is a heavy spoon clinking against a heavy coffee cup.  The curious can find more about that in my <a href=\"?p=10394\">May 13<\/a> post.<\/p>\n<p>I intend to talk more about sound files.  Related topics have surfaced even during the writing of this post.<\/p>\n<p>HTH:)<\/p>\n<p>Source:<\/p>\n<p><a href=\"http:\/\/www.w3schools.com\/tags\/tag_embed.asp\">w3schools.com<\/a><\/p>\n<p>Jack of <a href=\"https:\/\/www.oracletutoring.ca\">Oracle Tutoring by Jack and Diane,<\/a> Campbell River, BC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The tutor discusses his recent discovery of putting sound on a web page. When I program, it&#8217;s usually something new &#8211; testing a new function, illustrating the implementation of a new idea, or what have you. The point: often, I &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.oracletutoring.ca\/blog\/web-programming-sound\/\"> <span class=\"screen-reader-text\">Web programming:  sound<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[823,824,822,821],"class_list":["post-10554","post","type-post","status-publish","format-standard","hentry","category-computer-science","tag-embed-tag","tag-sound-files","tag-sound-on-web-page","tag-web-programming"],"_links":{"self":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/10554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/comments?post=10554"}],"version-history":[{"count":41,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/10554\/revisions"}],"predecessor-version":[{"id":36165,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/posts\/10554\/revisions\/36165"}],"wp:attachment":[{"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/media?parent=10554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/categories?post=10554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oracletutoring.ca\/blog\/wp-json\/wp\/v2\/tags?post=10554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}