audio-mixer-ui 0.5.3 → 0.8.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 CHANGED
@@ -1,17 +1,14 @@
1
1
  # Audio Mixer UI Components
2
2
 
3
- A Vue 3 component library for building audio mixer interfaces with musical navigation and control features.
4
- Originally developed for a choir practice application, these components provide audio controls with responsive design and accessibility features.
3
+ Vue 3 component library for building audio mixer interfaces with musical navigation and control features.
5
4
 
6
5
  ## Features
7
6
 
8
- - **Audio Controls**: Custom sliders, buttons, and level meters with haptic feedback
9
- - **Musical Navigation**: Bar/beat input, practice marks, tempo controls with bidirectional time mapping
10
- - **Responsive Design**: Optimized layouts for mobile, tablet, and desktop
11
- - **Event-Driven Architecture**: Clean separation between UI and audio engine
12
- - **Accessibility Ready**: ARIA labels, keyboard navigation, screen reader support
13
- - **Lightweight**: No heavy UI framework dependencies, just Vue 3
14
- - **TypeScript Ready**: Full TypeScript definitions included
7
+ - Audio controls with level meters and haptic feedback
8
+ - Musical navigation (bar/beat input, practice marks, tempo controls)
9
+ - Responsive design for mobile, tablet, and desktop
10
+ - Event-driven architecture with separate UI and audio layers
11
+ - ARIA labels, keyboard navigation, and screen reader support
15
12
 
16
13
  ## Installation
17
14
 
@@ -80,61 +77,119 @@ app.mount('#app')
80
77
 
81
78
  ## Core Components
82
79
 
83
- The library exports components that automatically integrate with Pinia stores:
80
+ Components automatically integrate with Pinia stores:
84
81
 
85
- ### Layout Components
86
- - **`MixerLayout`** - Responsive container that auto-renders parts from store data
87
- - **`MixerControls`** - Transport controls connected to audio state
88
-
89
- ### Audio Controls
90
- - **`AudioSlider`** - Professional fader with live level indicators
91
- - **`AudioButton`** - Button with visual/haptic feedback
92
- - **`PartControl`** - Complete part mixer (auto-generated from store)
93
- - **`TriState`** - Mute/Solo toggle
94
-
95
- ### Musical Navigation
96
- - **`BarInput`** - Bar navigation with practice mark integration
97
- - **`TimeInput`** - Time display synced to playback position
82
+ - **`MixerLayout`** - Responsive container that renders parts from store data
83
+ - **`MixerControls`** - Transport controls (play, stop, pause)
84
+ - **`AudioSlider`** - Fader with live level indicators
85
+ - **`PartControl`** - Individual part mixer (volume, mute, solo)
86
+ - **`BarInput`** - Bar navigation with practice marks
87
+ - **`TimeInput`** - Time display synced to playback
98
88
  - **`SpeedInput`** - Playback speed control
99
89
 
100
- ### Utilities
101
- - **`BaseNumericInput`** - Foundation for numeric inputs
102
- - **`TitleText`** - Responsive text display
103
-
104
90
  ## State Management
105
91
 
106
- Components automatically connect to Pinia stores for reactive state management. The library exports three main stores:
92
+ Components connect to Pinia stores automatically:
107
93
 
108
94
  ```js
109
95
  import {
110
- useAudioStateStore, // Current playback state (time, volume, playing)
96
+ useAudioStateStore, // Playback state (time, volume, playing)
111
97
  useMusicDataStore, // Musical structure (beats, parts, marks)
112
98
  usePlaybackStateStore, // Transport settings (loop, metronome)
113
- useMasterAudioControl // Master composable for audio control
99
+ useMasterAudioControl // Master composable for control
114
100
  } from 'audio-mixer-ui'
115
101
 
116
- // Components automatically connect to stores - no manual wiring needed
117
- const audioState = useAudioStateStore()
118
- const musicData = useMusicDataStore()
119
102
  const masterAudio = useMasterAudioControl()
120
103
 
121
- // Initialize with your musical data
104
+ // Initialize with musical data
122
105
  masterAudio.initialize(musicData)
106
+
107
+ // Control playback
108
+ masterAudio.play()
109
+ masterAudio.stop()
110
+ masterAudio.setBar(5, 1)
111
+ masterAudio.setPartVolume('Soprano', 0.8)
123
112
  ```
124
113
 
125
- ## Integration Pattern
114
+ ## Audio Engine Configuration
126
115
 
127
- Components handle user interactions via the master audio composable:
116
+ Choose between SpessaSynth (soundfont-based, 10-50MB) or Lightweight (sample-based, ~4MB):
128
117
 
