Glad you got it sorted.
I'm very interested in your unity/elfscript project. I'm just using animated gif's of daz animations but would love to use a 3d figure and will be trying it when i have time.
Elfscript is on hold at the moment as I have so much on. But it's usable now, I'll look into opening up the private board where Art and myself had been discussing it. That's going to be a few weeks away though when I have more time to support it hopefully.
There is a technical difficulty in using my avatars in a browser that I have not got around yet and that involves multi threading. The short version is that it will not work just yet. I need to explore other ways of doing things, if indeed there are any - or for Unity to come up with something.
The Pipes are useful in the Trigger statements from the user such as + Do you have a (vehicle | car | automobile)
Interesting, that's the same method I came up with for variations of input. I use double pipes for random sentences (and also different input) and singles for variable phrases...
For sentences :
i: hello||howdy||Greetings||good day;
o: Hello there !||Good to meet you !;
For phrases :
i: I have a (bike|car|lorry);
o: Oh, that's a means of transport.||How long have you had one ?;
My interpreter is not fussy about capitals because all input is normalised.
Here's a short couple of scripts that I came up with which use PHP and javascript to interface with MaryTTS.
Browsers/JS don't like cross site scripting. There's ways to get around it, but I find them complicated and it's easily solved with a relay for testing purposes. You can get into all that other gubbins later if you want.
Take these two scripts and put them in some directory that is useful to you. The HTML/JS script calls the PHP. The PHP calls Mary. The PHP then sends what it got from Mary back to the client or browser. The client then plays it.
The main reason why you get the cross site problem is that Mary uses a different port compared to normal, ie port 80 in most cases.
Here's the HTML/JS :
<html>
<title>Demo Play TTS</title>
<head>
</head>
<script>
// It's a pain using JS for cross site so just use a simple PHP relay to start with.
var relay = "gettts.php";
// The words to render.
var tts = "Just a simple Demo. Refresh page if you change the words in the script.";
// The URL for the relay with the words added on.
var url = relay + "?words=" + tts;
// Set up an audio player and get the audio from the relay URL.
var audio = new Audio(url);
// Play the audio which would have been made by Mary.
audio.play();
</script>
<body>
Just a simple Demo. Refresh page if you change the words in the script.
</body>
</html>
And the PHP...
<?php
// Your server or host.
$host = "http://localhost";
// A voice you have installed with Mary.
$voice = "cmu-slt-hsmm";
// Get the words sent from the JS - best to do some sanitising here later.
$words = $_GET['words'];
// URL to the Mary port and various settings.
$url = $host . ":59125/process?INPUT_TEXT=" . $words . ".&INPUT_TYPE=TEXT&OUTPUT_TYPE=AUDIO&LOCALE=en_US&AUDIO=WAVE_FILE&VOICE=" . $voice;
// Mary doesn't like spaces.
$url = str_replace(" ", "+", $url);
// Get the WAV file from Mary.
$wav = file_get_contents($url);
// Set a header for the client.
header('Content-Type: audio/wav');
// Echo the audio data.
echo $wav;
// End.
die();
Have a play with that. Save the PHP as 'gettts.php' and the HTML whatever you see fit. Change the JS variable 'tts' to whatever you like. Just hit the HTML page in your browser to see what it does.
Hopefully it will work, it did for me. You may have to change the voice setting if you don't have that one, but I think that is the default voice when installing.
Note that PHP is server side - so you need to browse to the HTML via your local host. Just double clicking on the HTML file will not work.
Wow! Mary generates Parts of Speech in XML ...
<?xml version="1.0" encoding="UTF-8"?>
<maryxml xmlns="http://mary.dfki.de/2002/MaryXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="0.5" xml:lang="en-US">
<p>
<voice name="cmu-slt-hsmm">
<s>
<t pos="VB">Welcome</t>
<t pos="TO">to</t>
<t pos="DT">the</t>
<t pos="NN">world</t>
<t pos="IN">of</t>
<t pos="NN">speech</t>
<t pos="NN">synthesis</t>
<t pos=".">!</t>
</s>
</voice>
</p>
</maryxml>
And phonemes as well in XML ...
<?xml version="1.0" encoding="UTF-8"?>
<maryxml xmlns="http://mary.dfki.de/2002/MaryXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="0.5" xml:lang="en-US">
<p>
<voice name="cmu-slt-hsmm">
<s>
<t g2p_method="lexicon" ph="' w E l - k @ m" pos="VB">Welcome</t>
<t g2p_method="lexicon" ph="' t u" pos="TO">to</t>
<t g2p_method="lexicon" ph="D @" pos="DT">the</t>
<t g2p_method="lexicon" ph="' w r= l d" pos="NN">world</t>
<t g2p_method="lexicon" ph="' V v" pos="IN">of</t>
<t g2p_method="lexicon" ph="s - ' p i tS" pos="NN">speech</t>
<t g2p_method="lexicon" ph="' s I n - T @ - s @ s" pos="NN">synthesis</t>
<t pos=".">!</t>
</s>
</voice>
</p>
</maryxml>