Skip to content
probonopd edited this page Nov 17, 2024 · 30 revisions

There is an experimental version of MiniDexed that adds networking support. (To get the latest experimental build, scroll all the way down on that page and use the latest "Build for testing".)

NOTE: This functionality is not in the main release of MiniDexed yet. This page is a work in progress.

NOTE: ⚠️ This is very insecure and should only be used in your private network in which you are the only user. Currently anyone on your network can access your MiniDexed device. Furthermore, anyone with physical access to the microSD card in your Raspberry Pi can read the WLAN password in clear text.

Ethernet and WLAN support

Circle, which MiniDexed is based on, has networking support for the following Raspberry Pi models:

Model Ethernet WLAN
Raspberry Pi Zero 2 W ✔ (2.4GHz only)
Raspberry Pi 2 Model B
Raspberry Pi 3 Model A+ ✔ (2.4 and 5GHz)
Raspberry Pi 3 Model B ✔ (2.4GHz only)
Raspberry Pi 3 Model B+ ✔ (2.4 and 5GHz)
Raspberry Pi 4 Model B ✔ (2.4 and 5GHz)
Raspberry Pi Compute Module 3, 3+
Raspberry Pi Compute Module 4 ✔ (if provided by carrier board) ✔ (if using a "WLAN" model, 2.4 and 5GHz)
Raspberry Pi 5 tbc tbc

Functionality

  • rtpMIDI a.k.a. "AppleMIDI"
  • UDP MIDI
  • FTP (e.g., to update without taking the microSD card out of the Pi)
  • DNS-SD service discovery a.k.a. "Bonjour", "Zeroconf"
  • Logging over the network to a syslog server (useful for development and testing)

Configuration

In the file minidexed.ini, edit the configuration:

# Network
NetworkEnabled=0
NetworkDHCP=1
# NetworkType ( wifi ; ethernet )
NetworkType=wifi
NetworkHostname=MiniDexed
NetworkIPAddress=0
NetworkSubnetMask=0
NetworkDefaultGateway=0
NetworkDNSServer=0

Set NetworkType to either wifi for WLAN or ethernet for wired LAN.

Set NetworkEnabled to 1 if you would like to activate this feature.

The default configuration attempts to get an IP address and DNS server from your network via DHCP. If you prefer to use a static IP address, you can edit the values for NetworkIPAddress, NetworkSubnetMask, NetworkDefaultGateway, and NetworkDNSServer accordingly.

NOTE: If you have more than one MiniDexed device on the same network, you need to change the value for NetworkHostname to unique values in order to distinguish between them.

In the file wpa_supplicant.conf, edit the configuration:

#
# wpa_supplicant.conf
#

#country=DE

network={
	ssid="my-ssid"
	psk="my-password"
	proto=WPA2
	key_mgmt=WPA-PSK
}

Uncomment the line country= and set the correct country code for your location. Replace my-ssid with the SSID of your WLAN and replace my-password with the password of your WLAN.

NOTE: Failure to set the correct country code may result in inability to connect to certain WLANs, especially 5 GHz access points.

NOTE: ⚠️ This is very insecure and should only be used in your private network in which you are the only user. Currently anyone on your network can access your MiniDexed device. Furthermore, anyone with physical access to the microSD card in your Raspberry Pi can read the WLAN password in clear text.

If the network configuration is working, MiniDexed should show the IP address assigned to it via DHCP when booted:

image

You will need this IP address to connect to MiniDexed over the network.

rtpMIDI

rtpMIDI (also known as "AppleMIDI") allows you to send MIDI data from a host computer to MiniDexed.

This allows us to send MIDI e.g., from DAWs, Dexed on the PC, or even sysex for voices from the web browser using sites like patches.fm.

It is also possible to use MiniDexed in conjunction with Dexed on a host computer. This allows you to send voices from Dexed to MiniDexed over the network, and to use Dexed as a GUI "programmer" for MiniDexed, meaning that any changes in Dexed are immediately reflected in MiniDexed.

Windows

RTP-MIDI on Windows 11 using loopMIDI and rtpMIDI works very nicely as described here. Playing MIDI from REAPER to MiniDexed over the network.

image

and Dexed like this

image

macOS

  • Open Audio MIDI Setup
  • In the MIDI Studio window, double-click Network
  • In the MIDI Network Setup window, MiniDexed will appear after a while in "Directory". Set it up like below.

mac

Tested with Logic Pro 9.1.8 on Mac OS X 10.6.8. Unfortunately GarageBand does not support sending MIDI data to external MIDI devices.

NOTE: If DNS-SD service discovery a.k.a. "Bonjour", "Zeroconf" is not available on your machine, you will need to enter the IP address of your MiniDexed device manually by clicking "+" under "Directory".

Linux

rtpmidid should work, although it has not been tested yet.

UDP MIDI

Like rtpMIDI, UDP MIDI also allows you to send MIDI data from a host computer to MiniDexed.

This can be used in conjunction with the MIDI Button Navigation functionality to simulate keys being pressed on the MiniDexed device (which is neat for e.g., test automation):

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Send MIDI messages to MiniDexed to navigate the menu.
This script is useful to automate operating the MiniDexed menu, e.g., for test automation.
"""

import sys
import socket
import time

server_address = "minidexed.local"

# This may require Apple Bonjour on Windows or Avahi on Linux to be installed to resolve the hostname
ip_address = socket.gethostbyname(server_address)

"""
minidexed.ini has

