Author Topic: GetRandomP issue  (Read 6909 times)

0 Members and 4 Guests are viewing this topic.

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
GetRandomP issue
« on: February 23, 2012, 06:40:53 AM »
Hi,

I am trying to create a command composed of three actions:
(1) The real system action (irrelevant)... Done.
(2) Read one random phrase from xml file (using PayloadXML.GetRandomP), the phrases xml file will be composed of audio file names (for the phrases). I specify the XML file in the first parameter, and 1 in the second parameter.
(3) Use the random phrase got from (2) to play it (Sound.PlayWav) to play the selected phrase.

Here are my problems
When executing step (2), VC report an error (Unknown Action GetRandomP) even though I got it from the drop list of the GUI.
Also, I don't know how to get the random phrase from step (2) and use it as a parameter in step (3). Do I use "{1}" for example, or maybe {last_result}

Thank you.

Wanilton

  • $upporter
  • Hero Member
  • *****
  • Posts: 559
  • Karma: 6
    • View Profile
    • XBMC Brazil Forum
Re: GetRandomP issue
« Reply #1 on: February 23, 2012, 07:24:26 AM »
Tria, I did not understand well what you want to do, but to use random phrases, use this tab "|".

Here is an example:

Fine | Excellent | Very Good | Nice

Vox will using this randomic..

I am using here for read info about song, artist, album, using TTS voice in native language.

« Last Edit: February 23, 2012, 07:45:38 AM by Wanilton »
www.xbmcbrasil.net
XBMC  Brazilian Community Forum - Admin
Windows 8.1 - XBMC Gotham Custom Plus - Aeon MQ 5
My Room Entertaiment´s
About me

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: GetRandomP issue
« Reply #2 on: February 23, 2012, 07:50:29 AM »
Tria, I don´t know what your command, but for randomic phases use  this "|" for n phrases.
Here one case:

Fine | Excellent | Very Good | Nice

Vox will using this randomic..

I use here for read info about song, artist, album, using TTS voice in native language.


Hi Wanilton,
tria will read out an payload.xml (with random phrases that have an "audio file path" as "value") to play a wav file. (I think at least   ::hmm  )
I'm not confirm with "PayloadXML.GetRandomP" command.

Kalle
***********  get excited and make things  **********

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #3 on: February 23, 2012, 08:12:59 AM »
Thanks Wanilton. I am aware about | for TTS, but only if my language was supported like your language (PT) I can use it like you do :(
So the best way around this currently is what I am trying to do currently, and Kalle got what I am after correctly.
Currently I am using third party TTS to generate different phrases, save them as wav files, list them in payload.xml file for phrases, try to load a random phrase from that file using the mentioned GetRandomP, and finally play it as wav file using PlayWav.
For some reason, I believe GetRandomP not working (probably a bug?)
Also, I was wondering how to get the result from GetRandomP into another action like PlayWav as a parameter.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #4 on: February 23, 2012, 09:26:15 AM »
Hi,

I am trying to create a command composed of three actions:
(1) The real system action (irrelevant)...

I will check that everything is OK and suggest some answers shortly.  I did not test this action extensively since creating it so it is possible it is buggy.

One question though:  What is the ultimate goal you have in mind?  i.e. What are you trying to accomplish?  TTS without a TTS engine installed?

Also, it would help us to better understand if you could export a group containing your command and upload it here (along with the payloadXML file).  Right-click a group in the command tree to export it.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #5 on: February 23, 2012, 09:48:09 AM »
sorry, I didn't read the whole thread before I replied.   :-[

It's clear now what you want to do.

Are you looking, specifically, for a way to do random Arabic TTS phrases?

Yes there is a bug with the getRandomP action.  In fact all the "PayloadXML.*" actions are suspect at this point  ::confused.

I will look into a fix ASAP.

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #6 on: February 23, 2012, 10:49:30 AM »
Thank you for looking into this bug.

Yes, I want to play random phrases from wav files specified in a payload xml file. This will be my "poor-man" implementation for randomized TTS :)
If I were using English, I would surely use TTS actions that support randomization.

But nobody answered the second part of the question. Assuming that GetRandomP get to work, how to take the output (or phrase) from it and pass it as a parameter to the next action in the list?

Thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #7 on: February 23, 2012, 11:02:52 AM »
I didn't answer because somehow that code all got lobotomised.  It's just not there and I can't find it, so I'm recreating it.  So I won't have an answer for you until I make it again.

the data is either going to be available in {LastResult} or more likely in {Match.1} since we are able to return multiple results.

