Rivescript not working as expected- solved

  • 19 Replies
  • 12415 Views
*

Freddy

  • Administrator
  • **********************
  • Colossus
  • *
  • 6860
  • 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
  • *
  • 1307
  • 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
  • *
  • 6860
  • 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.

 


Project Acuitas
by WriterOfMinds (General Project Discussion)
October 27, 2024, 09:17:10 pm
Ai improving AI
by infurl (AI Programming)
October 19, 2024, 03:43:29 am
Atronach's Eye
by WriterOfMinds (Home Made Robots)
October 13, 2024, 09:52:42 pm
Running local AI models
by spydaz (AI Programming)
October 07, 2024, 09:00:53 am
Hi IM BAA---AAACK!!
by MagnusWootton (Home Made Robots)
September 16, 2024, 09:49:10 pm
Attempting Hydraulics
by MagnusWootton (Home Made Robots)
August 19, 2024, 04:03:23 am
Server Upgrade
by Freddy (Welcome to AI Dreams forum.)
August 12, 2024, 03:20:04 pm
Reasoner.js: a framework for generalized theory synthesis
by ivan.moony (General Project Discussion)
July 07, 2024, 01:35:38 pm
LLaMA2 Meta's chatbot released
by spydaz (AI News )
August 24, 2024, 02:58:36 pm
ollama and llama3
by spydaz (AI News )
August 24, 2024, 02:55:13 pm
AI controlled F-16, for real!
by frankinstien (AI News )
June 15, 2024, 05:40:28 am
Open AI GPT-4o - audio, vision, text combined reasoning
by MikeB (AI News )
May 14, 2024, 05:46:48 am
OpenAI Speech-to-Speech Reasoning Demo
by MikeB (AI News )
March 31, 2024, 01:00: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

Users Online

244 Guests, 0 Users

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

Articles