Table of Contents

In this knowledge base article we will go through the explanation of how to setup your IP Speaker Barix device to playback files stored in its internal memory with a command sent over network using the UDP protocol. 


All Barix hardware devices (M400, TPA400, MPA400, S400, SP400) support up to 8GB of internal storage space. Consider that the space available for local audio files is limited to ~7.5GB.

Each audio file uploaded must have a maximum size of 16MB


  • Alarm playback: Barix Barionet contact closure device can be programmed so that if its contacts are closed (i.e. from a Fire Alarm panel) a message is played out from IP Speaker 
  • Notifications or announcements: messages can be played manually from a trigger received from a network device (a CMS, a PC programmed to send out the UDP command based on a certain condition, repeated messages sent out by a scheduler to trigger scheduled playback announcements)


  1. Setup one of the SOURCES in IP Speaker as "Local Files"
  2. Decide which port the device should start listen to for the incoming UDP command (any port from 8000 to 8999)
  3. Click on Submit

  4. Locate the AUDIO FILES tab and upload your announcement, alarm, message, information in there. 

    Audio Files Supported

    The device supports MP3, AAC, FLAC, AC3, DTS, OGG, WAV files.

    The filenames should NOT contain special characters and must have maximum one space character in the name.

    The limit of individual files to be uploaded is 16MB.

    It is possible to upload .zip archives to upload multiple files at once.

    Take note of the name of the file that you want to trigger the playback (including its extension)

The device now is listening to the specified port for an incoming command. The command that the device expects to receive is the following: FILEPLAY=myFileName.ext\n

Example of configuration using Barionet

Barix Barionet devices allow an easy way to send UDP messages when contact closure are closed. Here is what you need to run this setup: 

  • Barionet 1000 or Barionet 400
  • A lua or bash script to run the program

 In FW releases >= 2.17 Barix introduced an easy way of loading your scripts / programs into the device. 

Below is a LUA script that can be used to trigger the UDP message to be sent when the contact closure 1 is closed (valid for B1000 or B400). 

Configuration must be modified to suit your network configuration and fileName to trigger. 


local socket = require "socket"											--dependencies
local udp = socket.udp()

-- The UDP Sender function is used to send the UDP command to a specific IP and Port - Insert the right IP and Port to the corresponding variables - Add the command to be sent via UDP to the udp_command variable
function UDP_sender_file1()
	local socket = require "socket"
	local udp = socket.udp()

    ipspkr_ip = "XXX.XXX.XXX.XXX" 										-- Define Destination IP
    ipspkr_udp_port = XXXX      										-- Define destionation Port 

    udp_command = "\n"   							-- Define the string to be sent, the actual command

    udp:setsockname('*', 0)
    udp:setpeername(ipspkr_ip, ipspkr_udp_port)
-- Sleep function to temporize the iteratrion in the app function (see below)
function sleep(sec)

-- my main application: a loop that keeps the digital input 1 of barionet is monitored and if value is 1 it calls the UDP sender function
-- This function can be re used to read changes in specific files of the system, just use the correct path

function app()
	while true do
	local file ='/dev/gpio/in1/value','r') 						-- Change the patch according to where the change must be read. In this example the gpio value of Digital Input 1 is monitored. 
	local in1 = file:read('*n')
		if in1 == 1 then
			print(" UDP Command: "..udp_command.."was Sent at: ""%c").." UTC".."\nto this Socket: "..ipspkr_ip..":"..ipspkr_udp_port);
			sleep(5) --wait 5 seconds

-- Call the app function to run the application

To upload the above script in your Barionet device: 

  1. Connect to the Barionet web interface and enter username and password to access the main configuration interface
  2. Find the "CUSTOM APPS" Tab
  3. Upload the script above as a .lua file
  4. Enter the EXECUTION COMMAND to be used to start the application and decide if this has to run always at boot (command is normally this: lua fileName.lua, in this example: lua ipspeaker.lua)
  5. Click on SAVE 
  6. When the status shows RUNNING it means the application is monitoring the input 1, when this is closed (contact is closed) it sends the UDP message to the IP Address and Port number of your IP Speaker to trigger the Alarm 

See below the Barionet web interface to check the configuration

Example for testing the UDP command using Windows

A good application for Windows to send packets over UDP / TCP or other protocols is Packet Sender (

Its configuration is very easy and allows the possibility to test the functionality fast. There are few things to configure: 

  1. The ASCII text (the actual content of the message, thus the command that IP Speaker expects to receive) 
  2. The IP Address where to send this command, so the IP Address of your IP Speaker device
  3. The Port, must be the same as the one specified in the IP Speaker Source tab 
  4. The Protocol has to be UDP 

In packet sender is also possible to save the messages so it is easier the next time to repeat the test. 

Click on SEND and make sure to be able to hear the audio output on your IP Speaker device. 

Example of sending a UDP message using Linux CLI

Linux distributions offer a variety of ways to send UDP or TCP packest over network, here we will describe the ones built in that uses a built-in utility in the CLI. 

  1. Open the terminal application 
  2. Type the following command: 

    echo > /dev/udp/<IP_Address>/<Port>

    i.e.: echo FILEPLAY=Alarm.wav > /dev/udp/

Note that using this utility it is not necessary to enter the newline at the end of the string sent. Check if in your application the newline "\n" at the end of the string is required for the message to be interpreted correctly by IP Speaker. 

Another method for sending UDP or TCP messages over the network i Linux is using Netcat. Full tutorial is available at this link:

If the device doesn't behave as described above despite following all the steps described, please contact