@drop-ai/core 0.3.1 → 0.3.3
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 +22 -22
- package/package.json +10 -7
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# drop-
|
|
1
|
+
# @drop-ai/core
|
|
2
2
|
|
|
3
3
|
Headless DAW (Digital Audio Workstation) engine for TypeScript/JavaScript. Provides domain models, command system, audio engine, automation, plugins, and MIDI — all with zero browser or framework dependencies.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install drop-
|
|
6
|
+
npm install @drop-ai/core
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## Features
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
TrackType,
|
|
30
30
|
CommandExecutor,
|
|
31
31
|
CommandType,
|
|
32
|
-
} from 'drop-
|
|
32
|
+
} from '@drop-ai/core';
|
|
33
33
|
|
|
34
34
|
// 1. Implement AudioProvider interface for your platform
|
|
35
35
|
class MyAudioBackend implements AudioProvider {
|
|
@@ -75,7 +75,7 @@ await CommandExecutor.getInstance().execute({
|
|
|
75
75
|
│ │ Automation, Plugins, MIDI, Markers │ │
|
|
76
76
|
│ └───────────────────────────────────────┘ │
|
|
77
77
|
│ │
|
|
78
|
-
│ drop-
|
|
78
|
+
│ @drop-ai/core │
|
|
79
79
|
└──────────────────────────────────────────────────┘
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -88,7 +88,7 @@ await CommandExecutor.getInstance().execute({
|
|
|
88
88
|
The root container for a DAW project. Manages tracks, sources, markers, ranges, tempo, and transport state.
|
|
89
89
|
|
|
90
90
|
```typescript
|
|
91
|
-
import { Session, TrackType } from 'drop-
|
|
91
|
+
import { Session, TrackType } from '@drop-ai/core';
|
|
92
92
|
|
|
93
93
|
const session = new Session('My Song', undefined, 44100);
|
|
94
94
|
|
|
@@ -149,7 +149,7 @@ track.soloChanged.connect((soloed) => console.log('Solo:', soloed));
|
|
|
149
149
|
A segment of audio on the timeline, referencing a `Source`.
|
|
150
150
|
|
|
151
151
|
```typescript
|
|
152
|
-
import { Region } from 'drop-
|
|
152
|
+
import { Region } from '@drop-ai/core';
|
|
153
153
|
|
|
154
154
|
const region = new Region(
|
|
155
155
|
'region-1', // id
|
|
@@ -171,7 +171,7 @@ region.resize(44100 * 8); // resize to 8 seconds
|
|
|
171
171
|
Central controller connecting the session to an audio backend. Uses the singleton pattern with dependency injection.
|
|
172
172
|
|
|
173
173
|
```typescript
|
|
174
|
-
import { AudioEngine, AudioProvider } from 'drop-
|
|
174
|
+
import { AudioEngine, AudioProvider } from '@drop-ai/core';
|
|
175
175
|
|
|
176
176
|
// Initialize with your backend implementation
|
|
177
177
|
const engine = AudioEngine.getInstance(myBackend);
|
|
@@ -196,10 +196,10 @@ engine.setBackend(new DifferentBackend());
|
|
|
196
196
|
|
|
197
197
|
### AudioProvider Interface
|
|
198
198
|
|
|
199
|
-
Implement this interface to connect drop-
|
|
199
|
+
Implement this interface to connect @drop-ai/core to any audio system.
|
|
200
200
|
|
|
201
201
|
```typescript
|
|
202
|
-
import { AudioProvider } from 'drop-
|
|
202
|
+
import { AudioProvider } from '@drop-ai/core';
|
|
203
203
|
|
|
204
204
|
class WebAudioBackend implements AudioProvider {
|
|
205
205
|
async initialize(): Promise<void> { /* ... */ }
|
|
@@ -244,7 +244,7 @@ All state mutations can go through the command system, providing validation (via
|
|
|
244
244
|
### Executing Commands
|
|
245
245
|
|
|
246
246
|
```typescript
|
|
247
|
-
import { CommandExecutor, CommandType } from 'drop-
|
|
247
|
+
import { CommandExecutor, CommandType } from '@drop-ai/core';
|
|
248
248
|
|
|
249
249
|
const executor = CommandExecutor.getInstance();
|
|
250
250
|
|
|
@@ -294,7 +294,7 @@ await history.commitTransaction();
|
|
|
294
294
|
### Registering Custom Handlers
|
|
295
295
|
|
|
296
296
|
```typescript
|
|
297
|
-
import { CommandHandler, CommandResult } from 'drop-
|
|
297
|
+
import { CommandHandler, CommandResult } from '@drop-ai/core';
|
|
298
298
|
|
|
299
299
|
class MyCustomHandler implements CommandHandler {
|
|
300
300
|
readonly handledTypes = ['MY_CUSTOM_COMMAND'];
|
|
@@ -337,7 +337,7 @@ CommandExecutor.getInstance().registerHandler(new MyCustomHandler());
|
|
|
337
337
|
20+ built-in audio effect plugins, managed by `PluginManager`.
|
|
338
338
|
|
|
339
339
|
```typescript
|
|
340
|
-
import { PluginManager } from 'drop-
|
|
340
|
+
import { PluginManager } from '@drop-ai/core';
|
|
341
341
|
|
|
342
342
|
const manager = PluginManager.getInstance();
|
|
343
343
|
|
|
@@ -392,7 +392,7 @@ eq.parameterChanged.connect(({ id, value }) => {
|
|
|
392
392
|
Per-parameter automation with multiple recording modes.
|
|
393
393
|
|
|
394
394
|
```typescript
|
|
395
|
-
import { AutomationList, AutomationMode } from 'drop-
|
|
395
|
+
import { AutomationList, AutomationMode } from '@drop-ai/core';
|
|
396
396
|
|
|
397
397
|
const automation = new AutomationList();
|
|
398
398
|
|
|
@@ -423,7 +423,7 @@ automation.eraseRange(1.0, 3.0);
|
|
|
423
423
|
Type-safe event emitter inspired by Qt's Signal/Slot pattern. Used throughout the domain layer.
|
|
424
424
|
|
|
425
425
|
```typescript
|
|
426
|
-
import { Signal } from 'drop-
|
|
426
|
+
import { Signal } from '@drop-ai/core';
|
|
427
427
|
|
|
428
428
|
const signal = new Signal<number>();
|
|
429
429
|
|
|
@@ -477,7 +477,7 @@ history.historyChanged.connect(() => { /* ... */ });
|
|
|
477
477
|
Map keyboard shortcuts to commands.
|
|
478
478
|
|
|
479
479
|
```typescript
|
|
480
|
-
import { ActionRegistry, ActionCategory } from 'drop-
|
|
480
|
+
import { ActionRegistry, ActionCategory } from '@drop-ai/core';
|
|
481
481
|
|
|
482
482
|
const registry = ActionRegistry.getInstance();
|
|
483
483
|
|
|
@@ -510,7 +510,7 @@ const key = registry.getEffectiveKey('transport.play'); // 'Space'
|
|
|
510
510
|
### Custom Key Bindings
|
|
511
511
|
|
|
512
512
|
```typescript
|
|
513
|
-
import { KeyBindings } from 'drop-
|
|
513
|
+
import { KeyBindings } from '@drop-ai/core';
|
|
514
514
|
|
|
515
515
|
const bindings = KeyBindings.getInstance();
|
|
516
516
|
|
|
@@ -527,7 +527,7 @@ bindings.resetToDefaults();
|
|
|
527
527
|
Persistent settings with defaults.
|
|
528
528
|
|
|
529
529
|
```typescript
|
|
530
|
-
import { Preferences } from 'drop-
|
|
530
|
+
import { Preferences } from '@drop-ai/core';
|
|
531
531
|
|
|
532
532
|
const prefs = Preferences.getInstance();
|
|
533
533
|
|
|
@@ -557,7 +557,7 @@ prefs.resetToDefaults();
|
|
|
557
557
|
Session persistence via IndexedDB (browser) or localStorage fallback.
|
|
558
558
|
|
|
559
559
|
```typescript
|
|
560
|
-
import { SessionStorage } from 'drop-
|
|
560
|
+
import { SessionStorage } from '@drop-ai/core';
|
|
561
561
|
|
|
562
562
|
const storage = SessionStorage.getInstance();
|
|
563
563
|
|
|
@@ -593,7 +593,7 @@ import {
|
|
|
593
593
|
PluginInsert,
|
|
594
594
|
SendProcessor,
|
|
595
595
|
MeterProcessor,
|
|
596
|
-
} from 'drop-
|
|
596
|
+
} from '@drop-ai/core';
|
|
597
597
|
|
|
598
598
|
// Processor types available in the chain:
|
|
599
599
|
// GainProcessor — Fader / Trim level control
|
|
@@ -610,7 +610,7 @@ import {
|
|
|
610
610
|
### Node.js CLI
|
|
611
611
|
|
|
612
612
|
```typescript
|
|
613
|
-
import { AudioEngine, Session, CommandExecutor, CommandType } from 'drop-
|
|
613
|
+
import { AudioEngine, Session, CommandExecutor, CommandType } from '@drop-ai/core';
|
|
614
614
|
|
|
615
615
|
// Headless backend (no audio output)
|
|
616
616
|
class HeadlessBackend implements AudioProvider {
|
|
@@ -633,7 +633,7 @@ const snapshot = session.toJSON();
|
|
|
633
633
|
### Electron App
|
|
634
634
|
|
|
635
635
|
```typescript
|
|
636
|
-
import { AudioEngine, AudioProvider } from 'drop-
|
|
636
|
+
import { AudioEngine, AudioProvider } from '@drop-ai/core';
|
|
637
637
|
|
|
638
638
|
class ElectronAudioBackend implements AudioProvider {
|
|
639
639
|
// Use PortAudio or native audio APIs
|
|
@@ -648,7 +648,7 @@ await engine.initialize();
|
|
|
648
648
|
|
|
649
649
|
```typescript
|
|
650
650
|
import { useEffect, useState } from 'react';
|
|
651
|
-
import { AudioEngine, Session } from 'drop-
|
|
651
|
+
import { AudioEngine, Session } from '@drop-ai/core';
|
|
652
652
|
|
|
653
653
|
function useDAWEngine(backend: AudioProvider) {
|
|
654
654
|
const [engine] = useState(() => AudioEngine.getInstance(backend));
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drop-ai/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Headless DAW engine — domain models, command system, audio engine, automation, plugins, MIDI",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
6
9
|
"type": "module",
|
|
7
10
|
"main": "./dist/index.js",
|
|
8
11
|
"types": "./dist/index.d.ts",
|
|
@@ -25,6 +28,11 @@
|
|
|
25
28
|
"engines": {
|
|
26
29
|
"node": ">=18"
|
|
27
30
|
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.build.json",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
35
|
+
},
|
|
28
36
|
"dependencies": {
|
|
29
37
|
"zod": "^4.3.6"
|
|
30
38
|
},
|
|
@@ -57,10 +65,5 @@
|
|
|
57
65
|
"type": "git",
|
|
58
66
|
"url": "https://github.com/whizzkid/drop.ai",
|
|
59
67
|
"directory": "packages/core"
|
|
60
|
-
},
|
|
61
|
-
"scripts": {
|
|
62
|
-
"build": "tsc -p tsconfig.build.json",
|
|
63
|
-
"clean": "rm -rf dist",
|
|
64
|
-
"typecheck": "tsc --noEmit"
|
|
65
68
|
}
|
|
66
|
-
}
|
|
69
|
+
}
|