Author Topic: Concatonating a TTS filename reference  (Read 1224 times)

Mike308

  • Newbie
  • *
  • Posts: 48
Concatonating a TTS filename reference
« on: March 25, 2019, 12:45:26 PM »
I am trying to expand my grasp on tokens/small integers in a test profile that uses TTS rather than pre-recorded sound bits. My desired goal is to create the ability to generate context-sensitive answers to generic questions. For a simple example, assume a discussion of cars.

At the onset I declare a variable called ‘Topic’ with an initial value of zero

I then declare a variable called ‘Query’ also with an initial value of zero

I have three separate initial commands: lets talk about the Camaro, lets talk about the Firebird, lets talk about the Mustang. Each command will set Topic to a specific value, in this case 1, 2 or 3 respectively.

I then have generic commands: What does it cost?  How fast will it go?  Who manufactures it? 

I know that inside each of these generic commands I can have an If/ElseIf stack based on the value of Topic that would give me the corresponding answer.  (if asking about cost, a Topic 1 returns $100, ElseIf 2 then $125, ElseIf 3 $150…)   

But if I have a large body of generic questions, I would have to spend a lot of editing ElseIf statements every time I wanted to add a new car. It gets really hairy when I'm trying to use SSML.

What I’m wondering is if I could do this: What if each of the generic commands set the value of Query (in this small example, to 1,2 or 3 respectively.) This would give me a number pair (Topic + Query) so if I was talking Mustangs (Topic = 3) and followed that by asking how fast will it go (Query = 2) then I’d have 32.

If I was using pre-recorded sound files, I think I could name them based on this matrix, so the command would then play the sound file named 32. But could I do that same thing using TTS replies and somehow speak text string #32?

My thought is that as I add a new Topic to the library, I need only create the new replies; I do not need to go back to every question and add a new ElseIf line to the command. The math would carry by itself.

Or is there some flawed thinking here…?


Note: I understand that my actual number sequences would carry more digits, just using 1-2-3 here for ease of discussion.

Thanks!

Mike308

  • Newbie
  • *
  • Posts: 48
Re: Concatonating a TTS filename reference
« Reply #1 on: March 25, 2019, 04:36:23 PM »
/facepalm

When I make the original statement "Lets talk about Mustang" I could just set all of the variables (cost, speed, etc) in one pass and then all of my following generic questions would just result in:  Say "cost" or Say "speed" with no fuss.

Sorry. Sometimes it is not about how to write the code, but how to think about the code.  I think.