LEVEL UP YOUR ALEXA TTS in Home Assistant

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in today's video we're going to be having a look at all of the sound related things or at least all of the sound related things that i could think of that i make use of and this includes things like notifications text-to-speech sequences sound effects custom sound effects and a couple of other little bits check it out [Music] what's going on guys i hope you're all doing well it's been a little while but in the previous video i run through the full setup and install of the media player so if you're wanting to follow along with this video be sure that you've got that set up and installed another thing to note here is that i'm making use of nabucassa in order to access my home assistant externally and while this isn't a requirement it does make it a lot easier to do some other things like accessing custom mp3s and again it's not a requirement you can do it without but there may be a couple of hoops that you need to jump through as always with my videos this one is chaptered so if there's a particular feature that you want to check out and use be sure to make use of those timestamps in the description below also in the description is a link to my github where you'll find all of the code that i'm going to be showing you in today's video so with all of that said let's get into it first up is the ability to play some text-to-speech on a targeted echo device and i did run through this in the previous video so i'm just going to quickly glide over it again now so open up your developer tools and from here we're just going to select services up at the top with that open we now need to choose the service and the particular service we're going to be using is a notify service and we're going to be using the notify service for the set echo device that we want to call in the service box if you start typing notifications you should see the drop-down list start to populate with all of the different devices that you can target with the notify servers so i'm just going to scroll through here and i'm going to find the echo that's on my desk with that done we just need to provide two parameters for this notification to actually work and those two parameters are the message and the data inside the message you can write whatever message you want the echo to say and for the data we need to tick the little box and just give it the type of tts for text to speech that's everything we need to do for this notification and if we hit this call service button here we should hear that notification play out on our chosen device hey and this is a great way to add text-to-speech to various scripts and automations but what about if you want to just do this on the fly what about if you want to just randomly type something in and just have it automatically play out well if that is the case this is exactly where the mini media player card comes into hand if you're not familiar with the mini media player card you can download it directly through hacks using the front end it's a simple one-click install with the mini media player card installed we can add it directly to our dashboard by just going into edit dashboard and adding a card from here you can just start typing mini media and as you do that you should see the mini media player appear if we select that you'll see that there's a bunch of different customization options available and there are lots of different things that you can do with this card but the primary aspect that we're going to look at and actually care about in this tutorial is just the text-to-speech the first thing we need to do is provide an entity and this is going to be the entity of our media player so i'm going to go ahead and do that now once you've selected the entity for your media player you should see that on the side here you get a preview of what it looks like and as i mentioned we want to be able to type something in and just have it play out but there's no options here to actually type something in and there's no settings available here to actually show us that text to speech box so what we're going to need to do is press the show code editor button in the bottom left and from here we just need to paste in a couple of lines of code these three lines just tell the mini media player that it's text to speech and we also identify which platform it is there are a few other platforms available that you can use like google home and sonar say but we're just making use of the echo here and again we also need to specify the entity that it's going to be targeting so in my case here it's just this office desk sonos which is the same entity that we use in here if we go ahead and press save you'll notice now that there's a bar here with text to speech and if we just press done in the top right corner you'll see that we've got this slim card that gives us the volume control a couple of track controls and then this bar in this little text-to-speech bar we can type out whatever we want and when we press the little send button it's going to play on our chosen echo subscribe below and it's as simple as that and it's just a really nice way to have something where you can type something in and just have it play out it also works really well on mobiles and tablets and it's very useful if you want to just do a quick notification to play to somebody upstairs moving ever so slightly away from text to speech we have sequence commands and these are essentially predefined commands that the echo understands so you can pass it a command title and it will understand what to do with that you'll find a list of the known working sequence commands over at the echo wiki page and you'll also find that linked in the description some of the useful sequence commands are things like telling you about the weather telling you about your set calendar or even just telling you a joke to use the sequence command we're going to need to head back to our developer tools but we just need to change up our servers so up at the top there we need to change our service from a notify service and we're going to be using the media player play media service to quickly clear all this up we can just click the x button on the service bar and now in the blank service bar we're just going to start typing media player play media and as you start typing that you'll see that we get a few different options to choose from you want to ensure here that you're choosing media player play media and not the similar name to media player media play with that selected there's a few parameters that we need to fill in the first one is the target and this is going to be the entity that we're actually targeting so again i'm going to be targeting my desk sonos so if i just choose the choose entity button i can select from a list of all the different available media players next up is the content id and the content id is going to be the title of our sequence so if we head over to the wiki page you'll see on that page a list of all the different sequences that we can make use of so i could just choose from any of these different ones and i'm gonna go with this one the fun fact so all we need to do is just copy this and then back over at the developer tools we just need to paste this in under content id next up we've got the content type and what we need to do here is just tell the service what this actually is so this is a sequence so in content type here we're just going to type out sequence with that all done we should now be able to play that sequence and there is this option here for nq but we don't need to worry about that as we can play this without ticking any of those boxes so make sure you've got those three options done and then just choose cool service the furthest travelled man-made object in space is the voyager 1 space probe launched in 1977. and with that done you should hopefully hear your fun fact or whatever sequence you chose up next we've got sounds and sounds work in a very similar way to sequences so all we need to do is just do a couple of modifications to that sequence that we already wrote and we can just modify this to be a sound call to change this over from a sequence to a sound all we need to do is just update the content type from sequence to sound and for the content id rather than using a sequence command we need to use the id of one of the different sound effects and again you can find a list of the known working sound effects on that wiki page with that all changed over you can just go ahead and press call service and you should hear that sound effect if you're on the wiki and you expanded that list of known available sounds you'll know that there's not really that many that you can choose from however if you head over to the echo developer documentation there's a whole bunch of different sounds that you can make use of and you can actually also search for a specific sound so if you've got one in mind that you'd like to use you could do a little search and it may be there so for example what if i wanted the sound of a siren in this search bar here i can just start typing cyrun and you'll see there that the list starts populating with all of the different siren sounds that the echo knows about and what's cool about these is you can actually test them out and play them in the browser by just selecting them there is a small caveat here with copying the sounds from there you can't just copy and paste that directly into the play media cool like we did with the previous sound effects what we instead need to do is just change that service call and we need to swap this back to a text-to-speech notification so let's do that now and before we swap back to our developer tools tab we need to choose a specific sound i quite like the siren sound so i'm just going to click this copy to clipboard button here and then i'm just going to flip back to my developer tools tab so just like we did in the first part of the video we need to set up a notification here again i'm using my office desk sonos and we also need to specify the data with type tts unlike before with the message we're not just going to type something in but what we are instead going to do is we're just going to paste that url that we've got copied in our clipboard and with that pasted in we can just go ahead and press cool service when you do that you'll hopefully hear this custom sound play out on your chosen echo and what this is actually doing is the echo's interpreting this url that you gave her and it's just gonna translate that and play the sound that you chose what i really like about this one is the fact that you can combine text with that sound effect so my example above there i've got a little warning message so after it plays that warning message it will just automatically play that sound wherever i put that in the message body and that's really cool there's lots of cool customization things or different ideas you can actually create and use by following some of those but what about if you want to get really custom what about if you want to record your own sound or your own sound effect and have those play let's look at that now so you can indeed create your own custom sound effects and i have previously created a video on this so if you want a bit more information maybe check out that video as that's more of a deeper dive into doing this so there's a couple of caveats with creating your own sound effects first of all they have to be in mp3 format and they need to use a specific codec and also a specified bitrate there is a bit of information on this over at the amazon developer page and again that's linked below so if you wanted to you could create your own mp3 and convert it to that specific format and then use it like that alternatively if you didn't want to do that manual work you could just use an online converter and have that convert the file for you once you have your echo compatible mp3 file you'll need to place this in your www directory and if you haven't got that directory you'll need to create that first once you have that directory you'll need to place your sound file within it what i like to do is just have a separate folder for all of the mp3s so i just create a folder in there called mp3 then i just place my custom mp3 file within that if you've got your custom mp3 file now under uww directory you can just go ahead now and create a blank new text-to-speech notification in your developer tools with that done you'll now just need to update the message body and that message body is going to contain a link that's going to link directly to your mp3 file so in my case here because i'm using naboo kasa it's going to be my naboo casa address followed by forward slash local forward slash mp3 forward slash the name of the mp3 file with that done you can again go ahead and press cool service and you'll hopefully hear that mp3 sound play out if this doesn't work for you or you get an error message the first thing you want to check is that you can actually target this mp3 file and you can do that by just copying the url and just pasting that directly into your browser and it should take you to a page like this where you can actually play the mp3 file if you can access that file and it plays but the echo tells you an error message instead then more than likely the encoding is wrong on that mp3 file so you may need to just tweak your settings to adjust that so check out those guides or check out one of the free online converters you can use to actually convert the files i quite liked using the audio converter from jovo you simply just upload your custom mp3 and it will spit out the echo compatible file and you can then just put that straight into home assistant and start making use of it again if you want a bit more help on this with actually setting up and using custom sound effects then be sure to check out the official documentation or also there is that video that i created on this a little while ago and just as one final one just to squeeze this in on the end here you can also send a text-to-speech notification to all of your echoes or individual groups so within the amazon echo app you set up groups of speakers and they have to be official echoes they can't be things like the sonos like i've been showing you throughout the video so if it's an official echo or you can add it to a group then you can target these groups and in order to set this up the service that you need to target is the notify.alexa media service you then just need to pass in three parameters and these parameters are going to be the message that you want to be announced you then need to select the target here i'm targeting all echoes and again this all echoes group is set up within the alexa app so set that up and then you'll be able to see it in here then the data that you want is type announce then when you hit call service you'll hear the little bing bong sound and you'll be able to play that message across any echoes that you're targeting and there we go guys that's been a quick look at some of the different sound related things that i do with my echoes and home assistant what's cool about all the different methods that we've had a look at today is the fact that they can all be used within scripts and automations so you can do lots of weird and wonderful things all with text-to-speech and different sound effects if there's any features that have skipped over or a specific feature that i haven't talked about that you'd like to see then let me know in the comments below next up in part three which will hopefully be a bit sooner we're going to be looking at how you can trigger different routines and run home assistant automations all from using your echoes if you have enjoyed this video don't forget to drop me a like and if you're not already hit that subscribe button and ding dong the notification bell you'll then be alerted to any future video that i do and as always a massive thank you to these awesome dudes these are awesome dudes in my patreons if you're interested in helping support my channel which in turn allows me to create content like this then you'll find a link to my patreon in the description below if you want some more help or a bit more information on those custom mp3s then be sure to check out this video here or if you want to see some of the other things that i've done with the amazon echo and home assistant then check out this playlist here thank you for watching and i'll catch you in the next one cheers [Music]
Info
Channel: Mark Watt Tech
Views: 39,950
Rating: undefined out of 5
Keywords: MarkWattTech, HomeAssistant, Hassio, Home Assistant, Smart Tech, Smart Home, Mark Watt, Automations, Home Asistant, Alexa, guide, tutorial, Text to speech, speakers
Id: M3-m2fDttmg
Channel Id: undefined
Length: 13min 34sec (814 seconds)
Published: Fri Jun 10 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.