I am developing an Alexa skill. I want Alexa to utter a stored integer value in her speech output. (Using PYTHON) - alexa

I am trying to build an Alexa skill. I need one of the intent to multiply a slot value with a constant and store the product under some variable. I want the Alexa to speak the output this variable in her output sentence.
I have tried this but no luck:
int a
slots= handler_input.request_envelope.request.slots
num= slots["numbers"].value
name= slots["names"].value
if name=="xyz":
a=num*20
speak.output=("the total is %d" %a)

To Alexa speech responses to User, you have to construct a JSON response.
You can find it in this.

Related

How to change persona voice with audio track?

I want to create a change voice function for a meeting application using webrtc.
I have 2 solutions for it:
Solution 1: Use MediaStreamAudioSourceNode and connect node to create audio filter
https://github.com/mdn/webaudio-examples#stream-source-buffer
But I can't control the sex of voice.
Solution 2: I use speech to text and text to speech.
I use speech to text to get the content of the speaker.
Afterthat, I send text to another member in meeting. And use text to speech to create voice.
But the transmission speed is slow and inaccurate in terms of content.
Do you know any AI or library that supports this?

How to extract a custom slot from a user random input in Alexa Skill

We have an intent with a custom slot called topic. The values of this slots could be for example:
Sports, Science, Cinema, TV
So our sample Utterances are like this:
{topic}
tell me about {topic}
what do you know about {topic}
i love {topic}
This works correctly if the users uses phrases like the ones in the sample utterances. But, is there a way to achieve the following?
We want the user to be able just to say anything between and after the {topic} . Something like:
{any} {topic} {any} - {what do you think about} {sports} {my friend?}
or
{any} {topic} - {i hate everything related with } {sports}
Is there a way for Alexa Skill to extract the {Topic} from any random phrase?
There is a reason to keep User's input organized (you just increase the probability of correct slot recognition) with sample utterances. But :) some time ago I've found this topic: https://stackoverflow.com/a/53334157/2823106, actually it's a hack on Alexa but you can create the catchAll slot and try something like {catchAll} {Topic} {catchAll}. The problem I expect here is that Alexa won't recognize the Topic correctly but give it a try.

Creating a new voice for Alexa within my skill

Is it possible to change the voice alexa is using within my skill?
i.e. the user asks
Alexa Ask Car Washing when the next available appointment is?
and have Alexa respond with a voice that matches my carwashing brand?
Yes, it is possible.
You can use SSML Tags in output speech response of your skill to achieve this.
You can
whisper
put emphasis on a word or phrase
use different languages like French, Spanish etc.
different voices and many more
For Example
<speak>
Here's a surprise you did not expect.
<voice name="Kendra"><lang xml:lang="en-US">I want to tell you a secret.</lang></voice>
<voice name="Brian"><lang xml:lang="en-GB">Your secret is safe with me!</lang></voice>
<voice name="Kendra"><lang xml:lang="en-US">I am not a real human.</lang></voice>.
Can you believe it?
</speak>
Learn more about Using SSML Tags HERE

Alexa echo show highlight text

I am creating a skill for Echo Show and was able to display text using BodyTemplate1. Now I wanted to highlight each word while Alexa utters those words. Could anyone know how to do this?
Not available yet. You can vote the feature request up though.
This is available now using APL (Alexa Presentation Language). The SpeakText directive will accomplish what you want to do.

How can we implement 'Alexa, Simon says...' intent to capture free form speech with wide variations as text?

I would like to capture anything a user says to Alexa in text form. Exactly how 'Alexa, Simon says...' works. Can someone hint at how that intent can be implemented?
I looked at this, this and this but the suggested answers don't work for me and there are no concrete 'accepted' answers to any yet.
LITERAL slot type works as long as the sample utterance is specified (i.e. hard coded literally). Like the answers suggested in the above threads, I tried to 'train' by providing 400+ combinations of possible utterances hoping that it will somehow figure out the rest of the combinations. But, no dice.
My input could be as random as 'TBD-2019-UK', '17_TBD_UK_Leicester', '17_TBD_UK_Leicester 1', '18_TBD_UK_Leicester 2', 'Chicago IL United States', etc. It is a pretty random combo of the year, city, state, country, some other key text in no particular order (lets ignore the special characters for now). Even if 'Chicago IL United States' is specified in Sample Utterances, LITERAL is not able to capture something like 'Pittsburgh PA United States' automatically unless that is also hard coded. There is no way I can come up with ALL possible permutations and combinations of year, city, state, country, some other key data points (... because it sounds impractical/ridiculous).
Plus, more values could be added by user. So it needs to be smart and dynamic.
The problem is, if there is no matching intent found for the utterance, instead of returning the user's speech text, my Alexa is just failing to do anything. It just goes off without doing anything. Any ideas?
Amazon's Alexa service is not designed for dictation. This has been the consistent response from the Developer Evangelists. So, quite simply, you cannot do what you desire: capture free form speech with wide variations.
There are various ways you can 'trick' Alexa into creating a 'generic slot', which I assume those links talk about. But, since it is outside the design parameters of Alexa, they will never perform well, as you have found.
For your use case, I suggest you break down your inputs into several exchanges. Don't use a one-shot invocation, but a dialog. For example:
U: Alexa, open spiffy skill
A: Welcome to spiffy skill. I'd love to do something spiffy for you,
but I need some information. You can give it to me by saying city,
year, state, or country followed by what you want me to look up.
U: City Cincinatti
A: OK, Got city Cincinatti. I need more information to be spiffy. How
Year?
U: Year 2010
A: OK, I've got Cincinatti, 2010. Should I look that up, or do you have
more info?
U: Look it up.
A: Got it. So for Cincinatti, 2010 ...

Resources