audio-mixer-ui 0.7.0 → 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
@@ -128,6 +128,70 @@ await masterAudio.initialize(musicData)
128
128
 
129
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
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:
138
+
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 })
193
+ ```
194
+
131
195
  ## Musical Data Structure
132
196
 
133
197
  The components expect musical timing data in this format: