On This Page

Related Pages

Audio

Control audio play/pause, volume, speed

The Audio widget plays an HTML5 audio file, and can control the play/pause state, the volume, and the playback speed of the sound. It also has options to loop the sound forever, and to play continuously regardless of the play/pause input value.


Instructions

1 Set Audio File

In the more tab, set the file name (.wav or .mp3) that’s local on your device. The files are located in the NTK application directory:

App: NTK.app>Contents>app>dist>assets>audio>song_part1.wav (on Mac, open app with right/control-click, Show Package Contents)

Command Line: NTKserver>assets>audio>song_part1.wav

Place your own files in this directory, and put the filename in the widget

ntk_app

2 Connect

Connect one or more input widgets to control:

  1. Play – If the value is less than 500, the audio will be paused, if 500 or more the audio will play.
  2. Volume – Accepts a range from 0 – 100, where 0 is silent, and 100 is maximum volume.
  3. Speed – 100 is normal speed and zero is stopped. The values accepted depend in the browser – negative values may allow reverse audio in some cases. Numbers higher than 100 play the audio faster than normal.

3 Adjust

Widget

  • Loop – If you check the loop checkbox, the audio will loop forever when the widget is in Play mode.

More tab

  • Continuous – If you check the continuous checkbox, the audio will always play, regardless of the input value sent to the play/pause input at the top left. This is useful if you want the audio file to play all the time, but control if it is heard by adjusting only the volume.
  • Audio File – You can replace the default audio file by putting the location of your .mp3 file in this box. For example, if your on your hard drive, place it in the NTK folder, in dist>assets>audio. If the .mp3 is on a website, use the full address for the file – e.g. http://netlabtoolkit.org/MySong6.wav
NETLabTK - Tangible IoT