npm.io
1.0.0 • Published 2d ago

smpltrek-builder

Licence
MIT
Version
1.0.0
Deps
0
Size
396 kB
Vulns
0
Weekly
0

smpltrek-builder (JS)

Packs a drum-pattern-engine song into a device-loadable Sonicware SmplTrek project Config. No runtime dependencies.

It maps universal instrument roles to device notes (per-kit KIT_MAPS), writes notes + velocity + micro-timing + native swing + scene length/repeats/time-signature, and clones the bundled base template. Also ships the SmplTrek genre presets.

Install

npm install drum-pattern-engine smpltrek-builder

Usage

import { arrange } from 'drum-pattern-engine';
import { buildProject, template, GENRES, GENRE_METER } from 'smpltrek-builder';

const g = GENRES.JAZZ;
const params = { ...g.p, instrumentSpread: g.p.densitySpread, repetition: 0.7,
                 oddMeter: GENRE_METER.JAZZ.amount };
const song = arrange(params, { length: 'full', bpm: g.bpm, seed: 12345,
  structure: g.struct, feel: g.feel, meterMode: GENRE_METER.JAZZ.mode, meterSet: GENRE_METER.JAZZ.set });

const cfg = buildProject(template.bytes(), song, { kit: g.kit, bpm: g.bpm });
// cfg: Uint8Array -> write as SmplTrek/Project/<name>/Config

API

  • buildProject(templateBytes, song, { kit, bpm })Uint8Array device Config.
  • template.bytes() → bundled base Config to clone.
  • setStepAuto(d, ch, lane, step, value) → per-step LEVEL/PAN/SEND automation.
  • KIT_MAPS → role→note maps for the 15 factory kits.
  • GENRES, GENRE_METER → SmplTrek presets (params + kit + meter profile).

Reverse-engineered Config format (notes)

Config = nested 16-byte-header TLV chunks. Tempo: PJST +4, uint32 LE = BPM×10. Note cell (SQDT, 8 bytes): note · velocity · _ · timing(int8 ±99) · 0x32 · …. Clip (SQPR): byte2 length-in-steps, byte4 note-resolution, byte5 swing %. Scene (SCDT, 4 bytes): used · repeats · length-bars · time-sig. Automation (DRPL): lanes 0/1/2 = LEVEL/PAN/SEND.

SmplTrek and Sonicware are trademarks of Sonicware Inc. This is an independent, unofficial tool — not affiliated with, endorsed by, or sponsored by Sonicware.

License

MIT — Alexander Schornberg.

Keywords