# MIDI Button Navigation
#  Specify MIDI CC to act as a button (0 = ununsed, so don't use CC 0)
#  NB: Off < 64 < ON
# CC channel: 0=OFF; 1-16 MIDI Ch; >16 Omni
# If MIDIButtonNotes>0 then treat MIDIButton numbers as MIDI
# Note numbers, triggered with NoteOn/NoteOff, not CC numbers.
MIDIButtonCh=17
MIDIButtonNotes=0
# Arrow left
MIDIButtonPrev=46
# Arrow right
MIDIButtonNext=47
# Arrow up
MIDIButtonBack=48
# Arrow down
MIDIButtonSelect=49
# Home button
MIDIButtonHome=50
MIDIButtonPgmUp=51
MIDIButtonPgmDown=52
MIDIButtonBankUp=53
MIDIButtonBankDown=54
MIDIButtonTGUp=55
MIDIButtonTGDown=56
"""

# Virtual buttons; needs to match values in minidexed.ini
arrow_left = 46
arrow_right = 47
arrow_up = 48
arrow_down = 49
home = 50
pgm_up = 51
pgm_down = 52
bank_up = 53
bank_down = 54
tg_up = 55
tg_down = 56

# Top level menu
# [ TG1, TG2, ..., TG8, Effects, Performance ]

# Menu for TG1, TG2, ..., TG8
# [ Voice, Bank, Volume, Pan, Reverb-Send, Detune, Cutoff, Resonance, Pitch Bend, Portamento, Poly/Mono, Modulation, Channel, Edit Voice ]

def pressButton(virtual_button=arrow_right):
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    message = b'\xB0' + bytes([virtual_button]) + b'\x7F'
    print("Sending MIDI message: ", message)
    sock.sendto(message, (ip_address, 1999))
    time.sleep(0.1)
    message = b'\xB0' + bytes([virtual_button]) + b'\x00'
    print("Sending MIDI message: ", message)
    sock.sendto(message, (ip_address, 1999))
    sock.close()
    time.sleep(1) # Lower values may cause the message to be lost

if __name__ == "__main__":
    pressButton(home)
    pressButton(arrow_left)
    pressButton(arrow_down)
    pressButton(arrow_down)
    pressButton(arrow_down)
    print("Changing program")
    pressButton(pgm_up)
    time.sleep(3)
    print("Restoring program")
    pressButton(pgm_down)
    time.sleep(1)
    print("Changing TG")
    pressButton(tg_up)
    time.sleep(3)
    print("Restoring TG")
    pressButton(tg_down)
    
    # Go to TG1 Edit Voice
    pressButton(home)
    pressButton(arrow_down)
    pressButton(arrow_right)
    # 13 times arrow right
    for i in range(13):
        pressButton(arrow_right)
    pressButton(arrow_down)

    time.sleep(1)
    pressButton(home)
    
    sys.exit(0)

FTP

FTP allows you to access the contents of the microSD card inside the Raspberry Pi over the network (e.g., to update the firmware and/or modify voices and performances without taking the microSD card out of the Raspberry Pi).

Username: admin, password: admin.

Unfortunately, the FTP clients built into Windows 11 and macOS are known not to work with the FTP implementation currently being used in MiniDexed. The following FTP clients are known to work:

  • Total Commander for Windows
  • WinSCP for Windows

Logging over the network to a syslog server

This feature is work in progress.

On the host machine, run a syslog server that listens to port 8514, such as the following simple one implemented in Python:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
Syslog server to receive and display syslog messages from MiniDexed.
"""

import socket
import time
import threading

class SyslogServer:
    def __init__(self, host='0.0.0.0', port=8514):
        self.host = host
        self.port = port
        self.server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.server.bind((self.host, self.port))
        self.start_time = None
        self.running = True

    def start(self):
        ip_address = socket.gethostbyname(socket.gethostname())
        print(f"Syslog server listening on {ip_address}:{self.port}")
        input_thread = threading.Thread(target=self.wait_for_input)
        input_thread.daemon = True
        input_thread.start()
        while self.running:
            try:
                data, address = self.server.recvfrom(1024)
                self.handle_message(data)
            except KeyboardInterrupt:
                self.running = False

    def handle_message(self, data):
        message = data[2:].decode('utf-8').strip()

        if self.start_time is None:
            self.start_time = time.time()
            relative_time = "0:00:00.000"
        else:
            elapsed_time = time.time() - self.start_time
            hours = int(elapsed_time // 3600)
            minutes = int((elapsed_time % 3600) // 60)
            seconds = int(elapsed_time % 60)
            milliseconds = int((elapsed_time % 1) * 1000)
            relative_time = f"{hours:02d}:{minutes:02d}:{seconds:02d}.{milliseconds:03d}"

        print(f"{relative_time} {message}")

    def wait_for_input(self):
        input("Press any key to exit...")
        self.running = False

if __name__ == "__main__":
    server = SyslogServer()
    server.start()
    print("Syslog server stopped.")

Limitations

  • The FTP implementation is very rudimentary and does not work with all FTP clients, especially those built natively into operating systems. A more robust (S)FTP implementation would be welcome. A pull request enabling this would be appreciated
  • FTP is always on. We should find a way to only enable it when required, either trough the menu system, or a pin configuration at boot time. A pull request enabling this would be appreciated
  • Currently you can only send MIDI data from the host computer to MiniDexed, not the other way around. A pull request enabling this would be appreciated
  • rtpMIDI session initiation is not implemented; mt32-pi can only be invited to be a participant in an existing session (you must create a session on a PC or other device that supports it, and invite MiniDexed to the session)
  • MiniDexed can only participate in one rtpMIDI session at a time
  • rtpMIDI journalling is not implemented, so it is not possible to recover from packet loss. A reliable network connection is required. If your network suffers from frequent packet loss/disconnections, this feature is probably not going to work well for you