"; $sayprefix=""; $langsuffix=""; $voicecode=""; $voicesrest=""; $defvoice=""; $retdefvoice=""; $langcode=""; $bestext="aiff"; if (isset($_GET['saythis'])) { $tastuff=str_replace("+"," ",urldecode($_GET['saythis'])); } else if (isset($_GET['saythis'])) { $tastuff=str_replace("+"," ",urldecode($_POST['saythis'])); } $types = ["audio/x-m4r","audio/wav","audio/x-wav","audio/x-pn-realaudio","audio/x-mpegurl","audio/x-aiff","audio/mpeg","audio/mid", "audio/basic","audio/ogg","video/x-sgi-movie","video/x-msvideo","video/quicktime","audio/mp3","video/mp4","video/mpeg", "video/x-la-asf","video/ogg","video/webm","audio/mp4", "image/jpeg", "image/jpeg", "image/png", "image/gif", "image/bmp", "image/tif", "text/html", "text/html", "text/html", "text/javascript", "text/css", "text/plain", "text/xml", "text/csv", "application/vnd.ms-word", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/x-php", "application/pdf", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.ms-powerpoint", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]; $exts = [".m4r",".wav",".wav",".ram",".m3u",".aiff",".mp3",".rmi", ".snd",".ogg",".movie",".avi",".mov",".mp3",".m4v",".mpeg", ".lsx",".ogv",".webm",".m4a", ".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tif", ".htm", ".html", ".htmls", ".js", ".css", ".txt", ".xml", ".csv", ".doc", ".docx", ".php", ".pdf", ".pptx", ".ppt", ".xls", ".xlsx"]; $sayvoices="Alex en_US # Most people recognize me by my voice. Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana. Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst. Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne. Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme. Carmit he_IL # שלום. קוראים לי כרמית, ואני קול בשפה העברית. Damayanti id_ID # Halo, nama saya Damayanti. Saya berbahasa Indonesia. Daniel en_GB # Hello, my name is Daniel. I am a British-English voice. Diego es_AR # Hola, me llamo Diego y soy una voz española. Ellen nl_BE # Hallo, mijn naam is Ellen. Ik ben een Belgische stem. Fiona en_scotland # Hello, my name is Fiona. I am a Scottish-English voice. Fred en_US # I sure like being inside this fancy computer Ioana ro_RO # Bună, mă cheamă Ioana . Sunt o voce românească. Joana pt_PT # Olá, chamo-me Joana e dou voz ao português falado em Portugal. Jorge es_ES # Hola, me llamo Jorge y soy una voz española. Juan es_MX # Hola, me llamo Juan y soy una voz mexicana. Kanya th_TH # สวัสดีค่ะ ดิฉันชื่อKanya Karen en_AU # Hello, my name is Karen. I am an Australian-English voice. Kyoko ja_JP # こんにちは、私の名前はKyokoです。日本語の音声をお届けします。 Laura sk_SK # Ahoj. Volám sa Laura . Som hlas v slovenskom jazyku. Lekha hi_IN # नमस्कार, मेरा नाम लेखा है. मैं हिन्दी में बोलने वाली आवाज़ हूँ. Luca it_IT # Salve, mi chiamo Luca e sono una voce italiana. Luciana pt_BR # Olá, o meu nome é Luciana e a minha voz corresponde ao português que é falado no Brasil Maged ar_SA # مرحبًا اسمي Maged. أنا عربي من السعودية. Mariska hu_HU # Üdvözlöm! Mariska vagyok. Én vagyok a magyar hang. Mei-Jia zh_TW # 您好,我叫美佳。我說國語。 Melina el_GR # Γεια σας, ονομάζομαι Melina. Είμαι μια ελληνική φωνή. Milena ru_RU # Здравствуйте, меня зовут Milena. Я – русский голос системы. Moira en_IE # Hello, my name is Moira. I am an Irish-English voice. Monica es_ES # Hola, me llamo Monica y soy una voz española. Nora nb_NO # Hei, jeg heter Nora. Jeg er en norsk stemme. Paulina es_MX # Hola, me llamo Paulina y soy una voz mexicana. Samantha en_US # Hello, my name is Samantha. I am an American-English voice. Sara da_DK # Hej, jeg hedder Sara. Jeg er en dansk stemme. Satu fi_FI # Hei, minun nimeni on Satu. Olen suomalainen ääni. Sin-ji zh_HK # 您好,我叫 Sin-ji。我講廣東話。 Tessa en_ZA # Hello, my name is Tessa. I am a South African-English voice. Thomas fr_FR # Bonjour, je m’appelle Thomas. Je suis une voix française. Ting-Ting zh_CN # 您好,我叫Ting-Ting。我讲中文普通话。 Veena en_IN # Hello, my name is Veena. I am an Indian-English voice. Victoria en_US # Isn't it nice to have a computer that will talk to you? Xander nl_NL # Hallo, mijn naam is Xander. Ik ben een Nederlandse stem. Yelda tr_TR # Merhaba, benim adım Yelda. Ben Türkçe bir sesim. Yuna ko_KR # 안녕하세요. 제 이름은 Yuna입니다. 저는 한국어 음성입니다. Yuri ru_RU # Здравствуйте, меня зовут Yuri. Я – русский голос системы. Zosia pl_PL # Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego. Zuzana cs_CZ # Dobrý den, jmenuji se Zuzana. Jsem český hlas. "; // Define default language. $GLOBALS['_DLANG']='en'; // Define all available languages. // WARNING: uncomment all available languages $GLOBALS['_LANG'] = array( 'af-Afrikaans', // afrikaans. 'ar-Arabic', // arabic. 'bg-Bulgarian', // bulgarian. 'ca-Catalan', // catalan. 'cs-Czech', // czech. 'da-Danish', // danish. 'de-German', // german. 'el-Greek', // greek. 'en-English', // english. 'es-Spanish', // spanish. 'et-Estonian', // estonian. 'fi-Finnish', // finnish. 'fr-French', // french. 'gl-Galician', // galician. 'he-Hebrew', // hebrew. 'hi-Hindi', // hindi. 'hr-Croatian', // croatian. 'hu-Hungarian', // hungarian. 'id-Indonesian', // indonesian. 'it-Italian', // italian. 'ja-Japanese', // japanese. 'ko-Korean', // korean. 'ka-Georgian', // georgian. 'lt-Lituanian', // lithuanian. 'lv-Latvian', // latvian. 'ms-Malay', // malay. 'nl-Dutch', // dutch. 'no-Norwegian', // norwegian. 'pl-Polish', // polish. 'pt-Portuguese', // portuguese. 'ro-Romanian', // romanian. 'ru-Russian', // russian. 'sk-Slovak', // slovak. 'sl-Slovenian', // slovenian. 'sq-Albanian', // albanian. 'sr-Serbian', // serbian. 'sv-Swedish', // swedish. 'th-Thai', // thai. 'tr-Turkish', // turkish. 'uk-Ukrainian', // ukrainian. 'zh-Chinese' // chinese. ); // Detect language from user agent browser ... thanks to https://stackoverflow.com/questions/3770513/detect-browser-language-in-php function lixlpixel_get_env_var($Var) { global $GLOBALS, $langrest; if (empty($GLOBALS[$Var])) { $GLOBALS[$Var]=(!empty($GLOBALS['_SERVER'][$Var]))? $GLOBALS['_SERVER'][$Var] : (!empty($GLOBALS['HTTP_SERVER_VARS'][$Var])) ? $GLOBALS['HTTP_SERVER_VARS'][$Var]:''; } } function lixlpixel_detect_lang($defl) { global $GLOBALS, $langrest, $sayvoices, $voicecode, $voicesrest, $tastuff, $defvoice, $retdefvoice; $voicesprefix=""; $voicessuffix=""; $selected=" selected"; $M=""; // Detect HTTP_ACCEPT_LANGUAGE & HTTP_USER_AGENT. lixlpixel_get_env_var('HTTP_ACCEPT_LANGUAGE'); lixlpixel_get_env_var('HTTP_USER_AGENT'); $_AL=strtolower($GLOBALS['HTTP_ACCEPT_LANGUAGE']); $_UA=strtolower($GLOBALS['HTTP_USER_AGENT']); if ("$_AL" == "" && "$_UA" == "") { $_AL=strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']); $_UA=strtolower($_SERVER['HTTP_USER_AGENT']); } if ($defl != "") { $_AL=strtolower($defl); $_UA=strtolower($defl); } // Try to detect Primary language if several languages are accepted. foreach ($GLOBALS['_LANG'] as $K) { $sayps=explode(" " . strtolower(explode("-", $K)[0]) . "_", $sayvoices); if (strpos($_AL, explode("-", $K)[0]) === 0) { if (sizeof($sayps) > 1) { for ($ii=1; $ii" . $thisname . " " . $thisnuance . " " . $thisdefwords . ""; if ($defvoice == ($thisnuance . " " . $thisname)) { $tastuff=$thisdefwords; } if ($voicecode == "") { if ($defvoice != "") { $voicecode=$defvoice; } else { $voicecode=$thisnuance . " " . $thisname; $retdefvoice=$thisdefwords; } } $selected=""; } } $langrest.=""; $M=$K; } else { if (sizeof($sayps) > 1) { for ($ii=1; $ii" . $thisname . " " . $thisnuance . " " . $thisdefwords . ""; } } $langrest.=""; } } $voicesrest=$voicesprefix . $voicessuffix; if ("$M" != "") { return $M; } // Try to detect any language if not yet detected. foreach ($GLOBALS['_LANG'] as $K) { if (strpos($_AL, explode("-", $K)[0]) !== false) { return $K; } } foreach ($GLOBALS['_LANG'] as $K) { //if(preg_match("/[[( ]{$K}[;,_-)]/",$_UA)) // matching other letters (create an error for seo spyder) return $K; } // Return default language if language is not yet detected. return $GLOBALS['_DLANG']; } function bestis() { global $bestext; $bestext = "aiff"; $ua = strtolower($_SERVER['HTTP_USER_AGENT']); // you can add different browsers with the same way .. if (preg_match('/(chromium)[ \/]([\w.]+)/', $ua)) $bestext = 'm4a'; elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua)) $bestext = 'm4a'; elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua)) $bestext = 'aiff'; elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua)) $bestext = 'm4a'; elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua)) $bestext = 'm4a'; elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua)) $bestext = 'm4a'; return $bestext; } if (isset($_GET['thevoice']) || isset($_POST['thevoice']) || isset($_GET['thelang']) || isset($_POST['thelang'])) { if (isset($_GET['thevoice'])) { $defvoice=str_replace("+"," ",urldecode($_GET['thevoice'])); } else if (isset($_POST['thevoice'])) { $defvoice=str_replace("+"," ",urldecode($_POST['thevoice'])); } if (isset($_GET['thelang'])) { $langcode=urldecode($_GET['thelang']); } else if (isset($_POST['thelang'])) { $langcode=urldecode($_POST['thelang']); } else if (isset($_GET['thevoice'])) { $langcode=explode("_",urldecode($_GET['thevoice']))[0]; } else if (isset($_POST['thevoice'])) { $langcode=explode("_",urldecode($_POSTT['thevoice']))[0]; } $langcode = lixlpixel_detect_lang($langcode); //insert lang var system in a new var for conditional statement $langrest=str_replace(" selected", "", $langrest); if (isset($_GET['thelang'])) { $langcode=urldecode($_GET['thelang']); $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } else if (isset($_POST['thelang'])) { $langcode=urldecode($_POST['thelang']); $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } else if (isset($_GET['thevoice'])) { $langcode=explode("_",urldecode($_GET['thevoice']))[0]; $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } else if (isset($_POST['thevoice'])) { $langcode=explode("_",urldecode($_POSTT['thevoice']))[0]; $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } if (isset($_GET['thevoice'])) { $voicesrest=str_replace(" selected", "", $voicesrest); $voicecode=str_replace("+"," ",urldecode($_GET['thevoice'])); $voicesrest=str_replace("'" . $voicecode . "'", "'" . $voicecode . "' selected", $voicesrest); //echo $voicecode . " " . $voicesrest; //exit; $sayprefix=" -v " . trim(explode(" ",$voicecode)[1]) . ""; } else if (isset($_POST['thevoice'])) { $voicesrest=str_replace(" selected", "", $voicesrest); $voicecode=str_replace("+"," ",urldecode($_POST['thevoice'])); $voicesrest=str_replace("'" . $voicecode . "'", "'" . $voicecode . "' selected", $voicesrest); //echo $voicecode . " " . $voicesrest; //exit; $sayprefix=" -v " . trim(explode(" ",$voicecode)[1]) . ""; } } else if (isset($_GET['thelang']) || isset($_POST['thelang'])) { $langcode = lixlpixel_detect_lang($langcode); //insert lang var system in a new var for conditional statement $langrest=str_replace(" selected", "", $langrest); if (isset($_GET['thelang'])) { $langcode=urldecode($_GET['thelang']); $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } else { $langcode=urldecode($_POSTT['thelang']); $langrest=str_replace("'" . $langcode . "'", "'" . $langcode . "' selected", $langrest); } } else { // Thanks to // Redirect to the correct location. // Example Implementation aff var lang to name file /* echo 'The Language detected is: '.lixlpixel_detect_lang(); // For Demonstration echo "
"; */ $langcode = lixlpixel_detect_lang($langcode); //insert lang var system in a new var for conditional statement //echo "
"; //echo $lang_var; // print var for trace //echo "
"; //exit; } $sayps=explode(" " . strtolower($langcode) . "_", $sayvoices); if (sizeof($sayps) > 1) { if ($sayprefix == "") { $sayprefix=" -v " . trim(explode("#", $sayps[0])[-1 + sizeof(explode("#", $sayps[0]))]) . ""; } } $langsuffix='thelang=' . urlencode($langcode) . '&thevoice=' . urlencode($voicecode) . '&'; $htmltop=""; //$langchange=" lang='" . urldecode($langcode) . "'>"; if ($tastuff == "" && $retdefvoice != "") { $tastuff=$retdefvoice; } bestis(); if (PHP_OS == "Darwin") { if (isset($_GET['saythis']) && isset($_GET['audioname'])) { if ($_GET['saythis'] != "") { //file_put_contents("xqx.xqx","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); $thewords=str_replace("+"," ",urldecode($_GET['saythis'])); //file_put_contents("xq.xq","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); //file_put_contents("xq.xq",$sayprefix . " " . $voicecode . " " . $_POST['thevoice']); //exit; exec("say" . $sayprefix . " -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); } } else if (isset($_POST['saythis']) && isset($_POST['audioname'])) { if ($_POST['saythis'] != "") { //file_put_contents("xqqx.xqqx","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); $thewords=str_replace("+"," ",urldecode($_POST['saythis'])); //echo "say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords); //exit; //file_put_contents("xqq.xqq","say -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); //file_put_contents("xqv.xqv",$sayprefix . " " . $voicecode . " " . $_POST['thevoice']); //echo $sayprefix; //exit; exec("say" . $sayprefix . " -o " . dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])) . " " . str_replace("\n",",,,,,,",$thewords) . " > " . dirname(__FILE__) . "/sayout.out" . " 2> " . dirname(__FILE__) . "/sayerr.err"); } } else if ((!isset($_GET['saythis']) && !isset($_POST['saythis'])) || !isset($_GET['audioname']) || !isset($_POST['audioname'])) { $audiois=""; if (isset($_GET['audioname'])) { $ourmime="audio/x-aiff"; $ourext=explode(".",str_replace("+"," ",urldecode($_GET['audioname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_GET['audioname']))))]; for ($ib=0; $ib 📧"; $thecontent="data:" . $ourmime . ";base64," . base64_encode(file_get_contents(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname'])))); $daudio=""; //unlink(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_GET['audioname']))); } else if (isset($_POST['audioname'])) { $ourmime="audio/x-aiff"; $ourext=explode(".",str_replace("+"," ",urldecode($_POST['audioname'])))[-1 + sizeof(explode(".",str_replace("+"," ",urldecode($_POST['audioname']))))]; for ($ib=0; $ib"; $thecontent="data:" . $ourmime . ";base64," . base64_encode(file_get_contents(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname'])))); $daudio=""; //unlink(dirname(__FILE__) . "/" . str_replace("+"," ",urldecode($_POST['audioname']))); } if (isset($_GET['saythis'])) { $tastuff=str_replace("+"," ",urldecode($_GET['saythis'])); } else if (isset($_GET['saythis'])) { $tastuff=str_replace("+"," ",urldecode($_POST['saythis'])); } if (isset($_GET['dummysaythis'])) { $dcv=str_replace("\n"," ",str_replace("+"," ",urldecode($_GET['dummysaythis']))); $dcv=str_replace("+"," ",urldecode($_GET['dummysaythis'])); $tastuff=str_replace("+"," ",urldecode($_GET['dummysaythis'])); } else if (isset($_GET['dummysaythis'])) { $dcv=str_replace("\n"," ",str_replace("+"," ",urldecode($_POST['dummysaythis']))); $dcv=str_replace("+"," ",urldecode($_POST['dummysaythis'])); $tastuff=str_replace("+"," ",urldecode($_POST['dummysaythis'])); } echo $htmltop . "

Supervise and synchronize 'say [words]'

RJM Programming - July, 2020

" . $audiois . "
WordsRecord to


"; } } else { echo "

This PHP web application only works with macOS and its 'say [words]' command line Text to Speech and/or Audio functionality.

"; exit; } ?>