@djodjonx/x32-simulator 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.8](https://github.com/djodjonx/x32-simulator/compare/v0.0.7...v0.0.8) (2026-11-28)
6
+
7
+
8
+ ### Behaviour changes
9
+
10
+ This release brings the simulator much closer to a real X32. Several defaults changed:
11
+
12
+ * **Strict by default.** A Set to an unknown address, to a read-only parameter, or with a value out of range is ignored. Pass `--permissive` (or `PERMISSIVE: true`) to keep the old behaviour.
13
+ * **Real OSC values.** A scene line sent with `/` and a `/node` reply now use the console's own values: floats between 0 and 1, enum integers, and the text format of a scene file. A fader reads back as a float, no longer as a dB number. A state file written by an older version is checked when it loads: an invalid value falls back to the default.
14
+ * **One address per parameter.** The padded and unpadded twins (`/ch/1/...` next to `/ch/01/...`) are gone. Use `/ch/01/...`; DCA and effects use `/dca/1` and `/fx/1`.
15
+ * **Faders snap to the console's 1024-step grid**, so `-0.2 dB` reads back as `0.7449`.
16
+ * **`/showdump`** answers with the show, cue, scene and snippet lines instead of the whole state.
17
+ * **Meters are silent by default** and use the documented blob format. `--meters noise` brings back the old random values.
18
+ * **`/info`** always reports `osc-server`. The console name is in `/xinfo` and follows `/-prefs/name`.
19
+ * **Log level** defaults to `info` instead of `debug`.
20
+
21
+ ### Features
22
+
23
+ * **action:** recall scenes and keep one undo step ([4b2798e](https://github.com/djodjonx/x32-simulator/commit/4b2798e16f048c013592063b151f1c10306ac1b3))
24
+ * **api:** expose setParameter and getParameter ([6601163](https://github.com/djodjonx/x32-simulator/commit/6601163868c36aa1f0370332104d91d765494d9b))
25
+ * **codec:** add the node registry and parameter codec ([7fef932](https://github.com/djodjonx/x32-simulator/commit/7fef932b22f9de1f62bae62ac39a5720b2e343ba))
26
+ * **dataset:** store scenes and answer dataset commands ([85d2b68](https://github.com/djodjonx/x32-simulator/commit/85d2b686cde9c871c33c6e43384f8a737b902083))
27
+ * **dispatch:** warn once when one command replies with more than 500 packets ([f9c72bf](https://github.com/djodjonx/x32-simulator/commit/f9c72bff0ba86b0560f36b6637f21085abfe3bde))
28
+ * **fx:** resolve effect parameters from the active type ([9661fdd](https://github.com/djodjonx/x32-simulator/commit/9661fdddefe146a6f87caddffc24df2d63d94297))
29
+ * **meter:** add a fixed lookup and stay silent on an out-of-range id ([4fedcac](https://github.com/djodjonx/x32-simulator/commit/4fedcaca3f319aab91b45c2a17f60f56630a3967))
30
+ * **showdump:** reply with show lines instead of the full state ([f0d1f01](https://github.com/djodjonx/x32-simulator/commit/f0d1f011a9552f23a038854a9aa5dc55b24f31dd))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * **codec:** write scene text the way the console does ([9996cfb](https://github.com/djodjonx/x32-simulator/commit/9996cfba2663132a9a50c81f56a4ef46444608a9))
36
+ * **config:** add a strict-by-default permissive switch ([3e209f1](https://github.com/djodjonx/x32-simulator/commit/3e209f133546269ae7689e0c38b928c212b1466f))
37
+ * **format:** encode formatsubscribe blobs on their own period ([15952d1](https://github.com/djodjonx/x32-simulator/commit/15952d1a2b0898489e5c85b97f448e57f0c10e34))
38
+ * **identity:** report console name, model, firmware and sender IP ([6189e0c](https://github.com/djodjonx/x32-simulator/commit/6189e0c313cc12e834a32d34ad29c7cea5523707))
39
+ * **level:** snap 1024-step levels onto the console grid ([77e56a2](https://github.com/djodjonx/x32-simulator/commit/77e56a2e060b82354705f9c40889be15f93cb2b7))
40
+ * **lifecycle:** clear subscribers when the simulator stops ([d368693](https://github.com/djodjonx/x32-simulator/commit/d36869335e41cf5b813429b0145226f3fed0f67a))
41
+ * **lifecycle:** flush the state file through a temporary rename ([b8e8f69](https://github.com/djodjonx/x32-simulator/commit/b8e8f69fbbc0699e3f3504df3a7bf168ce4859f0))
42
+ * **log:** set the log level from the CLI and hide meter blobs ([306f9f0](https://github.com/djodjonx/x32-simulator/commit/306f9f03f067bcdb61b57abf6edc1c0bcc235cec))
43
+ * **meter:** drop the extra size prefix from meter blobs ([0b48100](https://github.com/djodjonx/x32-simulator/commit/0b481002630fc9d1527dbd40a480dd53c1c32190))
44
+ * **meter:** give each subscription its own period ([7c7135b](https://github.com/djodjonx/x32-simulator/commit/7c7135bfffebca5c2212afdd94f4ba36c336b51f))
45
+ * **meter:** report an idle console instead of random meter values ([93100a2](https://github.com/djodjonx/x32-simulator/commit/93100a20d2ac2a4caeccfe6d928542787aeb0e1d))
46
+ * **node:** apply a Set with several numbers on a node address ([36a98dc](https://github.com/djodjonx/x32-simulator/commit/36a98dc5b6537012a508ab1ee1f7f2de719c0fda))
47
+ * **node:** apply scene lines through the parameter codec ([e085b9d](https://github.com/djodjonx/x32-simulator/commit/e085b9de1731f701f6a74c80451f0149e903d4df))
48
+ * **node:** reply to /node with one scene line ([9eda699](https://github.com/djodjonx/x32-simulator/commit/9eda699ee07a7fffcadb807d0873baf39fd06c62))
49
+ * **osc:** accept messages that end after the address ([b004bf2](https://github.com/djodjonx/x32-simulator/commit/b004bf2f253d128be7f324dd2878d3cf53b4e87d))
50
+ * **osc:** echo slash commands back to the sender ([b0ac9c8](https://github.com/djodjonx/x32-simulator/commit/b0ac9c823eac8e260aa8923820938e09999a08c1))
51
+ * **schema:** ignore a set to a read-only parameter ([ebb638d](https://github.com/djodjonx/x32-simulator/commit/ebb638d53bf686437b9deadcbd67526f9ad9f896))
52
+ * **schema:** ignore a set to an unknown address ([51c4747](https://github.com/djodjonx/x32-simulator/commit/51c47470202432793e9036056f4953981430575e))
53
+ * **schema:** keep one index and the documented sections ([e423cf8](https://github.com/djodjonx/x32-simulator/commit/e423cf804fb9af395d3b941eeb0667d54fbf6f62))
54
+ * **solo:** derive /-stat/solo and honour clearsolo ([99fb85b](https://github.com/djodjonx/x32-simulator/commit/99fb85b3457b0c2233a69910731f53dfa1263a0e))
55
+ * **state:** merge loaded state onto defaults and notify reset ([24010c3](https://github.com/djodjonx/x32-simulator/commit/24010c35970774ad26ea050ce8f6f09e32ac95a2))
56
+ * **sub:** ignore invalid subscriptions and isolate broadcast errors ([ce256f5](https://github.com/djodjonx/x32-simulator/commit/ce256f5cdaddeecfbbb504d74496cea2d8d26099))
57
+ * **sub:** renew aliases and drop them by client port ([7298a46](https://github.com/djodjonx/x32-simulator/commit/7298a46e31725e0c2d024891d9c93f51a64698b0))
58
+ * **sub:** send /subscribe values on their own period ([b580577](https://github.com/djodjonx/x32-simulator/commit/b5805773512aeca2f0e00d8cf27c0356c69258df))
59
+ * **validation:** snap in-range sets and refuse the rest ([9420e24](https://github.com/djodjonx/x32-simulator/commit/9420e2405351232e01c5dcc08d26118ee6c7ec60))
60
+ * **xremote:** stay silent and cap live clients at four ([539766d](https://github.com/djodjonx/x32-simulator/commit/539766d77a4c7ba0a9215c2e2ab842585e712e12))
61
+
5
62
  ### [0.0.7](https://github.com/djodjonx/x32-simulator/compare/v0.0.6...v0.0.7) (2026-01-12)
6
63
 
7
64
 
package/README.md CHANGED
@@ -3,34 +3,31 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@djodjonx/x32-simulator.svg)](https://www.npmjs.com/package/@djodjonx/x32-simulator)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A fully functional **Behringer X32 / Midas M32 OSC Simulator**.
6
+ A **Behringer X32 / Midas M32 OSC simulator**. It speaks the mixer’s UDP OSC protocol so a remote-control client can be developed without a console.
7
7
 
8
- 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.
8
+ The published build bundles its dependencies, including `node-osc`. The package still lists `node-osc` as a runtime dependency.
9
9
 
10
10
  ---
11
11
 
12
- ## 🚀 Features
12
+ ## Features
13
13
 
14
- * **Complete State Simulation**: Simulates ~4000+ OSC parameters including Channels, Buses, Matrices, FX, Routing, and Config.
15
- * **Accurate OSC Protocol**: Supports `node-osc` based communication over UDP.
16
- * **Subscription Management**: Handles `/xremote`, `/subscribe`, and `/renew` logic for client updates.
17
- * **Meter Simulation**: Generates synthetic meter data for `/meters/0` through `/meters/15` endpoints.
18
- * **Dual Mode**: Run as a **Standalone CLI Server** or embed as a **Library** in your Node.js tests.
19
- * **Zero Dependencies** (runtime): The published package bundles everything needed.
14
+ * **State**: channels, buses, matrices, aux inputs, FX returns, effects, headamps, routing, preferences, status, show slots and libraries. Each address comes from the schema.
15
+ * **OSC over UDP**: the server uses `node-osc`. Clients can speak raw OSC bytes.
16
+ * **Subscriptions**: `/xremote`, `/subscribe`, `/renew`, `/unsubscribe`, `/formatsubscribe` and `/batchsubscribe`. A subscription lasts 10 seconds.
17
+ * **Meters**: `/meters/0` through `/meters/16`. The default mode is `silent` (no signal). `noise` is opt-in.
18
+ * **Two ways to run it**: a standalone CLI, or `SimulationService` inside a Node.js process.
20
19
 
21
20
  ---
22
21
 
23
- ## 📦 Installation
22
+ ## Installation
24
23
 
25
- ### As a CLI Tool (Global)
26
- Install globally to run the simulator from anywhere in your terminal.
24
+ ### CLI
27
25
 
28
26
  ```bash
29
27
  npm install -g @djodjonx/x32-simulator
30
28
  ```
31
29
 
32
- ### As a Library (Local)
33
- Install in your project to use it in integration tests.
30
+ ### Library
34
31
 
35
32
  ```bash
36
33
  npm install --save-dev @djodjonx/x32-simulator
@@ -38,154 +35,233 @@ npm install --save-dev @djodjonx/x32-simulator
38
35
 
39
36
  ---
40
37
 
41
- ## 🖥️ CLI Usage
42
-
43
- Start the simulator server:
38
+ ## CLI
44
39
 
45
40
  ```bash
46
41
  x32-simulator
47
42
  ```
48
43
 
49
- ### Options
50
-
51
44
  | Flag | Alias | Description | Default |
52
45
  |------|-------|-------------|---------|
53
- | `--port` | `-p` | UDP Port to listen on | `10023` |
54
- | `--host` | `-h` | IP Address to bind to | `0.0.0.0` |
46
+ | `--port` | `-p` | UDP port. `X32_PORT` is used when the flag is omitted. | `10023` |
47
+ | `--host` | `--ip`, `-h` | Address to bind. `X32_IP` is used when the flag is omitted. | `0.0.0.0` |
48
+ | `--storage` | `-s` | `memory` or `json`. | `memory` |
49
+ | `--state-file` | `-f` | JSON state file. Setting it selects `json` storage. | `./x32-state.json` |
50
+ | `--name` | | Initial `/-prefs/name` when the store is empty. `/xinfo` and `/status` report this name. | `osc-server` |
51
+ | `--model` | | `X32`, `X32RACK`, `X32C`, `X32P`, `X32CORE`, `M32`, `M32C`, or `M32R`. | `X32` |
52
+ | `--firmware` | | `digits.digits`, reported by `/info` and `/xinfo`. | `4.06` |
53
+ | `--advertise-ip` | | IPv4 announced in `/xinfo` and `/status` when the socket is bound to `0.0.0.0`. Ignored when the socket is bound to a specific address: that address is announced. | none. On `0.0.0.0`, the address is the interface in the sender’s subnet, else the first external IPv4, else `127.0.0.1`. |
54
+ | `--log-level` | | `debug`, `info`, `warn`, or `error`. | `info` |
55
+ | `--meters` | | `silent`, `fixed`, or `noise`. | `silent` |
56
+ | `--permissive` | | Store a Set sent to an address that is not in the schema. | off |
57
+
58
+ ```bash
59
+ x32-simulator --port 10023 --host 127.0.0.1
60
+ x32-simulator --model X32RACK --name TestRack --firmware 4.06
61
+ x32-simulator --storage json --state-file ./x32-state.json
62
+ x32-simulator --meters silent --log-level warn
63
+ ```
64
+
65
+ ### Scene files
66
+
67
+ `npm run scn:convert` turns an X32 `.scn` file into the JSON state file:
55
68
 
56
- **Example:**
57
69
  ```bash
58
- x32-simulator --port 5000 --host 127.0.0.1
70
+ npm run scn:convert -- path/to/scene.scn path/to/output.json
71
+ x32-simulator --storage json --state-file path/to/output.json
59
72
  ```
60
73
 
61
- ### 🌐 Network Setup (IP Aliasing)
74
+ ### Network alias
62
75
 
63
- 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.
76
+ Binding a console address that this machine does not own needs a loopback alias.
64
77
 
65
- | OS | Create Alias Command | Remove Alias Command |
66
- |----|----------------------|----------------------|
67
- | **macOS** | `sudo ifconfig lo0 alias <IP>` | `sudo ifconfig lo0 -alias <IP>` |
68
- | **Linux** | `sudo ip addr add <IP>/32 dev lo` | `sudo ip addr del <IP>/32 dev lo` |
69
- | **Windows** | `netsh interface ip add address "Loopback" <IP> 255.255.255.255` | `netsh interface ip delete address "Loopback" <IP>` |
78
+ | OS | Create | Remove |
79
+ |----|--------|--------|
80
+ | macOS | `sudo ifconfig lo0 alias <IP>` | `sudo ifconfig lo0 -alias <IP>` |
81
+ | Linux | `sudo ip addr add <IP>/32 dev lo` | `sudo ip addr del <IP>/32 dev lo` |
82
+ | Windows | `netsh interface ip add address "Loopback" <IP> 255.255.255.255` | `netsh interface ip delete address "Loopback" <IP>` |
70
83
 
71
- > **Note (Windows):** Requires the "Microsoft Loopback Adapter" to be installed and named "Loopback" in your Network Connections.
84
+ On Windows the adapter must be installed and named `Loopback`. The server prints the command for this OS when the bind fails with `EADDRNOTAVAIL`.
72
85
 
73
- ### Interactive Commands
74
- Once running, the CLI accepts these commands:
75
- * `reset`: Resets all faders and parameters to default values.
76
- * `stop` / `exit`: Shuts down the server.
86
+ ### Terminal
87
+
88
+ Typed at the running server:
89
+
90
+ | Command | Effect |
91
+ |---------|--------|
92
+ | `exit`, `stop`, `quit` | Stop the server. |
93
+ | `reset` | Put every parameter back to its schema default and notify clients. |
94
+ | `save` | Flush the state file. |
95
+ | `set <address> <text>` | Set one parameter from scene text, for example `set /ch/01/mix/fader -10`. |
96
+ | `get <address>` | Print one parameter as scene text. |
97
+
98
+ An unknown address prints `Unknown address <address>`. A value the schema refuses prints `Invalid value for <address>`.
77
99
 
78
100
  ---
79
101
 
80
- ## 📚 Library Usage
102
+ ## Commands
103
+
104
+ `supported` means the command is handled and its documented effect is implemented. `partial` means the address is accepted and something is stored or answered, but not the full console behaviour. `not supported` means that behaviour does not exist here.
105
+
106
+ | Command | Status | What the simulator does |
107
+ |---------|--------|-------------------------|
108
+ | `/info` | supported | Four strings: `V2.05`, `osc-server`, the model, the firmware. The name in this reply is always `osc-server`. |
109
+ | `/xinfo` | supported | IP, `/-prefs/name`, model, firmware. |
110
+ | `/status` | supported | `active`, the announced IP, `/-prefs/name`. |
111
+ | `/xremote` | supported | Firehose of parameter changes for 10 seconds. |
112
+ | `/subscribe` | supported | One path, optional factor. The current value is returned when it is known. |
113
+ | `/formatsubscribe` | supported | A numbered range, several patterns, under the alias that was sent. Updates follow the 50 ms broadcast tick. |
114
+ | `/batchsubscribe` | supported | One blob for the listed paths. The simulator also builds that blob for a path that is not a meter. See V6. |
115
+ | `/renew` | supported | Extends one alias, or every subscription of that client when the name is omitted. |
116
+ | `/unsubscribe` | supported | Removes one alias, or every subscription of that client when the name is omitted. |
117
+ | `/meters` `/meters/0` … `/meters/16` | supported | One blob per known id. `/meters/5` needs two integers in `0..3`. `/meters/6` needs a channel in `0..71`. Any other id, bank or channel gets no reply. Counts: 0=70, 1=96, 2=49, 3=22, 4=82, 5=27, 6=4, 7=16, 8=6, 9=32, 10=32, 11=5, 12=4, 13=48, 14=80, 15=50, 16=48. |
118
+ | `/node` | supported | Reply address `node` (no slash). The text is one scene line and ends with `\n`. |
119
+ | `/` | supported | The line is echoed first, then applied. |
120
+ | `/showdump` | supported | The show header, then each cue, scene and snippet that exists. It does not dump the mixer. |
121
+ | `/save` `/load` `/copy` `/delete` `/rename` | supported | Reply `,si <kind> <0\|1>`. Kinds: `scene`, `snippet`, `libchan`, `libfx`, `librout`, `libmon`, `cue`. A scene keeps a copy of the recallable parameters. |
122
+ | `/add` | partial | Creates a cue (`/add ,sis cue <number> <name>`). Any other kind answers `0`. |
123
+ | `/-action/*` | partial | These have an effect: `goscene`, `gosnippet`, `gocue`, `undopt`, `doundo`, `initall`, `initshow`, `setclock`, `setrtasrc`. `clearsolo` is an ordinary Set and zeroes the solo switches. Other `/-action` addresses that exist in the schema are stored as integers and do nothing else. Snippet bodies are empty, so `gosnippet` only checks `hasdata`. |
124
+ | `/-stat/*` | partial | Schema values. `/-stat/solo` is derived and read-only. `/-stat/rtasource` is written by `/-action/setrtasrc`. This is not live USB, card or surface status. |
125
+ | `/-prefs/*` | partial | Values are stored. `/-prefs/name` is the name `/xinfo` and `/status` report. `hardmute` and `invertmutes` have no further effect. See V14. |
126
+ | `/-show/*` | partial | Cues, scenes and snippets `000`–`099`. This is not a USB show file. |
127
+ | `/-libs/*` | partial | Channel, FX, routing and monitor slots `001`–`100`: name, position, type, flags, `hasdata`. Preset bodies stay empty. |
128
+ | `/fx` parameters | supported | The active `/fx/<slot>/type` selects the parameter list for `/fx/<slot>/par/...`. |
129
+ | Audio | not supported | No audio engine. A saved scene stores parameter values, not samples. |
130
+ | MIDI | not supported | No MIDI port. Cue fields `miditype`, `midichan`, `midipara1` and `midipara2` are stored integers. |
131
+ | X-Live / USB recorder content | not supported | `/-usb` and `/-urec` paths exist as placeholders. No recorder files. |
132
+ | Snippet and preset bodies | not supported | A save stores the name and `hasdata` only. |
81
133
 
82
- Perfect for integration testing your X32 client apps.
134
+ ---
135
+
136
+ ## Library
83
137
 
84
138
  ```typescript
85
- import { SimulationService, UdpNetworkGateway, ConsoleLogger, InMemoryStateRepository, SchemaFactory, SchemaRegistry, OscCodec } from '@djodjonx/x32-simulator';
139
+ import {
140
+ SimulationService,
141
+ UdpNetworkGateway,
142
+ ConsoleLogger,
143
+ InMemoryStateRepository,
144
+ SchemaFactory,
145
+ SchemaRegistry,
146
+ OscCodec,
147
+ } from '@djodjonx/x32-simulator';
86
148
 
87
- // 1. Setup Dependencies
88
149
  const logger = ConsoleLogger.getInstance();
89
150
  const schemaRegistry = new SchemaRegistry(new SchemaFactory());
90
151
  const codec = new OscCodec(schemaRegistry);
91
152
  const gateway = new UdpNetworkGateway(logger, codec);
92
- const repository = new InMemoryStateRepository(logger, schemaRegistry);
153
+ const repository = new InMemoryStateRepository();
93
154
 
94
- // 2. Initialize Service
95
155
  const simulator = new SimulationService(
96
156
  gateway,
97
157
  logger,
98
158
  repository,
99
159
  schemaRegistry,
100
- 10023, // Port
101
- '127.0.0.1' // Host
160
+ 10023,
161
+ '127.0.0.1',
102
162
  );
103
163
 
104
- // 3. Start & Stop
105
164
  await simulator.start();
106
- console.log('Simulator running...');
165
+ await simulator.stop();
166
+ ```
107
167
 
108
- // ... run your tests ...
168
+ `InMemoryStateRepository` takes no arguments. JSON persistence is a CLI option (`--storage json`). It is not a library export.
109
169
 
110
- await simulator.stop();
170
+ Further exports: `X32State`, `SubscriptionManager`, `OscMessage`, `X32Address`, `X32Node`, `MeterData`, `METER_COUNTS`, `MeterService`, `DEFAULT_CONFIG`, `mergeConfig`, `LogCategory`, `ConsoleLogger`, `UdpNetworkGateway`, `OscCodec`, `SchemaFactory`, `SchemaRegistry`, and the types `MeterMode`, `MeterLevelLookup`, `SimulatorConfig`, `INetworkGateway`, `ILogger`, `IStateRepository`.
171
+
172
+ ### `setParameter` / `getParameter`
173
+
174
+ ```typescript
175
+ simulator.setParameter('/ch/01/mix/fader', 0.5);
176
+ simulator.getParameter('/ch/01/mix/fader');
111
177
  ```
112
178
 
113
- ### Available Exports
179
+ `setParameter` takes an OSC number or string, not scene text. It throws:
114
180
 
115
- The library exports the following components for advanced usage:
181
+ * `Read-only parameter /-stat/solo`
182
+ * `Unknown address <address>`
183
+ * `Invalid value for <address>`
116
184
 
117
- **Core Services**
118
- * `SimulationService`: Main entry point.
119
- * `SchemaRegistry`: Manages the OSC node definitions.
120
- * `SchemaFactory`: Generates the default X32 schema.
185
+ `getParameter` throws `Unknown address <address>` when the address is not in the schema. It returns `undefined` when the address is known and nothing has been stored yet.
121
186
 
122
- **Domain Entities & Models**
123
- * `X32State`: The "Digital Twin" state container.
124
- * `SubscriptionManager`: Manages `/xremote` and `/subscribe` clients.
125
- * `X32Address`: Helper for parsing OSC paths.
126
- * `OscMessage`: Wrapper for parsed OSC messages.
127
- * `MeterData`: Helper for handling meter blobs.
128
- * `X32Node`: Represents a single parameter (type, default value).
187
+ `setParameter` notifies every `/xremote` client. There is no sender to leave out.
129
188
 
130
- **Infrastructure**
131
- * `UdpNetworkGateway`: Default UDP implementation.
132
- * `ConsoleLogger`: Default logger implementation.
133
- * `OscCodec`: Encodes/Decodes X32-specific OSC packets.
134
- * `InMemoryStateRepository`: Default state storage.
189
+ ### Meters
135
190
 
136
- **Types & Interfaces**
137
- * `INetworkGateway`, `ILogger`, `IStateRepository`
138
- * `OscPacket`, `OscMsg`, `RemoteClient`
139
- * `LogCategory`
191
+ `DEFAULT_CONFIG.METER_MODE` is `'silent'`. Pass `{ METER_MODE: 'fixed', METER_LEVELS }` or `'noise'` in the config object (the argument after the model).
140
192
 
141
- ---
193
+ `MeterLevelLookup` is `(meterId, index) => number | undefined`. A missing return keeps the silent value for that slot. `silent` is no signal: levels at `0`, gain-reduction meters at `1.0`. `fixed` without a lookup is the same as `silent`. `noise` is random and is for a demo only.
194
+
195
+ `METER_COUNTS` maps `/meters/0` … `/meters/16` to the float counts in the table above. `MeterService` builds the blobs.
142
196
 
143
- ## 🎛️ Simulated OSC Map
197
+ ### Other defaults
144
198
 
145
- The simulator covers a vast majority of the X32 OSC command set:
199
+ | Key | Value |
200
+ |-----|-------|
201
+ | `DEFAULT_CONFIG.PERMISSIVE` | `false`. An unknown Set is rejected. `true` stores it. |
202
+ | `DEFAULT_CONFIG.MAX_REPLY_BURST` | `500`. One warning when a single command produces more replies than this. The replies are still sent. |
203
+ | `DEFAULT_CONFIG.BROADCAST_INTERVAL_MS` | `50` |
204
+ | `DEFAULT_CONFIG.SUBSCRIPTION_TTL_MS` | `10000` |
205
+ | `DEFAULT_CONFIG.CLEANUP_INTERVAL_MS` | `5000` |
146
206
 
147
- | Category | OSC Path Pattern | Description |
148
- |----------|------------------|-------------|
149
- | **Channels** | `/ch/{01..32}/...` | Config, Preamp, Gate, Dyn, EQ, Mix, Sends |
150
- | **Buses** | `/bus/{01..16}/...` | Config, Dyn, EQ, Mix, Sends |
151
- | **DCA** | `/dca/{1..8}/...` | Config, Fader, Mute |
152
- | **Matrix** | `/mtx/{01..06}/...` | Config, Dyn, EQ, Mix |
153
- | **Aux In** | `/auxin/{01..08}/...` | Config, Preamp, EQ, Mix |
154
- | **FX Returns** | `/fxrtn/{01..08}/...` | Config, EQ, Mix |
155
- | **Effects** | `/fx/{1..8}/...` | Type, Parameters, Source |
156
- | **Headamps** | `/headamp/{000..127}/...` | Gain, Phantom Power |
157
- | **Routing** | `/config/routing/...` | Input, Output, Card, AES50 Routing |
158
- | **Status** | `/-stat/...` | Selected Channel, Sends on Fader, Screen State |
159
- | **Meters** | `/meters/...` | Meter data blobs (simulated noise) |
207
+ The CLI flag `--permissive` sets `PERMISSIVE`. The CLI flag `--meters` sets `METER_MODE`.
208
+
209
+ A second client that has sent `/xremote` receives a parameter change. See [examples/dual-client-e2e.ts](./examples/dual-client-e2e.ts).
160
210
 
161
211
  ---
162
212
 
163
- ## 🧪 Testing Example (E2E)
213
+ ## Known differences from a real console
214
+
215
+ These points are not settled by the protocol documents. The simulator keeps the behaviour below until a real console says otherwise.
216
+
217
+ | Id | Simulator behaviour |
218
+ |----|---------------------|
219
+ | V1 | The sender of a Set is notified with every other subscriber. Some documents notify only the other clients. |
220
+ | V2 | A mute group (`/config/mute/N`) writes `/ch/xx/mix/on` for every channel in that group. Turning the group off unmutes a channel that was muted by hand. |
221
+ | V3 | After init, a fader is `0.75`, `mix/on` is `0`, and a channel name is `01`. |
222
+ | V4 | `/meters/99`, a `/meters/5` bank outside `0..3`, or a `/meters/6` channel outside `0..71` gets no reply. |
223
+ | V5 | An OSC Set outside the legal range is refused. A `/` scene line still snaps past the edges (`textToOsc`). |
224
+ | V6 | `/batchsubscribe` builds a blob for the paths it is given, including a path that is not a meter. The document marks that case as to-be-verified. |
225
+ | V7 | `/node` accepts a path with or without a leading slash. An unknown path gets no reply. A parent node returns the whole line, every field. |
226
+ | V8 | The nine actions that have an effect do not write the action address back to `0`. |
227
+ | V9 | An OSC Set is notified even when the stored value does not change. A `/` line does not write a value that is already equal. |
228
+ | V10 | A Get of a node path such as `/ch/01/mix` is not answered with the first parameter. Use `/node`. |
229
+ | V11 | A Set with several numbers on a node address (`/ch/01/eq/1` with `,ifff`) is applied field by field, in the order of the node, as the document describes on p. 12. A node address with a string argument is ignored: the document’s note 7 says a string there means something else on a real X32. X32-Edit uses the `/` command for text. |
230
+ | V12 | 100 cues, scenes and snippets (`000`–`099`), not 500. |
231
+ | V13 | OSC bundles are accepted and each message is handled. |
232
+ | V14 | Stereo link, DCA grouping, `sendsonfader`, `hardmute` and `invertmutes` are stored. They do not change other parameters. Mute groups are the exception in V2. |
233
+
234
+ **Faders.** An untouched fader reads the schema default `0.75`. A written 0 dB is the float `0.75` before the snap, then `trunc(0.75 * 1023.5) / 1023`, which is `767/1023` (about `0.7498`). Writes use the console’s 1024-step grid. The schema default is not passed through that grid.
164
235
 
165
- 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`.
236
+ ---
166
237
 
167
- You can find a complete, runnable example of this in [examples/dual-client-e2e.ts](./examples/dual-client-e2e.ts).
238
+ ## Tests and audit tools
168
239
 
169
- ### Multi-Client Sync Test Snippet
240
+ ```bash
241
+ npm test # unit suite, no sockets and no real timers
242
+ npm run test:conformance # UDP suite, tests/conformance, separate Vitest project
243
+ npm run type-check
244
+ npm run lint
245
+ ```
170
246
 
171
- ```typescript
172
- // Client A and Client B both subscribe to /xremote
173
- clientA.send('/xremote');
174
- clientB.send('/xremote');
247
+ `tests/conformance/**` is excluded from `npm test`.
175
248
 
176
- // Client A changes a fader
177
- clientA.send('/ch/01/mix/fader', 0.85);
249
+ The audit tools live in [scripts/audit/README.md](./scripts/audit/README.md). Each one talks to a simulator that is already running. They are not part of `npm test`.
178
250
 
179
- // Result: BOTH Client A and Client B receive the update from the simulator
180
- // This ensures your UI stays in sync across multiple devices.
251
+ ```bash
252
+ node scripts/audit/probe.mjs <port>
253
+ node scripts/audit/fuzz.mjs <port>
254
+ node scripts/audit/relay.mjs <listenPort> <simPort> <out.jsonl>
255
+ node scripts/audit/scene-roundtrip.mjs <port> <scene.scn>
256
+ npm run build && node scripts/audit/ref-diff.mjs <dir with X32.c and X32*.h>
181
257
  ```
182
258
 
183
259
  ---
184
260
 
185
- ## 🤝 Contributing
261
+ ## Contributing
186
262
 
187
- We welcome contributions! Please see [INSTALL.md](./INSTALL.md) for development instructions.
263
+ See [INSTALL.md](./INSTALL.md).
188
264
 
189
- ## 📄 License
265
+ ## License
190
266
 
191
- MIT © [Jonathan Moutier](https://github.com/djodjonx)
267
+ MIT © [Jonathan Moutier](https://github.com/djodjonx)