Skip to content

Commit b7814c7

Browse files
cweitkampConfectrician
authored andcommitted
Moved documentation for audio & voice actions to multimedia section (openhab#742)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
1 parent c2293a1 commit b7814c7

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

addons/actions.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,10 @@ As a general rule, is better to call `MyItem.sendCommand(command)` and `MyItem.p
3535
- `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.
3636
- `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.
3737

38-
### Audio Actions
39-
40-
- `setMasterVolume(float volume)`: Sets the volume of the host machine (volume in range 0-1)
41-
- `increaseMasterVolume(float percent)`: Increases the volume by the given percent
42-
- `decreaseMasterVolume(float percent)`: Decreases the volume by the given percent
43-
- `float getMasterVolume()`: Returns the current volume as a float between 0 and 1
44-
- `playSound(String filename)`: Plays the given sound file. The file must be an mp3 or wav and located in `${openhab.home}/sounds`
45-
- `playStream(String url)`: Plays the audio stream at the given url
46-
- `say(String text)`: Says the given text through Text-to-Speech
47-
- `say(String text, String voice)`: Says the given text through the given voice (depends on the TTS engine and voices installed)
48-
- ` say(String text, String voice, String device)`: Says the given text through the given voice to the given output device (Mac OSX only).
49-
50-
To get a list of available voices use `say -v ?` and to get a list of devices uses `say -a ?`.
38+
### Audio & Voice Actions
39+
40+
The framework supports several multimedia actions.
41+
They can be found in the article about [openHAB multimedia]({{base}}/configuration/multimedia.html).
5142

5243
### Logging Actions
5344

configuration/multimedia.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ title: Multimedia
77

88
# Multimedia
99

10+
## Volume
11+
12+
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.
13+
14+
### Actions
15+
16+
-`setMasterVolume(float volume)` : Sets the volume of the host machine (volume in range 0-1)
17+
-`setMasterVolume(PercentType percent)` : Sets the volume of the host machine
18+
-`increaseMasterVolume(float percent)` : Increases the volume by the given percent
19+
-`decreaseMasterVolume(float percent)` : Decreases the volume by the given percent
20+
-`float getMasterVolume()` : Returns the current volume as a float between 0 and 1
21+
1022
## Audio
1123

1224
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:
2335

2436
Additionally, certain bindings register their supported devices as audio sinks, e.g. Sonos speakers.
2537

38+
### Console commands
39+
2640
To check, which audio sinks are available, you can use the console:
2741

2842
```text
@@ -40,20 +54,25 @@ In order to play a sound, you can use the following command on the console:
4054
openhab> smarthome:audio play doorbell.mp3
4155
```
4256

57+
### Actions
58+
4359
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:
4460

4561
```java
4662
playSound("doorbell.mp3")
47-
playSound("doorbell.mp3", 25)
63+
playSound("doorbell.mp3", new PercentType(25))
4864
playSound("sonos:PLAY5:kitchen", "doorbell.mp3")
49-
playSound("sonos:PLAY5:kitchen", "doorbell.mp3", 25)
65+
playSound("sonos:PLAY5:kitchen", "doorbell.mp3", new PercentType(25))
5066
```
5167

5268
## Voice
5369

5470
### Text-to-Speech
5571

5672
In order to use text-to-speech, you need to install at least one [TTS service](/addons/#voice).
73+
74+
### Console Commands
75+
5776
Once you have done so, you will find voices available in your system:
5877

5978
```text
@@ -73,15 +92,17 @@ In order to say a text, you can enter such a command on the console (The default
7392
openhab> smarthome:voice say Hello world!
7493
```
7594

95+
### Actions
96+
7697
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-):
7798

7899
```java
79100
say("Hello world!")
80-
say("Hello world!", 25)
101+
say("Hello world!", new PercentType(25))
81102
say("Hello world!", "voicerss:enGB")
82-
say("Hello world!", "voicerss:enGB", 25)
103+
say("Hello world!", "voicerss:enGB", new PercentType(25))
83104
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen")
84-
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen", 25)
105+
say("Hello world!", "voicerss:enUS", "sonos:PLAY5:kitchen", new PercentType(25))
85106
```
86107

87108
You can select a particular voice (second parameter) and a particular audio sink (third parameter).

0 commit comments

Comments
 (0)