Author Topic: tell me a story tell me a joke tell me a puzzle  (Read 9331 times)

0 Members and 1 Guest are viewing this topic.

zizos

  • Jr. Member
  • **
  • Posts: 20
  • Karma: 0
    • View Profile
tell me a story tell me a joke tell me a puzzle
« on: November 29, 2011, 06:00:41 AM »
i think that we can make VC tell us a story or a joke or a puzzle  just by puting a coomand by the name

tell me a story

tell me a joke

tell me a puzzle 

i hop that you got my idea

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #1 on: November 29, 2011, 06:49:23 AM »
i think that we can make VC tell us a story or a joke or a puzzle  just by puting a coomand by the name

tell me a story

tell me a joke

tell me a puzzle 

i hop that you got my idea
Yes, you can use the TTS.speak command and put any text as command. Don't forget punctuation marks  ;)
***********  get excited and make things  **********

zizos

  • Jr. Member
  • **
  • Posts: 20
  • Karma: 0
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #2 on: November 29, 2011, 07:22:24 AM »
thanks  Kalle

but can we add to VC for example a book of jokes or puzzles and its will read it for us   

why there is no option in VC to read from a file ?



Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #3 on: November 29, 2011, 08:11:29 AM »
thanks  Kalle

but can we add to VC for example a book of jokes or puzzles and its will read it for us   

why there is no option in VC to read from a file ?



I'm not sure that is possible with the "scrape" (copy and paste) commmand? I, will test it.
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #4 on: November 29, 2011, 11:11:22 AM »
thanks  Kalle

but can we add to VC for example a book of jokes or puzzles and its will read it for us   

why there is no option in VC to read from a file ?




Zizos, I am not really understanding what you are looking for.  Where does this book come from?  What format is it in?  Do you want VC to read the whole thing from beginning to end?

I can add an action to read a complete .txt file and store it in {LastResult}. Then it would be up to you to do something with it.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #5 on: November 29, 2011, 11:19:11 AM »
actually Kalle is correct, you can use scrape action.  To read a text file called joke1.txt that is in the jokes folder of your F drive write.

Scrape    file:\\f:\jokes\joke1.txt

then you can use TTS.Speak  {LastResult}  or OSD.ShowText   {LastResult}.

or if you need to you can use regEx actions etc.


zizos

  • Jr. Member
  • **
  • Posts: 20
  • Karma: 0
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #6 on: November 29, 2011, 04:06:21 PM »
thanks  jitterjames

thats exactly what i mean  :)

sirs2k

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #7 on: May 10, 2014, 02:22:32 PM »
Having Jarvis tell a joke and puzzle are great for me, I wanted to ask something though.

Can we somehow put a PAUSE in the txt document somehow for ivona's Brian to pause when telling a joke for example?

Cheers

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #8 on: May 10, 2014, 03:08:28 PM »
Yes.  Your TTS parameter should look something like this:

<volume level="100">hello <silence msec="1500"/> there</volume>

Here is an example:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.4.0-->
<command id="781" name="tts pause example" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>&lt;volume level="100"&gt;hello &lt;silence msec="1500"/&gt; there&lt;/volume&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>tts pause example</phrase>
</command>

and a reference:
http://msdn.microsoft.com/en-us/library/ms717077(v=vs.85).aspx

or you can also probably do it with a series of commas.

Hi there , , , ,  what's up. 

but it may vary depending on your TTS engine.

« Last Edit: May 10, 2014, 03:11:16 PM by jitterjames »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #9 on: May 10, 2014, 04:57:19 PM »
Since this is reviving a very old thread, I just wanted to mention that in addition to the "scrape" action mentioned above, another that may be preferable for tasks such as reading aloud individual jokes from a text file is File.Read. http://voxcommando.com/mediawiki/index.php?title=Actions#Read

