I want to have my Google Assistant and Home devices (and Mini) respond to a voice command by playing an MP3 file. How can I do this?
How can I have my Google Assistant and Home devices play an MP3 in response to voice command?
What's your goal, they'll react to properly used audio stimulation....– Helmar ♦Feb 15, 2018 at 18:21
Google Assistant's Actions can return a subset of SSML, part of which allows you to instruct the device to play an audio file such as an MP3. An example is given of the SSML to use in the Actions on Google documentation; I've adapted it below for reference:
<speak> Here is an MP3 file. <audio src="https://www.example.com/MY_MP3_FILE.mp3">didn't get your MP3 audio file</audio>. </speak>
This requires you to be developing an Action — the entire process is a little more complex than that, and more detailed information is available directly from Google. If you aren't interested in that, and just want a simple home solution, read on.
You could alternatively upload your MP3 to Google Play Music, then use a shortcut to map whatever phrase you want to "Play [file name] from my library".
Shortcuts can be configured from the Google Home app, as follows:
Menu > More Settings > Shortcuts > Add
Under 'When I say Ok Google', enter your desired phrase
Under 'Google Assistant should do', type 'Play [file name] from my library' after uploading your file to Google Play Music. It's possible that you might need a paid subscription to do this; try it first and see.
Save your shortcut, and give it a try.