trix: Realtime audio over IP
trix is a simple toolset for broadcasting live audio from Linux or macOS. It sends and receives encoded audio over IP networks, via an audio interface. If audio interfaces are properly configured, a low-latency point-to-point or multicast broadband audio connection can be achieved. This could be used for networked music performances.
Audio Transmitter/Receiver over Ip eXchange is based on trx by Mark Hills . The main difference being that it supports ALSA (Linux), PulseAudio (Linux) and CoreAudio (macOS) thanks to the inclusion of the intermediate rtAudio library.
To compile, these dependencies need to be installed. On Debian like systems this can be done with
sudo apt-get install libortp-dev libopus-dev libpulse-dev
For macOS, first install homebrew and then install the following:
brew install opus ortp
Compilation and use
To use trix you need to modify the source code to configure the receiving ip address and the number of channels you would want to send. Then it as simple as calling the correct make instruction. The following builds a streamer binary for pulse audio (Linux) and all binaries for macOS.
After successful compilation binaries will be present in the bin folder.
In order to test the setup trix_streamer is able to stream an audio file over the network. It needs a raw, headerless audio file in a certain format. To create such audio file, open an audio file in Audacity set project rate to 48kHz, and export the audio as float 32bit headerless raw file. Alternatively, SoX, a command line audio editor, can be used to create such a file:
sox input.mp3 −r 48k −e float −b 32 −c 2 bin/48000Hz_stereo_sound_long.raw
If there is a stream playing and you want to receive it ffplay can be used. ffplay is a program from the ffmpeg family.
ffplay -nodisp -protocol_whitelist rtp,file,udp doc/stereo_session_definition.sdp
To configure the ip address of the receiver or the RTP payload type, the source code needs to be modified and recompilation is needed.
Finally to stream output.raw call the following (the filename is hardcoded):
bin/trix_streamer 48000 2
This is a working proof of concept which is tested on several systems. To use this software you need to be able to read and compile source code.
Based on the work trx by Mark Hill, trix was developed by Joren Six. trix is distributed under the same GPL license as trx.