129
118
  ```js
130
- // Inside components, actions are coordinated through the master composable
119
+ import { audioEngineConfig } from 'audio-mixer-ui'
120
+
121
+ // Use LightweightAudioEngine (default is SpessaSynth)
122
+ audioEngineConfig.setEngineType('lightweight')
123
+
124
+ // Then initialize as normal
131
125
  const masterAudio = useMasterAudioControl()
126
+ await masterAudio.initialize(musicData)
127
+ ```
128
+
129
+ **Note:** Engine type must be set before initialization. See [audio-mixer-engine](https://www.npmjs.com/package/audio-mixer-engine) for setup details.
130
+
131
+ ## Soundfont Configuration
132
+
133
+ **Important:** The audio mixer requires a General MIDI soundfont for synthesis. The library does **NOT** bundle a soundfont to keep the npm package lightweight (~1MB instead of ~26MB).
134
+
135
+ ### Option 1: Host Soundfont in Your Public Folder (Default)
136
+
137
+ Place a soundfont file in your app's public folder:
132
138
 
133
- // User interactions trigger master audio methods
134
- masterAudio.play()
135
- masterAudio.stop()
136
- masterAudio.setBar(5, 1) // bar 5, repeat 1
137
- masterAudio.setPartVolume('Soprano', 0.8)
139
+ ```
140
+ your-app/
141
+ public/
142
+ FluidR3Mono_GM.sf3 Place soundfont here
143
+ src/
144
+ ...
145
+ ```
146
+
147
+ The library will automatically look for `/FluidR3Mono_GM.sf3` by default. No configuration needed!
148
+
149
+ ### Option 2: Use a CDN or Custom URL
150
+
151
+ Configure a custom soundfont URL when initializing:
152
+
153
+ ```js
154
+ const masterAudio = useMasterAudioControl({
155
+ soundfontUrl: 'https://your-cdn.com/soundfonts/FluidR3Mono_GM.sf3'
156
+ })
157
+
158
+ // Then initialize as normal
159
+ await masterAudio.initialize(musicData)
160
+ ```
161
+
162
+ ### Recommended Soundfonts
163
+
164
+ - **FluidR3Mono_GM.sf3** (23MB) - High quality, mono, General MIDI
165
+ - MIT licensed
166
+ - Download: Search for "FluidR3Mono_GM" or check FluidSynth documentation
167
+
168
+ - **FluidR3_GM.sf2** (142MB) - Stereo version with more detail
169
+ - Larger file size, higher quality
170
+
171
+ ### Demo Soundfont
172
+
173
+ The live demo at GitLab Pages includes a bundled soundfont for convenience. Your production app should host its own soundfont file.
174
+
175
+ ### Fallback Behavior
176
+
177
+ If the custom soundfont URL fails to load, the library will try these default paths in order:
178
+ 1. `/FluidR3Mono_GM.sf3`
179
+ 2. `/FluidR3_GM.sf2`
180
+ 3. `/soundfont.sf2`
181
+
182
+ If none are found, initialization will fail with an error.
183
+
184
+ ### Example: Environment-Based Configuration
185
+
186
+ ```js
187
+ // Use CDN in production, local in development
188
+ const soundfontUrl = import.meta.env.PROD
189
+ ? 'https://cdn.example.com/FluidR3Mono_GM.sf3'
190
+ : '/FluidR3Mono_GM.sf3'
191
+
192
+ const masterAudio = useMasterAudioControl({ soundfontUrl })
138
193
  ```
139
194
 
140
195
  ## Musical Data Structure
@@ -188,38 +243,21 @@ npm run lint
188
243
 
189
244
  ## Architecture
190
245
 
191
- The library follows an event-driven layered architecture:
246
+ Event-driven layered architecture:
192
247
 
193
- 1. **Components** - Vue 3 components with composition API
194
- 2. **Composables** - Reusable logic for audio control and state management
195
- 3. **Stores** - Pinia stores for reactive state
196
- 4. **Services** - Audio engine integration layer
248
+ 1. **Components** - Vue 3 with Composition API
249
+ 2. **Composables** - Shared logic for audio control and state
250
+ 3. **Stores** - Pinia for reactive state management
251
+ 4. **Services** - Audio engine integration
197
252
 
198
- ### Key Design Principles
253
+ Key principles: Audio thread isolation, event-driven coordination, runtime part discovery.
199
254
 
200
- - **Audio Thread Isolation**: Audio processing separated from reactive UI state
201
- - **Event-Driven Coordination**: Real-time synchronization via event bus
202
- - **Dynamic Configuration**: Runtime discovery of parts and musical structure
203
- - **Responsive First**: Mobile-first design with progressive enhancement
255
+ ## Requirements
204
256
 
205
- ## Browser Support
206
-
207
- - Modern browsers with ES2020+ support
208
- - Vue 3.4+ and Pinia for state management
209
- - Web Audio API for audio features
210
-
211
- ## Contributing
212
-
213
- 1. Fork the repository
214
- 2. Create a feature branch
215
- 3. Add tests for new functionality
216
- 4. Ensure all tests pass
217
- 5. Submit a pull request
257
+ - Vue 3.4+
258
+ - Pinia
259
+ - Modern browser with Web Audio API support
218
260
 
219
261
  ## License
220
262
 
221
- MIT License - see [LICENSE](./LICENSE) file for details.
222
-
223
- ## Related Projects
224
-
225
- This component library was extracted from a larger choir practice application.
263
+ MIT License - see [LICENSE](./LICENSE) file for details.