Add xToys pattern import via URL paste

- XToysPattern.cs: fetch pattern from xtoys.app API (one call), parse
  script-v3 JSON, resolve slider defaults, evaluate sine/straight steps
  to WaveFrames at 100ms resolution
- Frequency mapping: 0%=1000ms deep, 100%=10ms buzzy
- MainForm: Pattern button + input dialog, continuously enqueues pattern
  frames as a loop, Stop All cancels
- Fix: handle JSON values that are numbers vs strings (end/start fields)
- NOTES.md: xToys slider parameter intel + frequency mapping docs
This commit is contained in:
2026-08-08 19:44:25 +00:00
parent ccc5093ee2
commit bbd9bb6d6b
3 changed files with 311 additions and 11 deletions
+25
View File
@@ -129,3 +129,28 @@ web game / userscript ──WS──> Substation ──BLE──> Coyote 3.0
```
Build: `dotnet run -c Release`
## xToys pattern import
Paste a URL like `https://xtoys.app/patterns/-OuhuHOuY1AlPPoCJlzc` into the Pattern dialog.
The app fetches the pattern once from `https://xtoys.app/api/getPatternv2`, evaluates it
locally, and plays it as a continuous loop. No ongoing API calls.
### xToys script-v3 slider parameters
From pattern analysis:
- **A CH** (0.510): Divides the pattern between channels. If A=1 and B=2, then 2/3 of
the pattern goes to channel B. Controls the "hold" duration on channel A.
- **B CH** (0.510): Same division for channel B. Controls the "pause" duration.
- **Ramp** (0.55): Applies a smoothness filter to transitions. Higher = slower ramps.
- **Min Freq** (0100): Low cutoff on frequency values. No idea why.
- **Min Level** (0100): Low cutoff on intensity values. Floor that's held during "pause".
### Frequency mapping
xToys frequency is 0100 (percentage). Mapped to e-stim period:
- 0% = 1000ms (1Hz, deep thump)
- 100% = 10ms (100Hz, buzzy)
Formula: `period_ms = 1000 - 9.9 * freq_pct`