MacOS Text to Audio Scheduling Tutorial

MacOS Text to Audio Scheduling Tutorial

MacOS Text to Audio Scheduling Tutorial

Way back when MacOS Text to Audio Primer Tutorial introduced our changed inhouse macos_say_record.php MacOS Text to Audio online PHP supervisor in its initial form, using PHP exec conduit to the macOS command line say command.

Since then, its “brief” has changed a lot, but with today’s work we go back to that macOS thinking, allowing a user who downloads the source code and places it into the $_SERVER[‘DOCUMENT_ROOT’] ( typically MAMP‘s /Applications/MAMP/htdocs/macos_say_record.php ) of their macOS local web server ( typically MAMP ) and accessing it via the address bar URL ( typically MAMP‘s HTTP://localhost:8888/macos_say_record.php ) to interface to …

… command scheduling functionality. Why? Well, today’s tutorial picture gives us a hint (for future directions here), as well as the fact that a macOS user may be interested in a regularly repeating piece of audio to be played at a particular time … exactly down crontab’s alley.

Previous relevant MacOS Text to Audio Primer Tutorial is shown below.

MacOS Text to Audio Primer Tutorial

MacOS Text to Audio Primer Tutorial

The previous Mac OS X Text to English Speech Primer Tutorial

  • lauded the …

    Text to English Speech via Mac OS X’s command line say command

  • and today we write some PHP (with its very useful exec conduit to “say”) to make use of the same (macOS) “say” and its Text to Audio talents (via its “-o” switch usage)

… and it’s at times like this we wish that the RJM Programming domain’s web server had a macOS operating system. Alas, “say” is a macOS and Mac OS X application, but not a Linux one.

None the less, we integrated …

… so that if you had a MAMP local Apache/PHP/MySql web server going, and you …

  • downloaded tutorial_to_animated_gif.php to same MAMP subdirectory as …
  • downloaded haiku_animated_gif.html to same MAMP place (which can be the same MAMP document root place as talked about below, in which case HTTP://localhost:8888/haiku_animated_gif.html is what you’d type into the web browser address bar to try this for yourself on a macOS or Mac OS X system) … and …
  • downloaded macos_say_record.php to MAMP document root (for us, equating to URL HTTP://localhost:8888/macos_say_record.php)

… then you would be in the position to see a Haiku creation scenario (where we used the Safari web browser) like with today’s tutorial picture, interesting, in our view, regarding the integration “tactics” …

  • parent Haiku window opens …
  • child (popup) PHP “say” helper web application … which …
  • passes back to parent …


… achieving functionality we often ask HTML iframe elements achieve for our code. HTML iframe does have a role today, though. It uses a favoured “client pre-emptive iframe” approach to determine whether we even try to open that popup window above via …

  • HTML …

    <div id=dif></div>
  • Javascript …

    var mampok=false, mampprefix='';

    if (document.URL.indexOf('/localhost') != -1) {
    mampprefix="HTTP://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/";
    document.getElementById('dif').innerHTML="<iframe onload='oicheck(this);' style='display:none;' src='HTTP://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/'></iframe>";

    function oicheck(iois) {
    if (iois != null) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
    if (aconto.document) { aconto = aconto.document; }
    if (aconto.body != null) {
    if (aconto.body.innerHTML.toLowerCase().indexOf('>not found<') == -1 && aconto.body.innerHTML.toLowerCase().indexOf("our home page for your perusal") == -1) { mampok=true; }

    // and then later when the textarea has text and its onblur event is triggered ...
    if (mampok) {
    if (wois) { wois.close(); wois=null; } + "macos_say_record.php?saythis=" + encodeURIComponent(document.getElementById('myta').value),"_blank","top=460,left=400,width=700,height=400");

  • Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.

    Mac OS X Text to English Speech Primer Tutorial

    Mac OS X Text to English Speech Primer Tutorial

    We’ve got a few new ideas today …

    1. Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
    2. Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
    3. Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday

    Along the way we tried filming the MacBook Pro with the iPad to a YouTube

    … but weren’t happy with the audio quality, alas (too/two).

    If this was interesting you may be interested in this too.

    If this was interesting you may be interested in this too.

    If this was interesting you may be interested in this too.

This entry was posted in eLearning, Event-Driven Programming, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>