@djodjonx/x32-simulator
v0.0.7
Published
X32 Simulator
Downloads
689
Readme
X32 Digital Mixer Simulator
A fully functional Behringer X32 / Midas M32 OSC Simulator.
This tool allows developers to build, test, and debug X32/M32 remote control applications without needing physical hardware. It accurately replicates the mixer's state management, OSC protocol quirks, and network behavior.
🚀 Features
- Complete State Simulation: Simulates ~4000+ OSC parameters including Channels, Buses, Matrices, FX, Routing, and Config.
- Accurate OSC Protocol: Supports
node-oscbased communication over UDP. - Subscription Management: Handles
/xremote,/subscribe, and/renewlogic for client updates. - Meter Simulation: Generates synthetic meter data for
/meters/0through/meters/15endpoints. - Dual Mode: Run as a Standalone CLI Server or embed as a Library in your Node.js tests.
- Zero Dependencies (runtime): The published package bundles everything needed.
📦 Installation
As a CLI Tool (Global)
Install globally to run the simulator from anywhere in your terminal.
npm install -g @djodjonx/x32-simulatorAs a Library (Local)
Install in your project to use it in integration tests.
npm install --save-dev @djodjonx/x32-simulator🖥️ CLI Usage
Start the simulator server:
x32-simulatorOptions
| Flag | Alias | Description | Default |
|------|-------|-------------|---------|
| --port | -p | UDP Port to listen on | 10023 |
| --host | -h | IP Address to bind to | 0.0.0.0 |
Example:
x32-simulator --port 5000 --host 127.0.0.1🌐 Network Setup (IP Aliasing)
If you need to simulate a specific console IP (e.g., 192.168.1.100) that is not assigned to your machine, you must create a Network Alias. This allows the simulator to "own" that IP locally.
| OS | Create Alias Command | Remove Alias Command |
|----|----------------------|----------------------|
| macOS | sudo ifconfig lo0 alias <IP> | sudo ifconfig lo0 -alias <IP> |
| Linux | sudo ip addr add <IP>/32 dev lo | sudo ip addr del <IP>/32 dev lo |
| Windows | netsh interface ip add address "Loopback" <IP> 255.255.255.255 | netsh interface ip delete address "Loopback" <IP> |
Note (Windows): Requires the "Microsoft Loopback Adapter" to be installed and named "Loopback" in your Network Connections.
Interactive Commands
Once running, the CLI accepts these commands:
reset: Resets all faders and parameters to default values.stop/exit: Shuts down the server.
📚 Library Usage
Perfect for integration testing your X32 client apps.
import { SimulationService, UdpNetworkGateway, ConsoleLogger, InMemoryStateRepository, SchemaFactory, SchemaRegistry, OscCodec } from '@djodjonx/x32-simulator';
// 1. Setup Dependencies
const logger = ConsoleLogger.getInstance();
const schemaRegistry = new SchemaRegistry(new SchemaFactory());
const codec = new OscCodec(schemaRegistry);
const gateway = new UdpNetworkGateway(logger, codec);
const repository = new InMemoryStateRepository(logger, schemaRegistry);
// 2. Initialize Service
const simulator = new SimulationService(
gateway,
logger,
repository,
schemaRegistry,
10023, // Port
'127.0.0.1' // Host
);
// 3. Start & Stop
await simulator.start();
console.log('Simulator running...');
// ... run your tests ...
await simulator.stop();Available Exports
The library exports the following components for advanced usage:
Core Services
SimulationService: Main entry point.SchemaRegistry: Manages the OSC node definitions.SchemaFactory: Generates the default X32 schema.
Domain Entities & Models
X32State: The "Digital Twin" state container.SubscriptionManager: Manages/xremoteand/subscribeclients.X32Address: Helper for parsing OSC paths.OscMessage: Wrapper for parsed OSC messages.MeterData: Helper for handling meter blobs.X32Node: Represents a single parameter (type, default value).
Infrastructure
UdpNetworkGateway: Default UDP implementation.ConsoleLogger: Default logger implementation.OscCodec: Encodes/Decodes X32-specific OSC packets.InMemoryStateRepository: Default state storage.
Types & Interfaces
INetworkGateway,ILogger,IStateRepositoryOscPacket,OscMsg,RemoteClientLogCategory
🎛️ Simulated OSC Map
The simulator covers a vast majority of the X32 OSC command set:
| Category | OSC Path Pattern | Description |
|----------|------------------|-------------|
| Channels | /ch/{01..32}/... | Config, Preamp, Gate, Dyn, EQ, Mix, Sends |
| Buses | /bus/{01..16}/... | Config, Dyn, EQ, Mix, Sends |
| DCA | /dca/{1..8}/... | Config, Fader, Mute |
| Matrix | /mtx/{01..06}/... | Config, Dyn, EQ, Mix |
| Aux In | /auxin/{01..08}/... | Config, Preamp, EQ, Mix |
| FX Returns | /fxrtn/{01..08}/... | Config, EQ, Mix |
| Effects | /fx/{1..8}/... | Type, Parameters, Source |
| Headamps | /headamp/{000..127}/... | Gain, Phantom Power |
| Routing | /config/routing/... | Input, Output, Card, AES50 Routing |
| Status | /-stat/... | Selected Channel, Sends on Fader, Screen State |
| Meters | /meters/... | Meter data blobs (simulated noise) |
🧪 Testing Example (E2E)
The simulator is ideal for testing broadcast behavior and multi-client synchronization. When one client changes a parameter, the simulator automatically broadcasts that update to all other clients subscribed via /xremote.
You can find a complete, runnable example of this in examples/dual-client-e2e.ts.
Multi-Client Sync Test Snippet
// Client A and Client B both subscribe to /xremote
clientA.send('/xremote');
clientB.send('/xremote');
// Client A changes a fader
clientA.send('/ch/01/mix/fader', 0.85);
// Result: BOTH Client A and Client B receive the update from the simulator
// This ensures your UI stays in sync across multiple devices.🤝 Contributing
We welcome contributions! Please see INSTALL.md for development instructions.
📄 License
MIT © Jonathan Moutier
