@dawcore/components 0.0.14 → 0.0.15
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/README.md +55 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Framework-agnostic Web Components for multi-track audio editing. Drop `<daw-edit
|
|
|
13
13
|
- **File drop** — Drag audio files onto the editor to add tracks
|
|
14
14
|
- **Recording** — Live mic recording with waveform preview, pause/resume, cancelable clip creation
|
|
15
15
|
- **Pre-computed peaks** — Instant waveform rendering from `.dat` files before audio decodes
|
|
16
|
+
- **MIDI tracks** — Programmatic MIDI clips render as piano-roll via `<daw-piano-roll>`. Playback via Tone.js adapter (native MIDI synth deferred). See [MIDI Tracks](#midi-tracks).
|
|
16
17
|
- **Track controls** — Volume, pan, mute, solo per track via `<daw-track-controls>`
|
|
17
18
|
- **Transport access** — Tempo, metronome, count-in, meter, effects via `@dawcore/transport`
|
|
18
19
|
- **CSS theming** — Dark mode by default, fully customizable via CSS custom properties
|
|
@@ -92,7 +93,7 @@ adapter.transport.setCountIn(true);
|
|
|
92
93
|
|
|
93
94
|
### Tone.js (effects, MIDI synths)
|
|
94
95
|
|
|
95
|
-
Uses Tone.js for audio processing. Single tempo/meter only.
|
|
96
|
+
Uses Tone.js for audio processing. Single tempo/meter only. **Required for MIDI playback** — the native adapter has no MIDI synth yet, so MIDI clips render as piano-roll but are silent.
|
|
96
97
|
|
|
97
98
|
```bash
|
|
98
99
|
npm install @waveform-playlist/playout tone
|
|
@@ -125,6 +126,50 @@ For multiple clips per track with independent positioning:
|
|
|
125
126
|
</daw-editor>
|
|
126
127
|
```
|
|
127
128
|
|
|
129
|
+
## MIDI Tracks
|
|
130
|
+
|
|
131
|
+
Programmatic MIDI clips render as piano-roll. Playback requires the Tone.js adapter (the native adapter has no MIDI synth yet). Use the `editor.addTrack({ midi })` sugar for the simplest path:
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
import { createToneAdapter } from '@waveform-playlist/playout';
|
|
135
|
+
|
|
136
|
+
const editor = document.querySelector('daw-editor');
|
|
137
|
+
editor.adapter = createToneAdapter({ ppqn: 960 });
|
|
138
|
+
|
|
139
|
+
await editor.addTrack({
|
|
140
|
+
name: 'Lead',
|
|
141
|
+
midi: {
|
|
142
|
+
notes: [
|
|
143
|
+
{ midi: 60, name: 'C4', time: 0.0, duration: 0.5, velocity: 0.8 },
|
|
144
|
+
{ midi: 64, name: 'E4', time: 0.5, duration: 0.5, velocity: 0.7 },
|
|
145
|
+
{ midi: 67, name: 'G4', time: 1.0, duration: 0.5, velocity: 0.8 },
|
|
146
|
+
],
|
|
147
|
+
channel: 0, // optional — 9 = GM percussion
|
|
148
|
+
program: 24, // optional — GM instrument 0-127 (used by SoundFontToneTrack)
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This expands to a `<daw-track render-mode="piano-roll">` containing a `<daw-clip>` whose `midiNotes` JS property is set to the notes array. Equivalent declarative form:
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<daw-track render-mode="piano-roll" name="Lead">
|
|
157
|
+
<daw-clip midi-channel="0" midi-program="24"></daw-clip>
|
|
158
|
+
</daw-track>
|
|
159
|
+
<script>
|
|
160
|
+
document.querySelector('daw-clip').midiNotes = [
|
|
161
|
+
{ midi: 60, name: 'C4', time: 0.0, duration: 0.5, velocity: 0.8 },
|
|
162
|
+
// ...
|
|
163
|
+
];
|
|
164
|
+
</script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
A clip is treated as MIDI iff `clip.midiNotes != null`. MIDI clips skip audio fetch + decode + peak generation. Trim handles and split-at-playhead are inert on MIDI clips for now (note slicing is a follow-up). Move drag works.
|
|
168
|
+
|
|
169
|
+
**Theming:** the piano-roll honors `--daw-piano-roll-note-color` (default `#2a7070`), `--daw-piano-roll-selected-note-color` (default `#3d9e9e`), and `--daw-piano-roll-background` (default `#1a1a2e`).
|
|
170
|
+
|
|
171
|
+
See `examples/dawcore-tone/midi.html` for a runnable demo (C major scale, PolySynth playback).
|
|
172
|
+
|
|
128
173
|
## Pre-Computed Peaks
|
|
129
174
|
|
|
130
175
|
For instant waveform rendering before audio finishes decoding:
|
|
@@ -233,6 +278,9 @@ daw-editor {
|
|
|
233
278
|
--daw-clip-header-text: #e0d4c8;
|
|
234
279
|
--daw-controls-width: 180px;
|
|
235
280
|
--daw-min-height: 200px;
|
|
281
|
+
--daw-piano-roll-note-color: #2a7070;
|
|
282
|
+
--daw-piano-roll-selected-note-color: #3d9e9e;
|
|
283
|
+
--daw-piano-roll-background: #1a1a2e;
|
|
236
284
|
}
|
|
237
285
|
```
|
|
238
286
|
|
|
@@ -259,11 +307,15 @@ Methods: `loadFiles(fileList)`, `splitAtPlayhead()`.
|
|
|
259
307
|
|
|
260
308
|
### `<daw-track>`
|
|
261
309
|
|
|
262
|
-
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `muted`, `soloed`, `mono
|
|
310
|
+
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `muted`, `soloed`, `mono`, `render-mode` (`'waveform' | 'piano-roll'`, default `'waveform'`).
|
|
263
311
|
|
|
264
312
|
### `<daw-clip>`
|
|
265
313
|
|
|
266
|
-
Declarative clip data. Attributes: `src`, `peaks-src`, `start`, `duration`, `offset`, `gain`.
|
|
314
|
+
Declarative clip data. Attributes: `src`, `peaks-src`, `start`, `duration`, `offset`, `gain`, `midi-channel`, `midi-program`. JS-only property: `midiNotes: MidiNoteData[] | null` (note arrays are too large for attributes).
|
|
315
|
+
|
|
316
|
+
### `<daw-piano-roll>`
|
|
317
|
+
|
|
318
|
+
Visual element for MIDI note rendering. Mounted automatically when the parent track has `render-mode="piano-roll"` — you don't usually instantiate it directly. See [MIDI Tracks](#midi-tracks).
|
|
267
319
|
|
|
268
320
|
### `<daw-transport for="editor-id">`
|
|
269
321
|
|