Network Music

Play MP3s straight off a NAS, a spare box with nginx or Apache on it, or any other HTTP server the radio can reach — browse its folders on the radio's screen or in the web player, with the track length read out of the file itself. No cloud, no account, nothing uploaded anywhere. The configs below are the whole of it. Serving it costs almost nothing: this was tested under nginx, and on an ESP32-P4 handing out files from its own SD card, where it runs without trouble.

http://atlascube.net/music/test/

A live server in the format below, with three short MP3s on it. Paste that address into the radio and you can tell in a minute whether the feature works, before setting up a server of your own — or see the JSON listing it returns. The tracks are our own test tones; keep the trailing slash.

What the server has to do

One thing, and it is the thing people trip on: answer a directory request with JSON. AtlasCube does not scrape HTML index pages — it parses a JSON array in the format produced by nginx autoindex_format json. Point it at a plain HTML index and it will tell you so rather than pretending the folder is empty.

Plain http:// only — the radio refuses https:// here and does not follow redirects, so a host that pushes everything to HTTPS will not work at all. That is also the reason a server on your own network is the easy answer: there is no TLS on this path and no authentication, so anything you put on a public host is readable by anyone who finds it, and the traffic crosses the internet in the clear. It will work from anywhere the radio can reach — whether it should is your call, not a limitation.

A complete nginx server

server {
    listen 8090;
    server_name _;

    root /srv/music;
    charset utf-8;
    sendfile on;

    location / {
        autoindex on;
        autoindex_format json;
    }
}

Why each line is there

autoindex on;
autoindex_format json;
The listing itself. Without the second directive nginx serves an HTML page, which the radio rejects as a non-JSON directory listing.
charset utf-8; Track and folder names outside ASCII. The device keeps names as raw UTF-8 and percent-encodes them when it builds a URL, so the listing has to be UTF-8 to begin with.
root /srv/music; The folder tree you want to browse. Sub-folders become the hierarchy you walk on the device.
listen 8090; Any port you like — it goes into the address you give the radio.
sendfile on; Plain throughput. Not required.

A complete Apache 2.4 setup

Apache's built-in mod_autoindex produces HTML, not JSON, so Options +Indexes alone cannot work with AtlasCube. The two files below add a small PHP adapter: directory requests return JSON while MP3 files are still served directly by Apache.

Requirements: Apache 2.4 with mod_rewrite, PHP 7.2 or newer, and AllowOverride FileInfo Options for the music directory.

Download both files (.zip) Download .htaccess Download PHP adapter Download instructions

Installing the Apache adapter

  1. Download and unpack the ZIP, or download both adapter files separately. If the browser keeps their server names, rename htaccess.txt to .htaccess and network-music-index.php.txt to .network-music-index.php.
  2. Copy both renamed files to the root of the directory containing your music, for example /srv/music.
  3. Enable rewriting (on Debian/Ubuntu: sudo a2enmod rewrite) and restart Apache.
  4. Open the music root URL or run curl http://your-nas:8090/. The response must begin with [ and contain entries with name and type.

A minimal Apache virtual host

Listen 8090
<VirtualHost *:8090>
    DocumentRoot "/srv/music"

    <Directory "/srv/music">
        Require all granted
        AllowOverride FileInfo Options
    </Directory>
</VirtualHost>

Pointing the radio at it

  1. Open the radio's web panel → Settings → Network → Network Music, or the Network Music page itself.
  2. Enter the server root — for the block above that is http://your-nas:8090/. Keep the trailing slash.
  3. Save. The address is kept on the device, so it survives a reboot; a fresh device has none.
  4. Browse to a folder and pick a track. That folder becomes the queue, and playback carries on through it.

What to expect

Once a server is set, Network Music joins the screens you swipe through on the device, with its own folder browser. Picking a track in the web player and picking one on the radio do the same thing — both build the same queue, so the elapsed time, the length and Previous / Next agree wherever you look.

The length comes from the file's own header, so it is exact for VBR as well as CBR — and an album whose tag carries cover art, pushing the audio a few hundred kilobytes in, is read just the same: the radio works out where the audio starts and fetches a kilobyte from there.

MP3 only for now, at most 128 entries per folder, and the end of a folder stops playback — there is no shuffle or repeat here yet.

Try the player in the demo Flash a device Back to the overview