audio-mixer-engine 1.1.5 → 1.2.0
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 +43 -0
- package/dist/audio-mixer-engine.cjs.js +1 -1
- package/dist/audio-mixer-engine.es.js +1891 -673
- package/package.json +2 -1
- package/src/index.js +4 -0
- package/src/lib/musicxml/metadata-extractor.js +116 -0
- package/src/lib/musicxml/mxl-loader.js +230 -0
- package/src/lib/musicxml/note-extractor.js +291 -0
- package/src/lib/musicxml/structure-analyzer.js +529 -0
- package/src/lib/musicxml/timing-engine.js +250 -0
- package/src/lib/musicxml/xml-helpers.js +112 -0
- package/src/lib/musicxml-converter.js +281 -0
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ A part-centric JavaScript audio library for mixer applications. Provides individ
|
|
|
8
8
|
- **MIDI processing**: Parse files, beat/bar mapping, tempo changes, metadata extraction
|
|
9
9
|
- **Dual audio engines**: SpessaSynth (soundfont, ~10-50MB) or Lightweight (samples, ~574KB bundle)
|
|
10
10
|
- **Playback control**: Metronome, lead-in, seeking, speed changes, bar navigation, real-time events
|
|
11
|
+
- **MusicXML support**: Load MusicXML/MXL files directly — repeats, voltas, jumps, lyrics, dynamics
|
|
11
12
|
- **Mixer-ready**: Designed for solo/mute, routing, and level monitoring workflows
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
@@ -63,6 +64,23 @@ for (const [partName, outputNode] of manager.getPartOutputs()) {
|
|
|
63
64
|
await manager.play({ leadIn: true, metronome: true });
|
|
64
65
|
```
|
|
65
66
|
|
|
67
|
+
### Loading MusicXML Files
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
import { MusicXmlConverter, loadMusicXml, PlaybackManager } from 'audio-mixer-engine';
|
|
71
|
+
|
|
72
|
+
// Load MusicXML or MXL file (auto-detects format)
|
|
73
|
+
const xmlString = await loadMusicXml(fileArrayBuffer);
|
|
74
|
+
|
|
75
|
+
// Convert to parsedData and load into PlaybackManager
|
|
76
|
+
const converter = new MusicXmlConverter();
|
|
77
|
+
const parsedData = converter.convert(xmlString);
|
|
78
|
+
await manager.load(parsedData);
|
|
79
|
+
|
|
80
|
+
// From here on, playback works exactly the same as MIDI
|
|
81
|
+
await manager.play({ leadIn: true, metronome: true });
|
|
82
|
+
```
|
|
83
|
+
|
|
66
84
|
## Key Concepts
|
|
67
85
|
|
|
68
86
|
**Part-centric design**: Each musical part gets an independent `ChannelHandle` with its own `AudioNode` output. Your application connects these outputs to gain controls, analyzers, and effects.
|
|
@@ -198,6 +216,28 @@ audioEngine.allSoundsOff();
|
|
|
198
216
|
audioEngine.destroy();
|
|
199
217
|
```
|
|
200
218
|
|
|
219
|
+
### MusicXML Processing
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
import { MusicXmlConverter, loadMusicXml, loadMusicXmlSync } from 'audio-mixer-engine';
|
|
223
|
+
|
|
224
|
+
// Load from ArrayBuffer (MXL or plain XML)
|
|
225
|
+
const xmlString = await loadMusicXml(fileArrayBuffer);
|
|
226
|
+
|
|
227
|
+
// Or load synchronously when data is already available
|
|
228
|
+
const xmlString2 = loadMusicXmlSync(uint8ArrayData);
|
|
229
|
+
|
|
230
|
+
// Convert to parsedData (same format as MidiParser output)
|
|
231
|
+
const converter = new MusicXmlConverter();
|
|
232
|
+
const parsedData = converter.convert(xmlString, {
|
|
233
|
+
defaultTempo: 120, // Fallback tempo if none in score
|
|
234
|
+
defaultVelocity: 80 // Fallback note velocity
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// parsedData includes parts, barStructure, metadata, and structureMetadata
|
|
238
|
+
// Use with PlaybackManager or MidiPlayer just like MIDI-parsed data
|
|
239
|
+
```
|
|
240
|
+
|
|
201
241
|
## Mixer Example
|
|
202
242
|
|
|
203
243
|
```javascript
|
|
@@ -251,11 +291,13 @@ class AudioMixer {
|
|
|
251
291
|
|
|
252
292
|
## Additional Documentation
|
|
253
293
|
|
|
294
|
+
- **[MUSICXML.md](./MUSICXML.md)** - MusicXML/MXL file loading, supported elements, and API reference
|
|
254
295
|
- **[LIGHTWEIGHT_ENGINE.md](./LIGHTWEIGHT_ENGINE.md)** - Lightweight engine setup and sample file configuration
|
|
255
296
|
- **[METADATA.md](./METADATA.md)** - Score metadata, part configuration, and playback modifiers
|
|
256
297
|
- **[BEATMAPPING.md](./BEATMAPPING.md)** - Beat mapping and non-linear playback structures
|
|
257
298
|
- **[INTERFACE.md](./INTERFACE.md)** - Complete interface contract for UI integration
|
|
258
299
|
- **[INIT_PROGRESS.md](./INIT_PROGRESS.md)** - Initialization progress tracking and best practices
|
|
300
|
+
- **[IOS_AUDIO_RESUMPTION.md](./IOS_AUDIO_RESUMPTION.md)** - Handling iOS screen lock/background audio suspension
|
|
259
301
|
|
|
260
302
|
## Development
|
|
261
303
|
|
|
@@ -281,3 +323,4 @@ MIT License - see LICENSE file for details.
|
|
|
281
323
|
|
|
282
324
|
- **Chromium browsers** (Chrome, Edge, Brave): May experience audio distortion due to Web Audio API bugs
|
|
283
325
|
- **Safari**: Should work with standard Web Audio API support
|
|
326
|
+
- **iOS Safari**: AudioContext is suspended on screen lock/app background. Consuming applications must handle resumption -- see [IOS_AUDIO_RESUMPTION.md](./IOS_AUDIO_RESUMPTION.md)
|