Particularly with the {Rnd.#.#} variable as a second parameter. http://voxcommando.com/mediawiki/index.php?title=Variables#Misc._variables

Might be helpful info for newer VC users.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

sirs2k

  • Jr. Member
  • **
  • Posts: 24
  • Karma: 0
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #10 on: May 12, 2014, 02:57:10 AM »
Thanks guys,

James that worked great.
Although there were some things like the Pronunciation and Emphasize didn't work. They would be great to pronounce names etc. How would you write them in a txt file or in XML?

nime5ter,
Unfortunately I don't understand how I would do that, I tried to put the action to File.Read, then pointed it to the txt file but nothing is being read out.
Also I don't it would be better than the scrape method.

Personally I don't like the scrape method because sometimes it can repeat the same joke 5 times before moving on to another "random" joke.

Cheers,

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: tell me a story tell me a joke tell me a puzzle
« Reply #11 on: May 12, 2014, 07:13:24 AM »
Hi sirs2k, let me try to explain nime5ter's solution:

Create a text file with some jokes (at best you use the windows editor). It is important that each joke is written in one line without carriage return between, because the action "file.read" can read the whole text when you insert no parameter, or specified lines what nime5ter suggest with the {Rnd.#.#} as parameter. So the parameter {Rnd.0.10} means a random line between 1 and 10 (depends on how much joke lines you have in this text file).

here is a example command group which show you how it works and also a attached demo joke text file which you must stored in VC mainfolder.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.2.2-->
<commandGroup open="False" name="jokes" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="308" name="read jokes" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\jokes.txt</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>tell me a joke</phrase>
  </command>
</commandGroup>

I hope this example make it more clear  ;)

TIP: The IVONA Brian TTS for english is really good for such things, because it pronounce the jokes at best. (Ups, I noticed in a post above that you allready use IVONA Brian)
« Last Edit: May 12, 2014, 07:36:21 AM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #12 on: May 12, 2014, 10:35:03 AM »
Unfortunately I don't understand how I would do that, I tried to put the action to File.Read, then pointed it to the txt file but nothing is being read out.
Also I don't it would be better than the scrape method.

Without seeing your command xml, and perhaps the file itself that you're trying to read and what messages you got back in your history window, I can't begin to speculate.

One reason for users in general to be aware of File.Read is that if they're not comfortable with regular expressions they can still use the simple trick of dividing their jokes or trivia snippets or whatever by line in order to achieve the same effect, without needing to use regex.

Both Scrape and File.Read are reasonable options that can be combined with regular expressions and variables such as {rnd.#.#} or {match.rnd} to do some powerful things. I was mainly just putting the alternative option out there for anyone who came across the thread, to point out to them actions they may not already be familiar with.

Quote
Personally I don't like the scrape method because sometimes it can repeat the same joke 5 times before moving on to another "random" joke.

That would have nothing to do with the Scrape action. Random is random. Flip a coin 20 times and see how many times in a row you see heads. Possibly, if you have more jokes, you'll have better luck not running into that scenario.



TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2012
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #13 on: May 12, 2014, 10:51:11 AM »
Attached is a command group and text file to demonstrate 3 different methods for accomplishing the exact same thing. Note that one of those does not require regex, but for that one users will want to know how many lines there are in their file.

My command group expects the qi.txt file to be in the main VC directory. ... I'm using OSD.ShowText, but obviously you can change that to a TTS action instead.

That raises one other advantage of using File.Read with a {rnd.#.#} parameter rather than a regex solution: you are then just calling {LastResult}, so that you can have both TTS and an OSD window, without having to first save your random match as a variable. It's a simple, 2 or 3 action command.

... OK. Now back to my day job. :)

P.S. How to copy a command group xml file to your tree: Just drag'n'drop the file itself into your tree.
http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum#Importing_XML_files
« Last Edit: May 12, 2014, 11:11:49 AM by jitterjames »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7715
  • Karma: 116
    • View Profile
    • VoxCommando
Re: tell me a story tell me a joke tell me a puzzle
« Reply #14 on: May 12, 2014, 11:10:24 AM »
That would have nothing to do with the Scrape action. Random is random. Flip a coin 20 times and see how many times in a row you see heads. Possibly, if you have more jokes, you'll have better luck not running into that scenario.

http://youtu.be/T4SVVKuOr0c?t=3m20s