[mh] Alexa TTS
Brian Rudy via misterhouse-users <[email protected]> Tue, 17 May 2022 16:54:17 -0700
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <[email protected]> |
Hi folks,
I was recently doing some reading on recent updates to the Alexa Skills
Kit APIs this past weekend and happened upon
https://github.com/thorsten-gehrig/alexa-remote-control . This struck a
chord as this tool leverages ASK APIs that provide an ability to do
unsolicited TTS on one or more devices. Our household has various types
of Echo devices spread across the house that can control MH, but I
hadn't until this point discovered a way to send unsolicited audio or
TTS to them. Alexa-remote-control demonstrates a way to do this, so as
an experiment, I whipped up a simple wrapper script to send MH speech
output to the Alexa devices in the /Everywhere /group (note that you
will need to set environment variables or modify alexa-remote-control.sh
to apply the appropriate options for your locale/refresh
token/language/etc for you)
/#!/usr/bin/perl -w/
/#/
/use strict;/
/use Getopt::Long;/
/my $alexa_remote = "/usr/local/bin/alexa_remote_control.sh";/
/my %parms;/
/&GetOptions( \%parms, 'to_file=s', 'voice=s', 'volume=s', 'pitch=s',
'rate=s' );/
/my $text = shift @ARGV;/
/if (defined $parms{voice}) {/
/ $text = "<voice name='" . $parms{voice} . "'>" . $text . "</voice>";/
/}/
/my $response = `$alexa_remote -d Everywhere -e
speak:"<speak>$text</speak>"`;/
In mh.private.ini I have the following to specify the /Matthew /voice
and allow use of the other Amazon Polly voices available in the en-US
locale:
/# Alexa remote specific stuff/
/voice_text = program /usr/local/bin/alexa-remote.pl/
/voice_names = female=>Joanna, male=>Matthew, child=>Justin,
child1=>Ivy,/
/ Ivy=>Ivy, Joanna=>Joanna, Kendra=>Kendra,/
/ Kimberly=>Kimberly, Salli=>Salli, Joey=>Joey,/
/ Justin=>Justin, Kevin=>Kevin, Matthew=>Matthew/
/speak_voice = Matthew/
Despite it's simplicity, it works really well, but obviously has a lot
more capabilities. It should be straight forward to rewrite the
functionality provided in alexa_remote_control.sh natively in Perl if
desired.
In any case, hopefully someone may find this useful.
Cheers!
-Brian
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users