From 295221d1b2e931121e732c25c996712257361fa8 Mon Sep 17 00:00:00 2001 From: w1n5t0n Date: Sun, 22 Mar 2026 11:01:50 +0200 Subject: [PATCH] feat(playground): unify learning modes, add MIDI input and gamepad support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge Examples/RL tabs into single unified toolbar across all four UIs. Users can now freely mix supervised learning (Add Example + Train) with RL feedback (thumbs up/down) without switching modes. Param bar dragging is always enabled. Add Web MIDI input module (js/synth/midi-input.js) for external MIDI controllers — routes note on/off to C15 synth, CC 1/2 to joystick. Add gamepad module (js/ui/gamepad.js) with auto-detection, deadzone, and axis normalization across all UIs. Fix synth parameter sync: routeOutputs() now called after trainModel() in onThumbsUp and loadState to prevent stale params on first joystick move. Add separate Clear Examples button (dataset only, keeps weights). --- playground/a-immersive.html | 22 ++- playground/b-workbench.html | 50 +++---- playground/c-journey.html | 37 ++--- playground/css/a-immersive.css | 5 + playground/css/b-workbench.css | 25 ---- playground/css/c-journey.css | 59 +------- playground/css/style.css | 28 +--- playground/js/a-app.js | 223 +++++++++++++----------------- playground/js/app.js | 117 +++++----------- playground/js/b-app.js | 118 ++++++++++++---- playground/js/c-app.js | 123 +++++++++++----- playground/js/synth/midi-input.js | 157 +++++++++++++++++++++ playground/js/ui/controls.js | 54 ++------ playground/js/ui/gamepad.js | 157 +++++++++++++++++++++ 14 files changed, 700 insertions(+), 475 deletions(-) create mode 100644 playground/js/synth/midi-input.js create mode 100644 playground/js/ui/gamepad.js diff --git a/playground/a-immersive.html b/playground/a-immersive.html index e24ef85..3df0926 100644 --- a/playground/a-immersive.html +++ b/playground/a-immersive.html @@ -54,6 +54,7 @@
+
@@ -66,11 +67,9 @@ - - -
- - -
- - - + + @@ -151,6 +149,7 @@
Loss
Noise0.050
Joy X,Y0.50, 0.50
+
@@ -166,19 +165,12 @@

Train a neural network to map 2D joystick positions to output parameters using interactive machine learning.

Input Space

The heatmap shows what the network has learned across the input space. Bright dots show training examples. Drag anywhere on the map to move the input position. Double-click or press Follow to toggle follow mode.

-

Examples Mode

-
    -
  1. Drag on the input space to a position
  2. -
  3. Expand a parameter group and drag bars to set desired outputs
  4. -
  5. Press Add Example
  6. -
  7. Repeat, then Train
  8. -
-

RL Mode

-
    -
  1. Move around the input space — the network produces outputs
  2. -
  3. Like it? Press + Good
  4. -
  5. Not quite? Press − Explore for variation
  6. -
+

Learning

+

Both approaches can be freely mixed:

+

Output Modes

Visual: 20 params control the flow-field particle system. Synth: 126 params control a C15 synthesizer engine.

Tap outside to close

diff --git a/playground/c-journey.html b/playground/c-journey.html index 73aa72b..d429e05 100644 --- a/playground/c-journey.html +++ b/playground/c-journey.html @@ -63,19 +63,22 @@ + +
- -
- - -
- -