yunkong2.sayit/README.md
2018-11-11 16:11:01 +08:00

7.8 KiB
Raw Blame History

Logo yunkong2 sayit adapter SayIt Adapter可以将文本转换为语音并在某些设备上播放。

配置

  • Browser - 浏览器 - 文本将由浏览器在打开的iobroker.vis页面上播放。它几乎被每个桌面浏览器和少数mobily浏览器支持。

  • Home24- MediaPlayer - 文本将被发送并播放到安装了Home24 - MediaPlayer的Android设备。为此将用于构建Android文本到语音引擎。端口无法更改并设置为50000。

  • Home24 - MediaPlayer and FTP Server - 将在安装了Home24 - MediaPlayer的Android设备上发送和播放文本。对于这将使用谷歌文本到语音引擎。生成的mp3文件将通过FTP复制到Android设备并与Home24 - MediaPlayer一起播放。两个应用程序必须具有相同的主目录。例如“sd card”的根目录

  • System - 文本将由运行yongkong2适配器的OS播放。支持以下操作系统WindowsLinuxMac OSx。

  • Windows engine - the text will be played by windows, where the sayIt adapter runs. For this will be used windows text to speech engine, that should be preconfigured by user. You can check here how to setup it.

  • Sonos - 在sonos设备上播放文本。确保已启用Web Adaptor。需要启用SONOS才能读取生成的mp3文件。

  • Chromecast - play text on Chromecast device.

  • MPD - 在音乐播放器守护程序上播放文本。仅使用http作为Web适配器不要使用https。

要在RaspberryPI或linux系统上启用文本到语音请按照以下命令调用以安装mpg321。

sudo apt-get -y install mpg321

mp3 / wav文件可以通过将其名称写入对象来播放。例如“/vis.0/main/img/door-bell.mp3”

必须首先加载该文件。

用法

SayIt适配器不能单独使用。它必须通过javascript适配器或来自特定小部件的“vis”进行控制。创建适配器实例后可以找到以下对象

sayit.N.tts.text 要说的短语。

sayit.N.tts.volume播放短语将使用的音量。

sayit.N.tts.playing如果正在播放文本则为true否则为false。仅支持“windows”和“system”播放模式。

sayit.N.tts.cachetext要缓存的短语然后可以在没有互联网的情况下使用。例如您可以手动输入“无互联网”如果ping到google.com是否定的请将“No internet”写入“tts.text”它将发音。当然必须启用缓存。 State tts.text支持扩展语法因此langugage / engine和volume可以与文本一起定义。它用于启用多语言text2speech引擎。例如如果适配器具有引擎“Google-english”则可以使用短语de:Sag es来强制使用Google-Deustch语音引擎。

您可以从当前或给定的卷而不是从最大值指定公告的百分比。例如如果命令是de;75;Gutes Wetter并且“宣布音量”是50则宣布将从100可能播放38的音量。

也可以指定播放mp3文件的系统命令。如果将其留空将使用默认设置windows - cmdmp3.exeOSX - / usr / bin / afplaylinux - mpg321或omxplayer推荐

安装omxplayer写入sudo apt-get install omxplayer或写入sudo apt-get install mpg321以安装mpg321。

注意:只有在实例启动后才能进行默认的通知选择。

TTS engines

online:

  • Google: English, German, Russian, Italian, Spanish, French
  • Yandex: Russian
    To use Yandex voices you must request the API key here: https://tech.yandex.ru/speechkit/cloud/doc/dg/concepts/About-docpage/.
  • Ivona: English, German, Russian, Italian, Spanish, French, Dansk, Welsh, Icelandic, Dutch, Polish, Portuguese, Romanian, Swedish, Turkish
    To use Amazon(Ivona) voices you need to get access key and secret key here.
  • Cloud: To use Cloud voices you need configured cloud adapter. (It can be disabled, but must be configured). This service use AWS Polly and it can be used directly.
  • Amazon Web Services Polly: To use AWS Polly voices you need to create access key and secret key here. The Amazon documentation can you find here.

offline:

  • PicoTTS (linux only): English, German, Italian, Spanish, French
    For PicoTTS it is necessary to install the following packages: libttspico-utils and lame.
    Installation command: 'sudo apt-get install libttspico-utils lame'

Cloud and Amazon Web Services Polly text formatting

You can format your text with Speech Synthesis Markup Language.

Most useful features:

  • <break time="3s"/>- make a pause for x seconds (max 10 seconds).
  • <emphasis> big </emphasis> - make an emphasis on some word.
  • <prosody volume="+6dB" rate="90%">I am speaking this</prosody> - control speed and volume parameters.
  • <say-as interpret-as="digits">12345</say-as> - say every digit separately.

More info.

System command

If you have some program, that can play audio files locally or somewhere else, you can write this command here. E.g.

myCustomPlayer --option

If System output is selected, the sayit adapter will execute following command on local system:

myCustomPlayer --option /opt/yunkong2/node_modules/yunkong2.sayit/say.mp3

If file name must stay somewhere in the middle you can use %s to specify where the file name must be placed:

myCustomPlayer --option "%s" > /dev/null

sayIt will make myCustomPlayer --option "/opt/yunkong2/node_modules/yunkong2.sayit/say.mp3" > /dev/null from it.

Usage

SayIt adapter cannot be used alone. It must be controlled from javascript adapter or from "vis" with specific widget. After creation of adapter instance will can find following objects:

  • sayit.N.tts.text: Phrase to be spoken.
  • sayit.N.tts.volume: volume which will be used by playing of the phrase.
  • sayit.N.tts.playing: true if text is now playing and false if not. Supported only for "windows" and "system" play mode.
  • sayit.N.tts.cachetext: Phrase to be cached and then it can be used without internet. E.g. you can enter here manually "No internet" and if ping to google.com is negative, write "No internet" to "tts.text" and it will pronounced. Of course cache must be enabled.

State tts.text supports extended syntax, so the langugage/engine and volume can be defined together with text. It is used to enable multi-language text2speech engines. E.g. if adapter has engine "Google-english", it is possible with phrase de:Sag es to force to use Google-Deustch speech engine.

With ru;75;Погода хорошая we can force to use russian language and volume 75%.

You can specify the volume of announcement in percent from current or given volume (not from maximal). E.g. if command is de;75;Gutes Wetterand "announce volume" is 50%, the announce will be played with volume 38% from 100% possible.

The system command to play the mp3 file can be specified too. If you leave it blank, the default settings will be used: windows - cmdmp3.exe, OSX - /usr/bin/afplay, linux - mpg321 or omxplayer (recommended).

To install omxplayer write sudo apt-get install omxplayer or write sudo apt-get install mpg321 to install mpg321.

Note: The default announce selection will be possible only after start of the instance.

Changelog

1.7.1 (2018-09-19)

  • (BuZZy1337) fixed error in Blockly-Block