Amazon Alexa is a great product. But now it only supports a few languages. If you want to create Flash Briefing App or Calendar App, you can't create it because Alexa don't speak your language. This project provide other language support to Alexa with using audio file.
About generating audio dataThe IBM Text to Speech service (TTS) provides an Application Programming Interface (API) that uses IBM's speech-synthesis capabilities to convert written text to natural-sounding speech. This project use TTS to generate audio data from calendar event summary.
The audio data generated by TTS do not fit to Alexa audio format. The audio must follow the Alexa audio format to use on Alexa.
This project use ffmpeg
to convert audio.
Go here. Credential information is required to use IBM Text to Speech service. Sign Up if you don't have account on IBM Bluemix.
2. Create DynamoDBaws dynamodb create-table --table-name calendar_event --attribute-definitions AttributeName=uid,AttributeType=S AttributeName=begin_date,AttributeType=S --key-schema AttributeName=uid,KeyType=HASH AttributeName=begin_date,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
This command creates DynamoDB table include Hash key and Range key.
3. Create Lambda RoleLambda need few permissions to use AWS services. Create a Role which has the following policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "lambdacalendarskill1",
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Sid": "lambdacalendarskill2",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::my-calendar-raw-audio",
"arn:aws:s3:::my-calendar-raw-audio/*",
"arn:aws:s3:::my-calendar-audio",
"arn:aws:s3:::my-calendar-audio/*"
]
},
{
"Sid": "lambdacalendarskill3",
"Action": [
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:UpdateItem",
"dynamodb:Scan",
"lambda:InvokeFunction"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
4. Create Lambda functionsDiagram of audio generator.
4.1 Calendar Crawler
This function gets Google Calendar's ICS data. Parse it and store to DynamoDB. After storing the calendar data, invoke the audio generate lambda function.
4.2 Text-to-speech
This function uses IBM Text to Speech service to generate audio data from calendar summary. Generated data is stored in Amazon S3 bucket. If you want to use another language, change the parameter "voice".
raw_data = text_to_speech.synthesize(event["summary"], accept='audio/wav', voice="ja-JP_EmiVoice")
Check the supported voice type here.
4.3 Audio transform
This function invoked from S3 events. Convert audio data to Alexa required format and store in another Amazon S3 bucket.
4.4 Alexa Calendar Skill
The Alexa Skill for asking calendar events.
5. Register Alexa SkillUse intent_schema.json
and sample_utterance.txt
for interaction model.
Ask Alexa "Alexa, Ask <invocation name> whats on today".
Comments