Limits and troubleshooting
Lua scripts build bounded action plans for each trigger. AudioX evaluates a plan, then replays it outside the audio thread. These limits apply per evaluation:
| Resource | Limit |
|---|---|
| Named scripts | 16 |
| Name | 63 UTF-8 bytes |
| Source text | 17,408 UTF-8 bytes |
| Queued actions | 128 |
| Registered callbacks | 32 per script evaluation |
| Total waits and typing duration | 60,000 ms |
| Instructions | 100,000, shared by setup and matching callbacks |
| Lua memory | 1 MiB per evaluation |
| Type text | 255 bytes per call; 1,024 characters total |
| Persistent state | 32 scalar fields |
| Persistent script options | 32 scalar fields; same key/string limits as state |
| Native WebUI controls | 16 per script |
| Custom script files | 32; 4,096 bytes each; 65,536 bytes total including options |
| Storage reads/listing | 32 calls per event |
| State key | 31 bytes |
| State string value | 127 bytes |
| String value | 4,096 bytes |
| Table or string span | 1,024 items |
| Cumulative library work | 65,536 units |
string.format fields | 16; width and precision up to 256 |
| Configuration read size | 65,536 bytes per file; four reads per evaluation |
| Configuration lines | 1,024 lines, 4,096 bytes per line |
| Configuration write size | 4,096 bytes per write |
| Configuration/custom-file write payload | 8,192 bytes total, including terminators |
| Pending sound events | 128; excess events dropped and logged |
| System log query | 128 lines, 4,096 output bytes; scans at most 64 KiB |
The engine also limits queued work to one evaluation per 10 ms, allows at most 16 scripts and 16 pending triggers, and uses a 65-second playback timeout. These are safety bounds, not timing guarantees.
Callback scripts get a fresh Lua environment on every event. Their top-level registration runs at save/validation time as well, without access to event, state, configuration reads/writes or queued device actions. Put those operations inside handlers. Register hooks unconditionally; the runtime checks that subscriptions still match the validated set. An error in any matching handler discards the entire event's pending actions and state changes.
Event storms may fill the shared trigger queue. Filter sound events and avoid recursive sound playback. Official configuration/device-management scripts require acknowledgment on save; read-only references also prompt conservatively. Script-owned options/files do not grant access to official settings. File errors are reported explicitly. Writes are raw replacements, may need reload/restart, and should not be performed on every CC/audio event. See the configuration API.
An evaluation failed
Check the script's reported error, then verify:
- Every keyboard chord uses supported key names and valid
+-separated keys. wait()receives an integer from0to60000.type()receives allowed characters and an interval from30to60000.- MIDI and light values are valid integers in their documented ranges.
- The script stays within source, action, duration, instruction, and memory limits.
statecontains no more than 32 scalar values.
Failed evaluations are transactional: queued actions and state updates are discarded, including actions created before the error.
No keyboard input appears
- Enable USB Keyboard in AudioX Config and apply the configuration.
- Confirm that the Pi is connected to the host as a USB device.
- Focus an editable field in the intended host application.
- Check the host layout and Caps Lock for
type(). - Try one small
tap("A")test.
Keyboard actions can be canceled by editing a mapping, disconnecting, disabling the feature, or restarting AudioX. Disconnect-time key releases are best effort.
Text differs from the script
type() simulates keys for a US layout; it does not transmit Unicode text. Use a US host layout with Caps Lock off. Unicode, carriage return, other control characters, and embedded NUL are not supported.
A light changes briefly or not at all
light() temporarily changes only the mapped pad. Normal controller lighting resumes at sequence completion; place wait() or another action after a light call to keep it visible. Check that the selected controller is connected and Bind to a MIDI pad is enabled and saved. light() without a MIDI binding reports an explicit runtime error, including for web Run; a configured note number alone is not a binding.
MIDI or sound output is missing
MIDI script output is directed to the connected MIDI controller, never automatically to the USB host. Ensure the intended controller is connected and use zero-based channel numbers. For raw note output, send a matching note-off. For soundboard playback, check that the basename identifies an available preloaded sound; use AudioX Upload/Refresh before triggering. The device does not scan storage on each trigger. Device disconnection or bounded output backpressure can prevent queued output from completing. Light/MIDI plans need the selected connected controller, but not USB Keyboard or a USB host. Only keyboard action plans require that setting and host. Sound, effects and volume plans need neither device.
Counters or clocks seem to reset
state resets on script edits, cancellation/failure, or AudioX restart. script_config and storage survive restart and edits under the script's stable ID; they are not included in the standard configuration backup. USB loss and keyboard disable do not globally reset non-keyboard scripts. millis() and epoch() are frozen to the original trigger while a plan waits in the queue; evaluate a later note-on to obtain a new snapshot. The device's wall clock may be unset, making epoch() unsuitable for absolute timestamps until system time is configured.
A playback failure (such as a missing loaded sound) cancels pending scripts and resets state. Evaluation failures are atomic, but playback failures cannot undo actions already delivered. Timer hooks start only after the startup interval and do not replay missed ticks; a busy script may see fewer than one per second.
Web Run or a device control fails
Run queues a saved script by its stable ID; a successful response is not a playback-completion acknowledgment. Non-200 responses appear as errors; reload the script list for later runtime errors. A failed save keeps the editor contents. Check the 16-script limit and count name/source lengths in UTF-8 bytes, not characters.
Use the exact routing thing ID returned by /api/audio/volumes for volume actions, not a display name or generic "master". Script volume percentages stop at unity (100%); adjustments are percentage points clamped to 0–100. Effect values use actual parameter ranges, not normalized 0–1 values; out-of-range values are runtime errors. These controls are runtime-only and do not save configuration. Lua scripts cannot change routing.