{"id":49544,"date":"2020-07-03T03:01:51","date_gmt":"2020-07-02T17:01:51","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=49544"},"modified":"2020-07-03T14:43:27","modified_gmt":"2020-07-03T04:43:27","slug":"macos-text-to-audio-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/macos-text-to-audio-primer-tutorial\/","title":{"rendered":"MacOS Text to Audio Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"MacOS Text to Audio Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku__say.jpg\" title=\"MacOS Text to Audio Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">MacOS Text to Audio Primer Tutorial<\/p><\/div>\n<p>The previous <a title='Mac OS X Text to English Speech Primer Tutorial' href='#mosxtespt'>Mac OS X Text to English Speech Primer Tutorial<\/a> &#8230;<\/p>\n<ul>\n<li>lauded the &#8230;<br \/>\n<blockquote cite='\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-text-to-english-speech-primer-tutorial\/'><p>\nText to English Speech via Mac OS X&#8217;s command line <a target=_blank title='say command information from Apple' href='https:\/\/ss64.com\/osx\/say.html'><i>say<\/i><\/a> command\n<\/p><\/blockquote>\n<\/li>\n<li>and today we write some PHP (with its very useful <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> conduit to &#8220;say&#8221;) to make use of the same (macOS) &#8220;say&#8221; and its Text to Audio talents (via its &#8220;-o&#8221; switch usage)<\/li>\n<\/ul>\n<p> &#8230; and it&#8217;s at times like this we wish that the RJM Programming domain&#8217;s web server had a macOS operating system.  Alas, &#8220;say&#8221; is a macOS and Mac OS X application, but not a Linux one.<\/p>\n<p>None the less, we integrated &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html--GETME\" title=\"haiku_animated_gif.html\">today&#8217;s changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html--GETME\">haiku_animated_gif.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html\">Haiku creation and sharing web application live run<\/a> link&#8217;s workings (last talked about at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/haiku-animated-gif-creator-tutorial\/' title='Haiku Animated Gif Creator Tutorial'>Haiku Animated Gif Creator Tutorial<\/a>) with &#8230;<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_say_record.php_GETME\" title=\"macos_say_record.php\">macos_say_record.php<\/a> macOS &#8220;say&#8221; PHP helper<\/li>\n<\/ul>\n<p> &#8230; so that if you had a <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'><i>MAMP<\/i><\/a> local Apache\/PHP\/MySql web server going, and you &#8230;<\/p>\n<ul>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/tutorial_to_animated_gif.php---------------GETME\" title=\"tutorial_to_animated_gif.php\">tutorial_to_animated_gif.php<\/a> to same MAMP subdirectory as &#8230;<\/li>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku_animated_gif.html--GETME\">haiku_animated_gif.html<\/a> to same MAMP place (which can be the same MAMP document root place as talked about below, in which case <i>HTTP:\/\/localhost:8888\/haiku_animated_gif.html<\/i> is what you&#8217;d type into the web browser address bar to try this for yourself on a macOS or Mac OS X system) &#8230; and &#8230;<\/li>\n<li>downloaded <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/macos_say_record.php_GETME\" title=\"macos_say_record.php\">macos_say_record.php<\/a> to MAMP document root (for us, equating to URL <i>HTTP:\/\/localhost:8888\/macos_say_record.php<\/i>)<\/li>\n<\/ul>\n<p> &#8230; then you would be in the position to see a Haiku creation scenario (where we used the Safari web browser) like with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/animegif\/haiku__say.jpg\" title=\"tutorial picture\">tutorial picture<\/a>, interesting, in our view, regarding the integration &#8220;tactics&#8221; &#8230;<\/p>\n<ul>\n<li>parent Haiku window opens &#8230;<\/li>\n<li>child (popup) PHP &#8220;say&#8221; helper web application &#8230; which &#8230;<\/li>\n<li>passes back to parent &#8230;<br \/>\n<code><br \/>\n    <a target=_blank title='window.opener information from W3Schools' href='https:\/\/www.w3schools.com\/jsref\/prop_win_opener.asp'>window.opener<\/a>.document.getElementById('aurl').value=document.getElementById('result').value;<br \/>\n    window.opener.atab(window.opener.document.getElementById('aurl'));<br \/>\n<\/code>\n<\/li>\n<\/ul>\n<p> &#8230; achieving functionality we often ask HTML <a target=_blank title='HTML iframe information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> elements achieve for our code.  HTML iframe does have a role today, though.  It uses a favoured &#8220;client pre-emptive iframe&#8221; approach to determine whether we even try to open that popup window above via &#8230;<\/p>\n<ul>\n<li>HTML &#8230;<br \/>\n<code><br \/>\n&lt;div id=dif&gt;&lt;\/div&gt;<br \/>\n<\/code>\n<\/li>\n<li>Javascript &#8230;<br \/>\n<code><br \/>\n     var mampok=false, mampprefix='';<br \/>\n<br \/>\n     if (document.URL.indexOf('\/localhost') != -1) {<br \/>\n       mampprefix=\"http:\/\/localhost\" + document.URL.split('\/localhost')[1].split('\/')[0] + \"\/\";<br \/>\n       document.getElementById('dif').innerHTML=\"&lt;iframe onload='oicheck(this);' style='display:none;' src='http:\/\/localhost\" + document.URL.split('\/localhost')[1].split('\/')[0] + \"\/'&gt;&lt;\/iframe&gt;\";<br \/>\n     }<br \/>\n<br \/>\n function oicheck(iois) {<br \/>\n  mampok=false;<br \/>\n  if (iois != null) {<br \/>\n    var aconto = (iois.contentWindow || iois.contentDocument);<br \/>\n    if (aconto != null) {<br \/>\n     if (aconto.document) { aconto = aconto.document; }<br \/>\n     if (aconto.body != null) {<br \/>\n      if (aconto.body.innerHTML.toLowerCase().indexOf('&gt;not found&lt;') == -1 && aconto.body.innerHTML.toLowerCase().indexOf(\"our home page for your perusal\") == -1) { mampok=true; }<br \/>\n     }<br \/>\n    }<br \/>\n  }<br \/>\n }<br \/>\n<br \/>\n\/\/ and then later when the textarea has text and its onblur event is triggered ...<br \/>\n if (mampok) {<br \/>\n if (wois) { wois.close(); wois=null; }<br \/>\n wois=window.open(mampprefix + \"macos_say_record.php?saythis=\" + encodeURIComponent(document.getElementById('myta').value),\"_blank\",\"top=460,left=400,width=700,height=400\");<br \/>\n }<br \/>\n<\/code>\n<\/li>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=_blank  href='\/\/www.rjmprogramming.com.au\/ITblog\/macos-text-to-audio-primer-tutorial\/'>MacOS Text to Audio Primer Tutorial<\/a>.<\/p-->\n<hr>\n<p id='mosxtespt'>Previous relevant <a target=_blank title='Mac OS X Text to English Speech Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-text-to-english-speech-primer-tutorial\/'>Mac OS X Text to English Speech Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html?clickit=submitmb\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Mac OS X Text to English Speech Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/say.jpg\" title=\"Mac OS X Text to English Speech Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Mac OS X Text to English Speech Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve got a few new ideas today &#8230;<\/p>\n<ol>\n<li>Text to English Speech via Mac OS X&#8217;s command line <a target=_blank title='say command information from Apple' href='https:\/\/ss64.com\/osx\/say.html'><i>say<\/i><\/a> command used by PHP via <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> to make <a target=_blank title='say.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/say.php_GETME'>say.php<\/a> (which is useful as a download to a Mac OS X laptop using <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a>) which, today, does not have a live run because the web server of domain <i>rjmprogramming.com.au<\/i> is a CentOS Linux server &#8230; Linux equivalent of Mac OS X&#8217;s <i>say<\/i>? &#8230; read <a target=_blank title='Useful link' href='https:\/\/github.com\/usc-isi-i2\/festival-text-to-speech-service\/blob\/master\/README.md'>here<\/a><\/li>\n<li>Trying to present this brought up the usual movie production problem with <a target=_blank title='iMovie for Mac information from Apple' href='http:\/\/www.apple.com\/au\/mac\/imovie\/'>iMovie<\/a> overlaying the audio on top of the video (though you may want to try, and you could start reading with <a target=_blank title='Semi useful link' href='http:\/\/video.stackexchange.com\/questions\/2579\/can-you-link-an-audio-track-to-a-video-track-in-imovie'>this link<\/a>) versus <a target=_blank title='QuickTime information from Apple' href='https:\/\/support.apple.com\/downloads\/quicktime'>QuickTime Player<\/a> talent to catch both audio and video tracks (and that we ended up using), but not of the &#8220;screen goings on&#8221;, alas versus <a target=_blank title='MPlayer OSX Extended information' href='http:\/\/mplayerosx.ch\/'>MPlayer OSX Extended<\/a> which can play separately but not two tracks on top and doesn&#8217;t do any reconstituting &#8230; so &#8230;<\/li>\n<li>Improved on our inhouse Video\/Audio synchronizing efforts by allowing <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>audio_video.html<\/a> supervisor (changed in <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>this way<\/a>) be able to be called to press one of its preconceived synchronization buttons <i>onload<\/i> which we do with (the newly added) <a target=_blank title='Macbeth Act 1 Scene 1' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html?clickit=submitmb'>Macbeth Act 1 Scene 1<\/a> &#8230; in a small <a target=_blank title='Birthday of Shakespeare' href='http:\/\/www.shakespeare.org.uk\/visit-the-houses\/whats-on.html\/birthday-celebrations.html'>celebration<\/a> of the Bard &#8230; who, am thinking (in that Falstaff way), would have got a huge chuckle out of &#8220;anonymous&#8221; instead of &#8220;anon&#8221; during the Three Witches scene &#8230; we <i>had<\/i> to do something to say Happy Birthday<\/li>\n<\/ol>\n<p>Along the way we tried filming the MacBook Pro with the iPad to a <a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> &#8230;<\/p>\n<p><iframe loading=\"lazy\" width=\"420\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/9-Hvlz8g1Mg\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p> &#8230; but weren&#8217;t happy with the audio quality, alas (too\/two).<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d21904' onclick='var dv=document.getElementById(\"d21904\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/text-to-speech\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21904' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d49544' onclick='var dv=document.getElementById(\"d49544\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/audio\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d49544' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The previous Mac OS X Text to English Speech Primer Tutorial &#8230; lauded the &#8230; Text to English Speech via Mac OS X&#8217;s command line say command and today we write some PHP (with its very useful exec conduit to &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/macos-text-to-audio-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[113,3349,405,587,714,725,2178,744,760,885,932,967,997,1083,2350,3350,1258,1262,1319,1411,1583,1433,3010],"class_list":["post-49544","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-audio","tag-client-pre-emptive-iframe","tag-exec","tag-iframe","tag-local-web-server","tag-mac-os-x","tag-macos","tag-mamp","tag-media","tag-operating-system-2","tag-php","tag-popup","tag-programming","tag-safari","tag-say","tag-text-to-audio","tag-text-to-speech","tag-textarea","tag-tutorial","tag-web-server","tag-window","tag-window-open","tag-window-opener"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49544"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=49544"}],"version-history":[{"count":11,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49544\/revisions"}],"predecessor-version":[{"id":49556,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/49544\/revisions\/49556"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=49544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=49544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=49544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}