Don't worry I'll post some samples when it's fixed, and I plan to do this today.  I'm working on it right now.

On a side note, I think I may have an alternate poor man's solution for you, however it make take a while before it is ready, and it will only work if you have an internet connection.  Go to http://translate.google.com/ and try out their Arabic TTS.  Is that good enough quality for you?  It sounds good to me but I don't speak Arabic so I have no idea really.

There should also be Arabic TTS available for Windows that would be compatible with VC, but I don't know where to get them or how much they cost.  Maybe Rebel or Zizos could suggest something.

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #8 on: February 23, 2012, 12:11:29 PM »
Okay, that would be great.

As for google translate, haha I like how you claim it sound good without knowing Arabic (it is impossible to evaluate any language you don't understand, right?). But yeah, you are correct, it is somehow good (especially when you know it is relatively new). But the loquendo implementation is far better. It almost sound like a real person is talking (even when compared to English engines that already existed for decades). They have a text to speech version for individuals, but it doesn't work with the system TTS engine.

What is good with Google is their Arabic Speech Recognition used in mobile phones. I managed to get hold of the API (even though not published), and was able to convert what I say in Arabic to text. The output was relatively good for a recent release. The only problem is that there is a delay due to the HTTP request/response and the need to encode in FLAC. Also, you have to send the audio file in chunks if it is too big. This will break the experience for real time application, or when there is no internet connection. It would be great if they released it for one of the operating systems out there, but I am not holding my breaths.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #9 on: February 23, 2012, 02:11:59 PM »
please try this and let me know

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #10 on: February 23, 2012, 03:59:34 PM »
Now it is working properly. You are the greatest.

But one thing to note to all other people stumbling over this thread from a search engine. I/You/We should use {Match.1} to get the result as a parameter for the following command (assuming we want to access the first phrase of the random phrases)

Thanks!

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #11 on: February 23, 2012, 04:32:06 PM »
Can I ask you to implement another feature?

Can you make another action like "PlayWav", lets call it "PlayRandomWav", where you specify the directory containing the wav files, and it will play one of them randomly. More ideas could be: allow the user to specify prefix for the files (and maybe several prefixes separated with | or ; or ,) so that files with these prefixes only get selected from the directory. Also return the played file name as a result (i.e. in {LastResult} or {Match.1}...etc)

This will be really helpful for the hopeless people without TTS, and it will save us a lot of time (instead of creating payload xml files and updating them each time). It also qualify as a great feature for other people and can be used for other purposes.

Thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #12 on: February 23, 2012, 06:16:00 PM »
Yes you can.

I will add two new commands:

- Files.GetRandFile
- Files.GetFiles

both will accept a path and a filter (i.e. *.wav or *.*)

GetRandFile will return a single filepath in {LastResult}
GetFiles will return all matching files as {Match.1}...{Match.N}

later on I will probably add an option to search in subdirectories as well.

Then you can do what you want with the files.  Play a wav, show a jpg etc.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: GetRandomP issue
« Reply #13 on: February 23, 2012, 06:23:58 PM »
but as an alternative poor man's TTS you can try the secret command in the attached group.

you must enable the Bing plugin for this to work, but you don't need to enter an API key in the plugin settings (I don't think).

The reason it is not officially included in the plugin is that I may move it into another plugin later which we will also be able to use to listen to internet radio etc. since it uses a similar streaming audio approach. (also it has nothing to do with Bing  :biglaugh)

You can also use many TTS voices with Bing.SpeakSync but Arabic is not available in Bing's TTS for some reason.
« Last Edit: February 23, 2012, 06:26:19 PM by jitterjames »

tria

  • Jr. Member
  • **
  • Posts: 22
  • Karma: 0
    • View Profile
Re: GetRandomP issue
« Reply #14 on: February 23, 2012, 07:22:13 PM »
I really appreciate you looking into my request. You should note that what I meant by "prefix" is "prefix" and not "postfix" :) I was meaning a common string that they start with (but differ in the ending). However, your postfix or extension idea is also great.

As for the secret command, I am not sure whether you are serious or not, as the secret command doesn't work even if I enable Bing addon (only speaksync/speak). Unless you are hinting about upcoming function for the thing I explained to you in another place and you are going to call it that secret command? ;)
If that is the case, then I might help with providing a command line utility that automate it if you like. I was intending to create it to use it for other things, but if it help here then why not. Can you call other application and pass parameters to them from VC? also, although not required, can VC read the output stream from such called application (it would be a great way to pass result back)?