Rivescript not working as expected- solved

  • 19 Replies
  • 11912 Views
*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6855
  • Mostly Harmless
Re: Rivescript not working as expected
« Reply #15 on: March 23, 2017, 11:56:49 am »
Yup - Mary is really very good. You can also change pronunciation too.

Mary will also provide phoneme timings, which is what you need for lip sync.

*

brty21

  • Roomba
  • *
  • 10
Re: Rivescript not working as expected
« Reply #16 on: March 23, 2017, 11:32:27 pm »
 :) Thanks I will definitely try to get mary going with that info -after the weekend (i got five children!)

Then, on the front end side of things, all I want to do is figure out how to get an extra avatar pic to show temporarily before it goes back to idle.   ie idle-talking-action-idle or idle-action-talking-idle
....If you see what i mean
- I will post my code tampering attempts another time though

*

brty21

  • Roomba
  • *
  • 10
Re: Rivescript not working as expected
« Reply #17 on: March 27, 2017, 11:34:23 am »
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 :

Code
<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...

Code
<?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.
:)

Working well, Thanks a lot! At least I have some idea now

Since RiveScript is working as expected now. I will post new topics to new threads

*

8pla.net

  • Trusty Member
  • ***********
  • Eve
  • *
  • 1302
  • TV News. Pub. UAL (PhD). Robitron Mod. LPC Judge.
    • 8pla.net
Re: Rivescript not working as expected- solved
« Reply #18 on: March 28, 2017, 10:32:21 pm »
Does MaryTTS require Dedicated Server Hosting?

It seems to me it may, but I'm not really sure, since
I've only just tested it on my localhost.
My Very Enormous Monster Just Stopped Using Nine

*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6855
  • Mostly Harmless
Re: Rivescript not working as expected- solved
« Reply #19 on: March 28, 2017, 11:04:18 pm »
I don't think a regular shared server is possible unless they bundle it. You'd need shell access to install it. I use a VPS.

 


OpenAI Speech-to-Speech Reasoning Demo
by ivan.moony (AI News )
March 28, 2024, 01:31:53 pm
Say good-bye to GPUs...
by MikeB (AI News )
March 23, 2024, 09:23:52 am
Google Bard report
by ivan.moony (AI News )
February 14, 2024, 04:42:23 pm
Elon Musk's xAI Grok Chatbot
by MikeB (AI News )
December 11, 2023, 06:26:33 am
Nvidia Hype
by 8pla.net (AI News )
December 06, 2023, 10:04:52 pm
How will the OpenAI CEO being Fired affect ChatGPT?
by 8pla.net (AI News )
December 06, 2023, 09:54:25 pm
Independent AI sovereignties
by WriterOfMinds (AI News )
November 08, 2023, 04:51:21 am
LLaMA2 Meta's chatbot released
by 8pla.net (AI News )
October 18, 2023, 11:41:21 pm

Users Online

349 Guests, 0 Users

Most Online Today: 396. Most Online Ever: 2369 (November 21, 2020, 04:08:13 pm)

Articles