Intro

Jamulus is a open-source software for playing music online together. It emphasizes low latency audio transmission so that the different musicians don’t stumble over each other. You know how a video conference sometimes doesn’t work - when the latency is so big that you always interrupt the other.

There are a few things to bring the latency down: First, there is the network latency. So, it’s better to use a server nearby. Then there is the audio latency on your hardware: there are different optimizations (like Jack on Linux). All these have different buffers (network buffer, audio buffer in your sound card) that can be tweaked as well. And lastly, there is the physical latency: the speed of sound is 340 m/s or 0.34m/ms or 34cm per millisecond. That means, if you put the microphone 34cm away from your sound source (e.g. your instrument), then you add one millisecond latency.

Jamulus has a small indication light, that shows the latency quality: green is good, that means, the total latency is smaller than 40ms, yellow should be still ok (e.g. less than 80ms) and everything bigger is red and will probably cause problems. Or as Jamulus explains it: “If this LED indicator turns red, you will not have much fun using the Jamulus software”.

Jamulus is a client-server solution. That means there is a central server and multiple clients. Each musician connects to the same server and the own audio is sent to the server. The server broadcasts the audio then to all other musicians who are connected to the same server. There are some public servers available, but it’s also possible to set up an own server. Then you can be sure to be by yourself. Since the server receives the audio stream from each client and copies it to all others, it must have enough bandwidth. Per client, you can calculate with 500kbps in and out. The more clients, the bigger your connection must be on the server.

Install your own server

There are good guides already available, e.g. Server Linux in the official Jamulus wiki. There is unfortunately not yet a Debian packages, but that is in the making (see Debian bug #958146).

So here just a very short description, what needs to be done:

1. Compiling: Since there is no package yet, you need to compile Jamulus yourself. For the server, you can create a Jamulus build without audio support and without gui (headless).

I’ve used the latest tag r3_6_2 and used the tar bundle available there.

And I’m using a Debian system.

Install build dependencies:

sudo apt install build-essential qt5-qmake qtdeclarative5-dev qt5-default qttools5-dev-tools libjack-jackd2-dev

Download and extract the sources:

wget https://github.com/corrados/jamulus/archive/r3_6_2.tar.gz
tar xfzv r3_6_2.tar.gz

Compile:

cd jamulus-r3_6_2/
qmake "CONFIG+=nosound headless" Jamulus.pro
make clean
make

Now the single binary is available in the current directory: Jamulus

2. Installing: Next step is installing this binary.

Copy the binary to /usr/local/bin:

sudo cp Jamulus /usr/local/bin/Jamulus

Setup a own user. This is the user, under which the Jamulus server will run later:

sudo adduser --system --no-create-home jamulus

Create a new systemd config file as /etc/systemd/system/jamulus.service with the following content:

[Unit]
Description=Jamulus-Server
After=network.target

[Service]
Type=simple
User=jamulus
Group=nogroup
NoNewPrivileges=true
ProtectSystem=true
ProtectHome=true
Nice=-20
IOSchedulingClass=realtime
IOSchedulingPriority=0

#### Change this to set genre, location and other parameters.
#### See [Command-Line-Options](Command-Line-Options) ####
ExecStart=/usr/local/bin/Jamulus --server --nogui --port 22124 --numchannels 40 --norecord

Restart=on-failure
RestartSec=30
StandardOutput=journal
StandardError=inherit
SyslogIdentifier=jamulus

[Install]
WantedBy=multi-user.target

Here you can set the command line options for the server. In my example, I use port 22124 (which is actually the default port) and I limit the number of clients. Jamulus would also support recording the audio, which I’m not interested in and disabled it.

Now start end enable this new service:

sudo chmod 644 /etc/systemd/system/jamulus.service
sudo systemctl start jamulus
sudo systemctl enable jamulus # enable at boot

You can either use sudo systemctl status jamulus or sudo service jamulus status to check whether it is running and see the last log entries. If something fails, you can have a look there for clues. If the output says “active (running)”, then Jamulus is working.

More logs can be looked up with sudo journalctl -u jamulus.

3. Network: If you have a firewall, you need to open up the UDP port 22124. E.g. sudo ufw allow 22124/udp.

Note: There is no authentication. Everybody who knows your server can connect.

Linux Client

Now it’s time to connect to the server. You can compile Jamulus locally (see above, but don’t use the extra CONFIG flags) or if there is a package available for your distro, you can download it.

Jamulus uses jack, so you need to install it. I have pulseaudio, so while using Jamulus/jack, you need to disable pulseaudio.

Here’s in short, how to get started:

  1. Start qjackctl. That’s a tool to configure jackd, start it and stop it. Under settings you can configure the “server prefix” which is used to start jackd. Use here pasuspender -- jackd. That will suspend pulse audio and start jackd - the jack daemon. In the same settings, you can select your driver and audio hardware and choose your input and output devices. I used “alsa” as audio driver and selected my microphone and speakers. In the main menu of qjackctl you can start jackd with a click on the play button.

  2. Start Jamulus. Select “connect” and enter your IP-Address and the port number, e.g. 1.2.3.4:22124. Under “View” -> “My Profile…” you can setup your name that is displayed to other users.

  3. Use alsamixer to control the microphone gain.

  4. Have fun.

In the end, disconnect and exit Jamulus. Stop jackd with qjackctl and exit qjackctl. Then you might need to run pulseaudio -k in order to restart pulseaudio and get it working again.

Next steps

For the server, some minimal monitoring would be nice: Server is up, cpu usage, number of clients, traffic usage etc. More to come.

References