audio-mixer-engine 0.6.0 → 0.7.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 +53 -1
- package/dist/audio-mixer-engine.cjs.js +1 -1
- package/dist/audio-mixer-engine.es.js +237 -188
- package/package.json +1 -1
- package/src/lib/audio-engine.js +36 -1
- package/src/lib/spessasynth-audio-engine.js +55 -5
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ This library follows a **part-centric mixer design** where each musical part (so
|
|
|
17
17
|
- **Part-Centric Architecture**: Each musical part gets independent control and output
|
|
18
18
|
- **Individual Audio Outputs**: Access `AudioNode` outputs for each part for external mixing
|
|
19
19
|
- **Dual Volume Control**: Internal MIDI volume + external gain node control
|
|
20
|
-
- **Real-time Analysis**: Connect part outputs to analyzers for level metering and visualization
|
|
20
|
+
- **Real-time Analysis**: Connect part outputs to analyzers for level metering and visualization
|
|
21
21
|
- **MIDI Processing**: Parse and analyze MIDI files with part identification
|
|
22
22
|
- **Audio Synthesis**: SpessaSynth-based engine with soundfont support
|
|
23
23
|
- **Musical Navigation**: Beat mapping with bar-based navigation and real-time position tracking
|
|
@@ -26,6 +26,7 @@ This library follows a **part-centric mixer design** where each musical part (so
|
|
|
26
26
|
- **Master Volume Control**: Global volume management with emergency stop functionality
|
|
27
27
|
- **Interface Compliance**: Full IAudioMixerEngine interface for seamless mixer integration
|
|
28
28
|
- **Mixer Integration**: Designed for solo/mute, gain control, and routing workflows
|
|
29
|
+
- **Initialization Progress Tracking**: Real-time progress events with download progress bars for soundfont loading
|
|
29
30
|
|
|
30
31
|
## Installation
|
|
31
32
|
|
|
@@ -84,6 +85,56 @@ for (const [partName, outputNode] of manager.getPartOutputs()) {
|
|
|
84
85
|
await manager.play({ leadIn: true, metronome: true });
|
|
85
86
|
```
|
|
86
87
|
|
|
88
|
+
## Initialization Progress Tracking
|
|
89
|
+
|
|
90
|
+
The library provides real-time progress events during initialization, particularly useful for showing progress bars during soundfont downloads which can take 20+ seconds over the internet.
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import SpessaSynthAudioEngine from 'audio-mixer-engine';
|
|
94
|
+
|
|
95
|
+
const audioEngine = new SpessaSynthAudioEngine(audioContext);
|
|
96
|
+
|
|
97
|
+
// Listen for progress events
|
|
98
|
+
audioEngine.on('initProgress', (event) => {
|
|
99
|
+
console.log(`[${event.stage}] ${event.message}`);
|
|
100
|
+
|
|
101
|
+
// Show progress bar for soundfont download
|
|
102
|
+
if (event.progress !== undefined) {
|
|
103
|
+
progressBar.style.width = `${event.progress * 100}%`;
|
|
104
|
+
statusText.textContent = event.message;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Initialize with soundfont
|
|
109
|
+
await audioEngine.initialize('./soundfont.sf3');
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Progress Event Format
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
{
|
|
116
|
+
stage: 'loading-soundfont', // Stage identifier
|
|
117
|
+
message: 'Downloading soundfont: 45% (234 KB / 520 KB)', // Human-readable message
|
|
118
|
+
progress: 0.45 // Optional: 0.0-1.0 for stages with progress bars
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Initialization Stages
|
|
123
|
+
|
|
124
|
+
| Stage | Description | Has Progress | Typical Duration |
|
|
125
|
+
|-------|-------------|--------------|------------------|
|
|
126
|
+
| `importing` | Loading SpessaSynth library | No | ~20ms local, ~1.5s remote |
|
|
127
|
+
| `loading-soundfont` | **Downloading soundfont** | **Yes** | ~2s local, **~20s remote** |
|
|
128
|
+
| `loading-worklet` | Loading audio worklet | No | ~100ms local, ~2s remote |
|
|
129
|
+
| `creating-synth` | Setting up audio channels | No | ~60ms |
|
|
130
|
+
| `loading-soundbank` | Loading soundbank | No | ~100ms |
|
|
131
|
+
| `finalizing` | Finalizing setup | No | <10ms |
|
|
132
|
+
| `ready` | Complete | No | N/A |
|
|
133
|
+
|
|
134
|
+
**See [INIT_PROGRESS.md](./INIT_PROGRESS.md) for complete documentation, examples, and best practices.**
|
|
135
|
+
|
|
136
|
+
**Demo:** `demo/initialization-progress-demo.html` shows a working implementation with visual progress indicators.
|
|
137
|
+
|
|
87
138
|
## Mixer Integration Pattern
|
|
88
139
|
|
|
89
140
|
```javascript
|
|
@@ -915,6 +966,7 @@ The library includes comprehensive test suites:
|
|
|
915
966
|
|
|
916
967
|
Check out the demo files:
|
|
917
968
|
- `demo/part-audio-engine-demo.html` - Interactive browser demo
|
|
969
|
+
- `demo/initialization-progress-demo.html` - Progress tracking demo with timing breakdown
|
|
918
970
|
- `test-player.js` - Command-line player example
|
|
919
971
|
- `examples/midi-player-demo.js` - Basic usage example
|
|
920
972
|
|