Author Topic: Building text to speed output to clipboard for use with {CLIP} token  (Read 4603 times)

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Hi guys... me again. I've been playing around with EDDI a lot and I like the voice processing that it can do. Unfortunately, I don't use it because then I end up with voice processed output for EDDI speech responders while my normal output from VA is not processed. There is a way around this by executing the EDDI plugin using the "Say" context. But this gets really messy as I have a lot of custom feedback messages.

I'm thinking if I could format the output text into the Windows clipboard with line breaks (this puts in a slight pause between phrases) then I could use the {CLIP} command to pass the entire contents of the clipboard to the EDDI plugin to read back using voice processing. This way everything sounds the same if I select the voice processing in the EDDI configuration.

My problem is I'm not sure how to build this as items sent to the clipboard separately are replaced I think? Also, I'm not sure that "Say" context in EDDI will evaluate tokens and expressions or just literally read them. Any suggestions how I might approach this?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #1 on: February 07, 2017, 04:21:20 PM »
If what you need is to combine multiple segments of text(strings) into one(concatenate them), use the "{TXTCONCAT:}" token(VoiceAttackHelp.pdf page 106).

As you were going to use the "{CLIP}" token anyways, treating the clipboard as just another variable, you can forget the clipboard and actually use a variable:
Code: [Select]
Set Text [String] to ''
Set Text [String] to '{TXTCONCAT:String:"This "}'
Set Text [String] to '{TXTCONCAT:String:"is "}'
Set Text [String] to '{TXTCONCAT:String:"a "}'
Set Text [String] to '{TXTCONCAT:String:"phrase "}'
Write '[Purple] {TXT:String}' to log
Make sure you set the text value to something first, otherwise the output would be "Not SetThis is a phrase", though it doesn't have to be empty:
Code: [Select]
Set Text [String] to 'This'
Set Text [String] to '{TXTCONCAT:String:"is "}'
Set Text [String] to '{TXTCONCAT:String:"a "}'
Set Text [String] to '{TXTCONCAT:String:"phrase "}'
Write '[Purple] {TXT:String}' to log
Either will output "This is a phrase ".

You can simply not add the trailing space, if you know which segment will be the the last, or use the "{TXTTRIM:}" token(VoiceAttackHelp.pdf page 105) to remove it before you send the text to EDDI.

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #2 on: February 09, 2017, 12:26:59 AM »
Ok, I should have thought of this. I gotta stop these really late night code tinkering sessions. :(

You're absolutely correct. Since I'm treating {CLIP} as a text string variable, there is no need to use clip at all. I just need to render the text string as you suggested and send to EDDI. Thank you for the help, sometimes I have a way of overcomplicating things that are really quite simple. :P

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #3 on: February 10, 2017, 04:11:16 AM »
I just thought of something... I use a lot of dynamic responses in my say commands so that they don't always come out the exact same way every time. Would these work with TEXT variables? I'm thinking probably not.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #4 on: February 10, 2017, 03:50:23 PM »
Can you clarify what you want to accomplish?

The "Say Something with Text-To-Speech" action supports any token, and tokens can retrieve variables.

Also note that dynamic sections are processed last, so something like
Code: [Select]
Set Text [SayText] to 'Option [one;two]'
Say, 'I'll take {TXT:SayText}'
Will use the value from the variable, and randomly pick between the bracketed sections, as it normally would.

However, the randomization is done in the action itself, the variable itself always contains the full text.

If you want randomized text outside of the TTS action, you can use the "{TXTRANDOM:}" token(VoiceAttackHelp.pdf page 105).

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #5 on: February 12, 2017, 01:28:49 PM »
I have some randomized responses to actions, for example:

Say, '[landing]gear[retracted;stowed;up]'

What I would like to do is to assign a dynamic response like that to a text variable and then call EDDI using the "Say" context to use TTS with the voice processing provided by EDDI.

You know, this whole thing would be so much easier if voice processed effects were added to VA. :P

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #6 on: February 12, 2017, 08:39:09 PM »
If you want randomized text outside of the TTS action, you can use the "{TXTRANDOM:}" token(VoiceAttackHelp.pdf page 105).

If that's not enough:
Code: [Select]
Set Text [EDDISays] to '{TXTRANDOM:landing;} gear {TXTRANDOM:retracted;stowed;up}'
Execute external plugin, 'EDDI' and wait for return

mikelimtw

  • Jr. Member
  • **
  • Posts: 51
Re: Building text to speed output to clipboard for use with {CLIP} token
« Reply #7 on: February 21, 2017, 09:26:45 AM »
Hi Pfeil,

Sorry I missed this response from you. This works, thanks!