# Multimedia

return to Blockly Reference

# Introduction

In general, this section deals with two topics

  1. Playing or streaming audio to an audio sink e.g a speaker
  2. Saying a text via using any Text-to-Speech API (e.g. Google's API)

It should be noted that both functionalities do not just work right out of the box because e.g for (1) the audio sinks need to be installed in openHAB and for (2) e.g. the whole Google API needs to be configured in particular with your own personal google account. Even though (2) is not trivial but after having done that the usage of the functionality with blockly is very easy and worth the effort.

More about that topic can be viewed at youtube Playing sounds on audio sinks (opens new window)

# Overview of the Voice and Multimedia blocks

voice-and-multimedia

# Setup

# Voice and Multimedia Blocks

# Play Audio

play-audio

Function: Plays an audio file on an audio sink

  • the audio file must reside in the sounds-folder of openHAB that can be found here (opens new window)
  • all available audio sinks are automatically provided by openHABs blocklies

Also view youtubePlaying sounds on audio sinks (opens new window)

# Play Audio with Volume

play-audio

Function: Plays an audio file on an audio sink and setting the volume at the same time

same as above but also allowing to provide the volume at the same time

  • the audio file must reside in the sounds-folder of openHAB that can be found here (opens new window)
  • all available audio sinks are automatically provided by openHABs blocklies

Known issue workaround: In several cases (like the google minis) it is known that setting the volume together with playing the sound results into only setting the volume either during playing the sound or even after the sound has played. In case this happens the more robust approach is as follows

  • Search for the thing of that particular sink and add an in item for the volume channel
  • Then create the following block sequence

play-audio-known-issue-workaround

# Play Stream

play-stream

Function: Starts an stream playing on an audio sink

  • The audio streams must be reachable from the openHAB server and can therefore be either internally or externally hosted
  • All available audio sinks are automatically provided by openHAB's blocklies
  • Changing the volume needs to be done via the thing volume channel linked to the sink device by sending the respective volume level command to that item

More about that topic can be viewed at youtube Play Stream (opens new window)

# Stop Stream

stop-stream

Function: Stops playing the current stream of the specified audio sink

# Say

say

Function: Sends the given text to the sink by using the default Text-to-Speech-Service to translate the text based on the chosen language voice into a stream which is then played on that device sink.

More about that topic can be viewed at youtubeUsing Text-to-speach easily with blocks (opens new window)

return to Blockly Reference