A comprehensive emulator for developing and testing Lua scripts for the Expert Sleepers Disting NT Eurorack module. This application provides a virtual environment that simulates the behavior of the physical hardware, allowing you to develop and test your scripts without the need for physical hardware.
- Script Execution: Load and run Lua scripts designed for the Disting NT
- Simulated Display: Full emulation of the 256x64 OLED/LCD screen
- Input/Output Simulation: 12 virtual inputs and 8 virtual outputs
- Parameter Controls: Virtual knobs, buttons, and encoders
- State Saving: Automatic preservation of your setup between sessions
- OSC Integration: Send and receive OSC messages for external control
- Real-time Clock: Built-in clock generator with adjustable BPM
- MIDI Input Support: Full MIDI integration with device selection and script routing
- I/O Mapping: Drag-and-drop interface for connecting script I/O to physical I/O
- Multiple Input Modes:
- Bipolar (-5V to +5V)
- Unipolar (0V to +10V)
- Clock (generates gate signals based on BPM)
- Input Scaling: Adjust the scaling of each input independently
- Signal Visualization: Real-time visualization of signal values with voltage-based coloring
- Minimal Mode: Streamlined interface showing only the display
- Full Mode: Complete interface with I/O panels and parameter controls
- I/O Panel: Visual representation of script inputs/outputs and physical connections
- Parameter Controls: Interactive knobs for adjusting script parameters
- Control Panel: Virtual buttons, encoders, and potentiometers
- Download LÖVE (version 11.3 or higher)
- Download the Disting NT LUA Emulator
- Add love to your path:
export PATH="$PATH:/Applications/love.app/Contents/MacOS" - Run the emulator using LÖVE:
love path/to/nt_lua_emulator
- Press F2 to open the script selection dialog
- Navigate to your script file (.lua)
- Select the script and click "Open" or press Enter
- Press F3 to open the MIDI device selection dialog
- Choose from available MIDI input devices
- MIDI messages will be routed to scripts that support MIDI input
- Scripts can define MIDI channel filtering and message type support
- Press F4 to choose an output port and configure Breakout/Select Bus/USB/Internal routes. Click a route to toggle host output or capture-only.
- Press F5 (or click the MIDI status badge) for the non-modal live output log. It shows one row per call with time, destination, decoded message, bytes, and delivery result. Buttons/pots stay usable; pause, scroll, clear, or drag the log as needed. Capture works without MIDI hardware, and rejected calls are explained.
Load scripts/api_simulation_demo.lua with F2 to try discoverable script parameters
(including Bypass), working standard pots, live bus voltages, display modes,
MIDI destination monitoring, and a deterministic virtual I2C register device.
See SDK conformance and simulation limits for details.
- Click and drag from a script input/output to a physical input/output to create a connection
- Click on an existing connection to remove it
- Input/output connections are automatically saved between sessions
- Left-click on a physical input to cycle through modes (Bipolar → Clock → Unipolar)
- Input modes are indicated by colored rings:
- No ring: Bipolar (-5V to +5V)
- Yellow ring: Clock (generates gate signals)
- Red ring: Unipolar (0V to +10V)
- Double click an input to reset it to defaults.
- An input connected to a kTrigger script input will generate a trigger on Left-Click.
- Use the parameter knobs in the parameter panel to adjust script parameters
- Parameters with different types (integer, float, enum) are handled automatically
- Parameter values are automatically saved with your script state
- The controls panel provides virtual buttons, encoders, and potentiometers
- These controls interact with the script's corresponding callback functions
- Control states are visualized in real-time
- F2: Open script selection dialog
- F3: Open MIDI input device selection dialog
- F4: Open MIDI output routing dialog
- F5: Toggle non-modal MIDI output event log
- Alt+F4 / Cmd+Q: Quit the application
- Arrow keys: Navigate in file selection dialog
- Enter: Confirm selection in dialogs
- Escape: Cancel/close dialogs
- Ctrl-O: Enable OSC
- Ctrl-D: Enable Debug mode output
- Ctrl-S: Save the state
The emulator supports OSC (Open Sound Control) for external communication:
- Enable/disable OSC in the configuration or Ctrl-O to toggle.
- Default OSC settings:
- Host: 127.0.0.1
- Port: 8000
- Address: /ch
- Output values are sent as individual floating-point messages using the output channel numbers (/ch/1, /ch/2... by default)
The emulator includes comprehensive MIDI input support:
- Device Selection: Choose from available system MIDI input devices via F3
- Graceful Degradation: MIDI features are optional and the emulator works without MIDI support
- Channel Filtering: Scripts can specify which MIDI channels to listen to
- Message Type Support: Scripts define which MIDI message types they want to receive (note, CC, etc.)
- Automatic Routing: MIDI messages are automatically routed to scripts that support them
- The emulator includes a compiled
luamidi.solibrary for macOS (arm64) - The library is statically linked with rtmidi for maximum compatibility
- MIDI support automatically detects if the library is available
The MIDI library is built from the lovemidi project:
- For macOS (arm64): The pre-compiled
luamidi.sois included in the emulator directory - For other platforms: You'll need to compile the library yourself:
git clone https://github.com/thorinside/lovemidi cd lovemidi # Build rtmidi dependency cd rtmidi && mkdir build && cd build cmake .. -DRTMIDI_API_JACK=OFF -DRTMIDI_API_CORE=ON -DBUILD_SHARED_LIBS=OFF make cd ../.. # Build luamidi (adjust paths for your system) make -f Makefile.simple # Copy the resulting luamidi.so to your emulator directory cp luamidi.so /path/to/nt_lua_emulator/
- Library placement: The
luamidi.sofile should be in the same directory asmain.lua - Dependencies: The library requires LuaJIT headers for compilation (install via your package manager)
Scripts can include MIDI support by:
-
Adding a
midiMessagecallback function:midiMessage = function(self, msg) local status, note, velocity = msg[1], msg[2], msg[3] -- Handle MIDI messages here end
-
Defining MIDI configuration in the init return:
return { -- other fields... midi = { channelParameter = parameterIndex, -- Parameter controlling MIDI channel messages = {"note", "cc", "bend", "aftertouch", "poly pressure", "program change"} } }
-
MIDI messages are passed as tables with three values:
{status, data1, data2}- Status byte includes both message type and channel
- For note messages:
{0x90, note_number, velocity}(note on) - Channel filtering is handled automatically based on the script's channel parameter (1–16); a configured value of 0 disables MIDI input, matching the NT manual.
- If no
channelParameteris supplied, all input channels are accepted.
When writing scripts for the Disting NT:
-
Scripts should return a table with the following elements:
process: Main processing function called each frameinputs: Table defining input types (kCV, kGate, kTrigger)outputs: Table defining output types (kCV, kGate)init: Initialization function (optional)gate: Gate input handler (optional)trigger: Trigger input handler (optional)midiMessage: MIDI message handler (optional)
-
Available callback functions:
button: Handle button pressespot1Turn,pot2Turn,pot3Turn: Handle potentiometer turnspot1Push,pot2Push,pot3Push: Handle potentiometer pushespot1Release,pot2Release,pot3Release: Handle potentiometer releasesencoder1Turn,encoder2Turn: Handle encoder turnsencoder1Push,encoder2Push: Handle encoder pushesmidiMessage: Handle MIDI input messagesserialise: Save script state
-
Drawing functions for the display:
drawRectangle,drawBox,drawSmoothBoxdrawLine,drawSmoothLine,drawCircle,drawSmoothCircledrawText(x, y, text[, color[, alignment]])drawTinyText(x, y, text[, color[, alignment]])drawParameterLine,drawStandardParameterLine,drawAlgorithmUI
Text color is a shade from
0to15and defaults to15. Alignment defaults to left; pass"centre"or"right"to anchor the text at the supplied x coordinate, matching the disting NT Lua API.
The matching official Lua scripting manual is stored at
docs/reference/disting_NT_lua_scripting_1.17.pdf.
The audited support matrix and documented emulator boundaries are in
docs/sdk-conformance.md.
Settings are stored in config.json and include:
- OSC settings (host, port, enabled status)
- MIDI settings (enabled status, selected input device)
- Window position and size
- UI mode (minimal or full)
- Active overlay (controls or I/O)
- Script Errors: Error messages are displayed on screen and in the console
- OSC Connectivity: Check your firewall settings if OSC isn't working
- MIDI Issues: If MIDI support is not available, the emulator will continue to work without MIDI features
- Performance Issues: Reduce the update rate in complex scripts
The Disting NT LUA Emulator is an open-source project designed to help developers create and test scripts for the Expert Sleepers Disting NT Eurorack module. It is not affiliated with Expert Sleepers.