Ejemplo n.º 1
0
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Mary Audio Tag</title>
</head>

<body>
  <h1>MaryTTS Audio embeded</h1>

  <?php 
$input = "this is my nice text";
$locale = "en_US";
embedMaryTTS($input, $locale);
function embedMaryTTS($input, $locale)
{
    $baseUrl = 'http://127.0.0.1:1234/example13/';
    //$baseUrl = 'http://192.168.10.10:1234/example13/';
    //$key = getenv('HMAC_SECRET');
    //$key = getenv('MARYTTS_HMAC_SECRET');
    $key = 'MARYTTS_HMAC_SECRET';
    $keyBytes = base64_decode($key);
    //$stringToSign = $input . $locale . $expires;
    $stringToSign = $input . $locale;
    $signatureBytes = hash_hmac("sha256", $stringToSign, $keyBytes, true);
    $signature = base64_encode($signatureBytes);
    $src = $baseUrl . '?';
    $src .= "text=" . urlencode($input);
    $src .= "&locale=" . urlencode($locale);
    $src .= "&signature=" . urlencode($signature);
    echo 'signatureBytes: ', $signatureBytes, '<br>';
Ejemplo n.º 2
0
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Mary Audio Tag</title>
</head>

<body>
  <h3>Mary Jetty Embedded</h3>

  <?php 
$input = "we are only boys and girls";
$locale = "en_US";
// can't be null since paramOrDefault valuse in java is empty
$voice = null;
embedMaryTTS($input, $locale, $voice);
function embedMaryTTS($input, $locale, $voice)
{
    $baseUrl = 'http://edchant.tk:8080/';
    //$baseUrl = 'http://edchant.tk:1234/example13/';
    //$baseUrl = 'http://127.0.0.1:8080/';
    //$baseUrl = 'http://127.0.0.1:1234/example13/';
    //$baseUrl = 'http://192.168.10.10:1234/example13/';
    //$baseUrl = 'http://192.168.10.10:8080/';
    //$baseUrl = $_SERVER['SERVER_NAME']:8080;
    $key = getenv('MARYTTS_HMAC_SECRET');
    $keyBytes = base64_decode($key);
    //$stringToSign = $input . $locale . $expires;
    //$stringToSign = $input . $locale;
    $stringToSign = $input;
    $signatureBytes = hash_hmac("sha256", $stringToSign, $keyBytes, true);