Skip to content

Headless

The desktop app can play with no window, for a small computer that sits beside a node and feeds a synth: a Raspberry Pi, a server, or a laptop with its lid shut. Add --headless to the desktop command line:

java -jar aether-X.Y.Z-desktop-linux-x64.jar --headless --tcp meshtastic.local --midi VirMIDI
./kotlin run -m desktopApp -- --headless --demo --midi "Surge XT"
  • The connection comes from --demo, --replay, --tcp host[:port], --serial PORT or --mqtt [BROKER] (with --mqtt-topic ROOT), else from the saved connection. Bluetooth needs the connect screen's scan, so a headless run uses Network, USB, MQTT or Demo Mode.
  • --genre <id> picks the music generator (ambient, the default, or the experimental dub, trance, house and lofi). --genre-list prints the available genres.
  • With a MIDI output, from --midi NAME or saved under Settings > MIDI output, only that output plays. No sound card is opened, and the built-in synth isn't run, so it costs little. --midi-list prints the outputs.
  • --stream [PORT] serves the built-in synth over the network instead of the speakers, at http://<this computer>:PORT/ (port 8000 when none is given). No sound card is needed. See Stream.
  • --video [WxH[@FPS]] adds the scene as video, with the music, at http://<this computer>:PORT/video beside the stream, or pushed to a server with --video-to URL. It needs ffmpeg. See Video.
  • With no MIDI output and no stream, the built-in synth plays through the speakers.
  • --tune key=value[,key=value] holds Debug Panel parameters at a value for the run, inside the engine's comfort ranges, for example --tune turn-time=900,phrase-speed=0.75 for a slower install. The keys are in Mesh-driven parameters.
  • --channels 5.1 or --channels 7.1 plays the built-in synth in surround: nodes sit around the room by their bearing from yours. The speakers fall back to stereo when the sound card takes fewer channels, and the log's channels= line says which played. The default is 2.0.
  • The saved Release, MIDI delay and Play the built-in synth too settings apply. With Play the built-in synth too on, the speakers play along with the output.
  • It plays at full volume and ignores the saved volume and mute. The MIDI velocities follow the music alone.
  • The log goes to stdout and to aether.log, with one line a minute on what was heard and what is playing.
  • A connection that drops reconnects with backoff, as it does in the window.
  • Ctrl-C or SIGTERM ends the session: the connection closes and every MIDI note ends.

A headless run doesn't check for updates. It stops with a message and exit status 2 when there is nothing to open, when the MIDI output it names isn't there (the message lists the outputs that are), or with --ask or a bad flag value.

It also watches its output. When the speakers, the stream or the MIDI clock take no audio for 10 s (a hung sound card, an output thread that died), it logs audio output stalled and exits with status 3, so the service below restarts it.

Stream

--stream serves the music as an endless 16-bit, 48 kHz WAV over HTTP, stereo or, with --channels, 5.1 or 7.1, on every network interface of the computer. Open the address in VLC (Media > Open Network Stream), mpv, ffplay, or a browser:

java -jar aether-desktop.jar --headless --tcp meshtastic.local --stream 8000
mpv http://aether-pi.local:8000/
  • It's uncompressed, about 1.5 Mbit/s for each listener, so it suits a local network rather than the internet. Up to 16 listen at once.
  • A listener that falls more than two seconds behind is dropped, and can reconnect. Players buffer a second or two, so the stream runs that far behind the node.
  • With --midi, the output plays too, and the stream keeps the built-in synth.
  • Anyone who can reach the port can listen. Keep it on a network you trust, or put it behind a firewall or a reverse proxy.

Video

--video draws the scene with no screen and sends it, with the music, as H.264 video and AAC audio in MPEG-TS. It needs ffmpeg on the PATH (sudo apt install ffmpeg, brew install ffmpeg), and either --stream to serve it or --video-to to push it:

java -jar aether-desktop.jar --headless --tcp meshtastic.local --stream --video 960x540@30
mpv http://aether-pi.local:8000/video
java -jar aether-desktop.jar --headless --mqtt --video 1280x720 --video-to rtsp://localhost:8554/aether
  • The size is WxH with even sides, up to 3840x2160, with an optional @FPS from 1 to 60. --video alone is 960x540 at 30 frames a second.
  • /video plays in VLC, mpv and ffplay, and runs a second or two behind, as the player buffers. Up to 4 watch at once, and each starts on the next keyframe, at most two seconds after it connects. The WAV at / keeps playing beside it.
  • --video-to pushes to an rtsp://, rtmp:// or srt:// URL, for a media server such as MediaMTX, OBS or a live stream. A media server is also the way to reach a browser, through its WebRTC or HLS output. With --stream as well, the stream port serves the same video.
  • --video-encoder nvenc encodes on an NVIDIA GPU through ffmpeg's h264_nvenc in place of x264 on the CPU, which frees about one core at 1080p30. The scene is still drawn on the CPU, and ffmpeg must have NVENC (ffmpeg -encoders | grep nvenc). The default is x264.
  • The bitrate stays under 2.5 Mbit/s at 540p30, scaled by pixels per second (about 4.5 Mbit/s at 720p30).
  • The visual, brightness and genre are the saved ones, or --visual, --brightness and --genre.
  • The scene is drawn on the CPU, split across every core. When a frame takes longer than its slot, the frame before it is repeated, so the picture stays on the music, and the scene draws fewer nodes until it keeps up, as the window does. On four 2.1 GHz cloud cores, 540p at 30 frames a second uses about 1.5 cores and 720p about 2, ffmpeg included. A Raspberry Pi hasn't been measured; start at 960x540@24 there and watch the log's fps=.

Run it as a service

On Linux, a systemd user unit keeps it playing across logouts and restarts it if it stops, including after a stalled output's exit status 3:

# ~/.config/systemd/user/aether.service
[Unit]
Description=Aether
After=network-online.target

[Service]
ExecStart=/usr/bin/java -jar %h/aether/aether-desktop.jar --headless --tcp meshtastic.local --midi VirMIDI
Restart=on-failure
RestartSec=10

[Install]
WantedBy=default.target

Then systemctl --user enable --now aether and loginctl enable-linger $USER, so it starts at boot without a login.

A synth on the same machine

Java sees ALSA hardware ports, not sequencer clients, so a software synth such as FluidSynth or Surge XT needs the snd-virmidi bridge: sudo modprobe snd-virmidi, start the synth, then aconnect -l to find both and aconnect the VirMIDI port to the synth. Name the VirMIDI port with --midi VirMIDI. The synth needs MPE on channels 2 to 15 (drums come on 16) with a bend range of 48 semitones; see MIDI output.