Moved documentation for audio & voice actions to multimedia section (#742)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>pull/743/head
parent
c2293a1eff
commit
b7814c7a8b
|
@ -35,19 +35,10 @@ As a general rule, is better to call `MyItem.sendCommand(command)` and `MyItem.p
|
|||
- `Map<Item, State> storeStates(Item item1, Item item2, ... Item itemn)`: Returns a `Map<Item, State>` with the current state of each Item. All members of Groups are put into the Map but not the Group's state itself.
|
||||
- `restoreStates(Map<Item, State> statesMap)`: Restores the items' states from the map. If the saved state can be interpreted as a command (ON/OFF/etc.), a command is sent to the Item. Otherwise an update is sent to the Item.
|
||||
|
||||
### Audio Actions
|
||||
### Audio & Voice Actions
|
||||
|
||||
- `setMasterVolume(float volume)`: Sets the volume of the host machine (volume in range 0-1)
|
||||
- `increaseMasterVolume(float percent)`: Increases the volume by the given percent
|
||||
- `decreaseMasterVolume(float percent)`: Decreases the volume by the given percent
|
||||
- `float getMasterVolume()`: Returns the current volume as a float between 0 and 1
|
||||
- `playSound(String filename)`: Plays the given sound file. The file must be an mp3 or wav and located in `${openhab.home}/sounds`
|
||||
- `playStream(String url)`: Plays the audio stream at the given url
|
||||
- `say(String text)`: Says the given text through Text-to-Speech
|
||||
- `say(String text, String voice)`: Says the given text through the given voice (depends on the TTS engine and voices installed)
|
||||
- ` say(String text, String voice, String device)`: Says the given text through the given voice to the given output device (Mac OSX only).
|
||||
|
||||
To get a list of available voices use `say -v ?` and to get a list of devices uses `say -a ?`.
|
||||
The framework supports several multimedia actions.
|
||||
They can be found in the article about [openHAB multimedia]({{base}}/configuration/multimedia.html).
|
||||
|
||||
### Logging Actions
|
||||
|
||||
|
|
|
@ -7,6 +7,18 @@ title: Multimedia
|
|||
|
||||
# Multimedia
|
||||
|
||||
## Volume
|
||||
|
||||
The framework supports some base [functions](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/model/script/actions/Audio.html#getMasterVolume--) to control the audio sinks' volume.
|
||||
|
||||
### Actions
|
||||
|
||||
-`setMasterVolume(float volume)` : Sets the volume of the host machine (volume in range 0-1)
|
||||
-`setMasterVolume(PercentType percent)` : Sets the volume of the host machine
|
||||
-`increaseMasterVolume(float percent)` : Increases the volume by the given percent
|
||||
-`decreaseMasterVolume(float percent)` : Decreases the volume by the given percent
|
||||
-`float getMasterVolume()` : Returns the current volume as a float between 0 and 1
|
||||
|
||||
## Audio
|
||||
|
||||
openHAB is able to play sound either from the file system (files need to be put in the folder `conf/sounds`), from URLs (e.g. Internet radio streams) or generated by text-to-speech engines (which are available as optional [Voice add-ons](/addons/#voice)).
|
||||
|
@ -23,6 +35,8 @@ The distribution comes with these options built-in:
|
|||
|
||||
Additionally, certain bindings register their supported devices as audio sinks, e.g. Sonos speakers.
|
||||
|
||||
### Console commands
|
||||
|
||||
To check, which audio sinks are available, you can use the console:
|
||||
|
||||
```text
|
||||
|
@ -40,13 +54,15 @@ In order to play a sound, you can use the following command on the console:
|
|||
openhab> smarthome:audio play doorbell.mp3
|
||||
```
|
||||
|
||||
### Actions
|
||||
|
||||
Alternatively the [`playSound()` function](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/model/script/actions/Audio.html#playSound-java.lang.String-) can be used in DSL rules:
|
||||
|
||||
```java
|
||||
playSound("doorbell.mp3")
|
||||
playSound("doorbell.mp3", 25)
|
||||
playSound("doorbell.mp3", new PercentType(25))
|
||||
playSound("sonos:PLAY5:kitchen", "doorbell.mp3")
|
||||
playSound("sonos:PLAY5:kitchen", "doorbell.mp3", 25)
|
||||
playSound("sonos:PLAY5:kitchen", "doorbell.mp3", new PercentType(25))
|
||||
```
|
||||
|
||||
## Voice
|
||||
|
@ -54,6 +70,9 @@ playSound("sonos:PLAY5:kitchen", "doorbell.mp3", 25)
|
|||
### Text-to-Speech
|
||||
|
||||
In order to use text-to-speech, you need to install at least one [TTS service](/addons/#voice).
|
||||
|
||||
### Console Commands
|
||||
|
||||
Once you have done so, you will find voices available in your system:
|
||||
|
||||
```text
|
||||
|
@ -73,15 +92,17 @@ In order to say a text, you can enter such a command on the console (The default
|
|||
openhab> smarthome:voice say Hello world!
|
||||
```
|
||||
|
||||
### Actions
|
||||
|
||||
Alternatively you can execute such commands within DSL rules by using the [`say()` function](https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/voice/VoiceManager.html#say-java.lang.String-):
|
||||
|
||||
```java
|
||||
say("Hello world!")
|
||||
say("Hello world!", 25)
|
||||
say("Hello world!", new PercentType(25))
|
||||
say("Hello world!", "voicerss:enGB")
|
||||
say("Hello world!", "voicerss:enGB", 25)
|
||||
say("Hello world!", "voicerss:enGB", new PercentType(25))
|
||||
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen")
|
||||
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen", 25)
|
||||
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen", new PercentType(25))
|
||||
```
|
||||
|
||||
You can select a particular voice (second parameter) and a particular audio sink (third parameter).
|
||||
|
|
Loading…
Reference in New Issue