One day my wife asked me that she would like to listen to her favorite music with Amazon Echo. We have accumulated a large collection of CDs and she wanted me to put it somewhere that she could later ask Alexa to play it. So, I thought why not.
It took me ~4 months (of my free time) trying to figure out where to put our whole music collection and how to make Amazon Echo to play it. Finally, we came up with the idea using the Google Drive as a storage (15 GB for free) and also create the Alexa skill that will be able to stream that music collection from our personal Google Drive. When I started this project I quickly realized that it also could be used for streaming audio books from my personal collection!
So, now here it is, the Sound Drive - Alexa skill capable of streaming any audio content you can think of from your Google Drive. You can create unlimited number of the playlist for different categories: music, books (audio), podcasts.
This is how to create playlists:
- go to your Google Drive and create folders with the names: music, books and podcasts.
- for each of these folders create sub-folders with the names of your playlists.
- copy your media files into these sub-folders.
- music -> Relax -> waves.mp3, rainforest.mp3,... [you have created music playlist with the name 'Relax']
- music -> Classic -> song-1.mp3, song-2.mp3,... [you have created music playlist with the name 'Classic']
- books -> Pinocchio -> chapter-1.mp3, chapter-2.mp3,... [you have created books playlist with the name 'Pinocchio']
- podcasts -> Spanish -> lesson-1.mp3, lesson-2.mp3,... [you have created a general purpose playlist with the name 'Spanish']
What it does
It streams your personal collection of music, audio books and podcasts from your Google Drive. It provides the same experience as if you were using the Amazon Music :-)
How I built it
Alexa Skill Kit SDK for NodeJS + AWS CloudFront + AWS Lambda@Edge + AWS Lambda + AWS S3 + AWS DynamoDB + Google Drive API
Challenges I ran into
- Not that trivial to integrate account linking between Alexa Service and the Google API because Google does not allow to use third party domains as redirect URLs for the Auth2. So, we had to build our own web proxy (AWS CloudFront + Lambda@Edge + DynamoDB) as an intermediary between Alexa Service and the Google API to exchange the access tokens.
- The audio player integrated into Echo device sometimes cannot handle the audio file (network issues or incorrect encoding). We implemented the re-try logic that gives us 99% of recovery ratio. As a result users enjoy better experience.
- Alexa struggles sometimes to 'understand' the user's input, especially the long names for the songs or audio books. So, we implemented the ability for a user to 'spell' the name of the playlist or a track. It increased the successful rate of fulfillment of that intent.
Accomplishments that I'm proud of
We already have a visual impairment user who uses this skill for listening his own audio books. My whole family uses this skill every day: listening audio books or music during a day, listening sounds of nature in bed before falling in sleep.
What I learned
AWS provides every possible tool that could help you to solve any kind of technical challenge you may face.
What's next for Sound Drive
We believe that this skill would be very beneficial for the wide audience:
- learning through listening in schools;
- using it in companies as induction or a knowledge sharing tool;
- create your own music collection for relaxing, meditation or self motivation,...
We have some ideas how to improve the skill in the future. And of course, the more challenging task is to promote the skill to the wide range of audience.