Need Help Creating a Sounds Skill - Doable not Doable?


#1

I wanted to create a skill that plays sounds as answers to questions, Things like “hey mycroft, whats a dog;s bark sound like” or airplane, or a combustible engine at 4000 rpm’s etc. and have mycroft respond with that sound, no words just the sounds. then randomly with different or specifically asked for dogs, an airplane manufacturer, different machines etc.

I thought it would be as simple as adding the path to an mp3/wav in the dialog directory but all that does is spell out the path to the mp3. Any ideas?


#2

Have a look at some created skills at github. You could probably use some of them as an example on how to make them interact with whatever environment you want.


#3

You could use python subprocess module, and then use aplay to point to the mp3 path and play the sound. It would look something like this

import subprocess

subprocess.POpen("aplay /path/to/mp3", shell=True)

More about the python subprocess module can be found here https://docs.python.org/2/library/subprocess.html