openaudio-suite 2.5.6 → 2.6.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/CONTRIBUTING.md CHANGED
@@ -1,349 +1,64 @@
1
1
  # Contributing to OpenAudio Suite
2
2
 
3
- Thank you for considering a contribution to the OpenAudio Suite! Contributions—whether bug reports, feature suggestions, or code—are how these projects improve.
3
+ Thank you for considering a contribution! The OpenAudio Suite is a collection of lightweight, dependency-free audio utilities designed for modern web environments.
4
4
 
5
- The OpenAudio Suite consists of three libraries:
6
- - **OpenAudio_r.js** (v2.4.0) — Randomized audio scheduler
7
- - **OpenAudio_s.js** (v1.0.0) — Sequential playlist player
8
- - **OpenAudio.js** (v1.1.0) — Single-clip player with background tab detection
5
+ The suite currently includes:
6
+ - **OpenAudio_r.js (v2.4.1)** — Randomized audio engine with background tab mitigation.
7
+ - **OpenAudio_s.js (v1.1.0)** — Sequential playlist and skip-logic player.
8
+ - **OpenAudio.js (v1.2.0)** — Single-clip player with autoplay policy handling.
9
9
 
10
- ## Code of Conduct
10
+ ## 🤝 Code of Conduct
11
11
 
12
12
  This project adheres to the [Contributor Covenant](https://www.contributor-covenant.org/). By participating, you are expected to uphold this code of conduct.
13
13
 
14
14
  ---
15
15
 
16
- ## Reporting Bugs
16
+ ## 🐛 Reporting Bugs
17
17
 
18
18
  Before submitting a bug report, please:
19
-
20
- 1. **Check existing issues** Your bug may already be reported.
21
- 2. **Check the browser console** Paste any errors.
22
- 3. **Test in a different browser** — Narrow down the scope.
23
- 4. **Read the troubleshooting section** of README.md.
19
+ 1. **Check existing issues** to see if the bug has already been reported.
20
+ 2. **Check the DevTools console** and copy any relevant error messages.
21
+ 3. **Isolate the environment**: Does it happen in all browsers or just one?
24
22
 
25
23
  ### Bug Report Template
26
-
27
- When opening an issue, include:
28
-
29
- ```markdown
30
- **Describe the bug:**
31
- A clear description of what is broken.
32
-
33
- **Steps to reproduce:**
34
- 1. I created an engine with clips: [paste code]
35
- 2. I clicked the play button...
36
- 3. Expected: audio plays
37
- 4. Actual: [what actually happens]
38
-
39
- **Browser & OS:**
40
- - Browser: Chrome 120 / Firefox 121 / Safari 17
41
- - OS: Windows 11 / macOS 14 / iOS 17
42
-
43
- **Console errors:**
44
- (paste any errors from DevTools Console)
45
-
46
- **Minimal code example:**
47
- (paste the smallest code snippet that reproduces the bug)
48
- ```
24
+ When opening an issue, please use the following format:
25
+
26
+ > **Describe the bug**
27
+ > A clear and concise description of what the bug is.
28
+ >
29
+ > **Steps to Reproduce**
30
+ > 1. Initialize engine with `new AudioEngine(...)`
31
+ > 2. Call `engine.start()`
32
+ > 3. Observe [Error/Behavior]
33
+ >
34
+ > **Environment**
35
+ > - Browser: [e.g., Chrome 122, iOS Safari 17.4]
36
+ > - OS: [e.g., macOS Sonoma, Android 14]
37
+ >
38
+ > **Minimal Code Example**
39
+ > ```javascript
40
+ > // Paste minimal reproduction code here
41
+ > ```
49
42
 
50
43
  ---
51
44
 
52
- ## Suggesting Features
53
-
54
- Have an idea? Open an issue with:
55
-
56
- 1. **Clear title** — What is the feature?
57
- 2. **Motivation** — Why would this be useful?
58
- 3. **Proposed API** — How would a user call it?
59
- 4. **Alternatives** — Other approaches considered?
60
-
61
- Example:
62
-
63
- ```markdown
64
- **Feature Request: Crossfade between clips**
65
-
66
- Currently, clips change abruptly. It would sound more polished if clips
67
- faded out/in over 500ms.
45
+ ## Suggesting Features
68
46
 
69
- Proposed API:
70
- engine = new AudioEngine(clips, {
71
- fadeInDuration: 500, // ms
72
- fadeOutDuration: 500 // ms
73
- });
47
+ We welcome feature requests! Please keep in mind that the "OpenAudio" philosophy is to remain **lightweight and standard-compliant**.
74
48
 
75
- This is a common pattern in game audio engines.
76
- ```
49
+ Features like **Crossfading**, **Real-time DSP (Reverb/EQ)**, or **Visualizers** are generally considered out of scope, as they are better handled by the Web Audio API.
77
50
 
78
- **Note:** Feature requests for crossfading, real-time DSP, or sub-second precision
79
- are better suited to the Web Audio API. OpenAudio_r.js is intentionally simple.
51
+ To suggest a feature, please include:
52
+ 1. **Motivation**: Why is this needed?
53
+ 2. **Proposed API**: How should the method or option look?
54
+ 3. **Use Case**: Give a real-world example of how it would be used.
80
55
 
81
56
  ---
82
57
 
83
- ## Submitting Code Changes
58
+ ## 🛠️ Development Workflow
84
59
 
85
60
  ### Setup
86
-
87
- 1. Fork the repository
88
- 2. Clone your fork
89
- ```bash
90
- git clone https://github.com/YOUR-USERNAME/openaudio-r.git
91
- cd openaudio-r
92
- ```
93
- 3. Create a branch
61
+ 1. Fork the repository on GitHub.
62
+ 2. Clone your fork locally:
94
63
  ```bash
95
- git checkout -b fix/autoplay-ios
96
- ```
97
-
98
- ### Make Changes
99
-
100
- - **Edit only `OpenAudio_r.js`** (unless updating docs).
101
- - **Test thoroughly** in multiple browsers and on mobile.
102
- - **Update JSDoc comments** if you change signatures.
103
- - **Add/update examples** if adding features.
104
- - **Update CHANGELOG.md** with your change.
105
-
106
- ### Code Style
107
-
108
- - **Naming:** Use camelCase for variables/methods, PascalCase for classes.
109
- - **Comments:** Comment *why*, not *what*. The code shows what; comments explain why.
110
- - **JSDoc:** Document all public methods with parameter types and return values.
111
- - **Error messages:** Be specific (include clip label, current time, etc.).
112
- - **Callbacks:** Wrap in try/catch (see existing `onPlay`, `onEnd`, `onCycleReset` patterns).
113
-
114
- ### Testing Checklist
115
-
116
- Before opening a PR, test:
117
-
118
- - [ ] **Desktop browsers:** Chrome, Firefox, Safari (all latest versions)
119
- - [ ] **Mobile:** iOS Safari, Chrome Android
120
- - [ ] **First play on page load:** Must be inside a user gesture
121
- - [ ] **Background tab test:** Switch to another tab, wait 10 seconds, switch back—next clip should fire correctly
122
- - [ ] **Multiple clips:** Add 5+ clips and verify shuffle bag (no repeats in a cycle)
123
- - [ ] **volume control:** Verify `setVolume()` updates live playback
124
- - [ ] **destroy():** Ensure listeners are removed (no memory leaks)
125
- - [ ] **Example code:** Test minimal and advanced examples from README
126
-
127
- ### Commit Messages
128
-
129
- Write clear, atomic commits:
130
-
131
- ```bash
132
- git commit -m "Fix: prevent double unlock on rapid start() calls
133
-
134
- - Added #isUnlocking flag to track unlock phase
135
- - Rapid clicks to start() are now ignored until unlock completes
136
- - Solves race condition where multiple #scheduleNext() calls overlap"
137
- ```
138
-
139
- **Guidelines:**
140
- - Start with a type: `fix:`, `feat:`, `docs:`, `refactor:`, `test:`
141
- - Reference any related issue: `Fixes #42`
142
- - Explain *why*, not just *what*
143
-
144
- ### Opening a Pull Request
145
-
146
- 1. **Push to your fork**
147
- ```bash
148
- git push origin fix/autoplay-ios
149
- ```
150
-
151
- 2. **Open PR on GitHub**
152
- - Title: `fix: prevent audio unlock race condition`
153
- - Description: Explain the problem, your solution, and testing steps
154
- - Link any related issues: `Fixes #42`
155
- - Check the "allow edits from maintainers" box
156
-
157
- 3. **PR Template**
158
-
159
- ```markdown
160
- ## Description
161
- Briefly explain the change.
162
-
163
- ## Type
164
- - [ ] Bug fix (non-breaking change fixing an issue)
165
- - [ ] New feature (non-breaking change adding functionality)
166
- - [ ] Breaking change (fix or feature that changes existing API)
167
- - [ ] Documentation update
168
-
169
- ## Related Issue
170
- Fixes #42
171
-
172
- ## Testing
173
- How did you verify this change?
174
- - [ ] Tested in Chrome 120
175
- - [ ] Tested in Firefox 121
176
- - [ ] Tested in Safari 17
177
- - [ ] Tested on iOS
178
- - [ ] Tested on Android
179
-
180
- ## Checklist
181
- - [ ] Code follows project style (camelCase, JSDoc)
182
- - [ ] Comments added for new logic
183
- - [ ] CHANGELOG.md updated
184
- - [ ] README.md updated (if API change)
185
- - [ ] No breaking changes introduced
186
- - [ ] Tests pass in all listed browsers
187
- ```
188
-
189
- ---
190
-
191
- ## Documentation Changes
192
-
193
- ### Updating README.md
194
-
195
- - Use clear, concise language
196
- - Include code examples
197
- - Test all code snippets (they should work as-is)
198
- - Update table of contents if adding new sections
199
-
200
- ### Adding Examples
201
-
202
- 1. Create `/examples/your-example.html`
203
- 2. Include a comment block explaining what it demonstrates
204
- 3. Make it self-contained (no external dependencies)
205
- 4. Link it from README.md
206
-
207
- Example structure:
208
-
209
- ```html
210
- <!DOCTYPE html>
211
- <html>
212
- <head>
213
- <title>OpenAudio_r.js — [Feature] Example</title>
214
- </head>
215
- <body>
216
- <h1>[Feature] Example</h1>
217
- <p>This example demonstrates [feature].</p>
218
-
219
- <button id="play">Play</button>
220
- <button id="stop">Stop</button>
221
- <div id="status"></div>
222
-
223
- <script src="../OpenAudio_r.js"></script>
224
- <script>
225
- // Your example code here
226
- </script>
227
- </body>
228
- </html>
229
- ```
230
-
231
- ---
232
-
233
- ## Review Process
234
-
235
- After you submit a PR:
236
-
237
- 1. **Automated checks** run (linting, tests if any)
238
- 2. **Code review** — I'll review the code and suggest changes if needed
239
- 3. **Discussion** — We'll discuss any questions or concerns
240
- 4. **Approval & merge** — Once approved, your code is merged
241
-
242
- Expect 2–7 days for a response (I review contributions in batches).
243
-
244
- ---
245
-
246
- ## Project Structure
247
-
248
- ```
249
- openaudio-r/
250
- ├── OpenAudio_r.js # Main source file
251
- ├── README.md # Project documentation
252
- ├── CONTRIBUTING.md # This file
253
- ├── CHANGELOG.md # Version history
254
- ├── LICENSE # GPL-3.0-or-later
255
- ├── .gitignore # Git ignore rules
256
- ├── package.json # npm metadata (if publishing)
257
- ├── /examples # HTML demo files
258
- ├── /docs # Extra documentation
259
- └── /test # Test files (if added)
260
- ```
261
-
262
- ---
263
-
264
- ## Development Tips
265
-
266
- ### Testing Autoplay Policy
267
-
268
- Browsers block autoplay unless inside a user gesture. Test this:
269
-
270
- ```javascript
271
- // ✅ This will work
272
- document.addEventListener('click', () => engine.start());
273
-
274
- // ❌ This will fail
275
- setTimeout(() => engine.start(), 1000);
276
- ```
277
-
278
- ### Debugging Background Tab Throttling
279
-
280
- 1. Open DevTools
281
- 2. Go to Console
282
- 3. Type: `engine.#timerSetAt` (to check timer state)
283
- 4. Switch tabs and wait
284
- 5. Return to tab and check if next clip fires on schedule
285
-
286
- ### Memory Leaks
287
-
288
- Always call `destroy()` when tearing down:
289
-
290
- ```javascript
291
- // React
292
- useEffect(() => {
293
- const engine = new AudioEngine(clips);
294
- return () => engine.destroy();
295
- }, []);
296
- ```
297
-
298
- ---
299
-
300
- ## Versioning
301
-
302
- This project uses [Semantic Versioning](https://semver.org/):
303
-
304
- - **MAJOR** (2.0.0) — Breaking API changes
305
- - **MINOR** (2.4.0) — New features, backward-compatible
306
- - **PATCH** (2.4.1) — Bug fixes
307
-
308
- Version numbers appear in:
309
- - `OpenAudio_r.js` header (line 4)
310
- - `CHANGELOG.md`
311
- - `package.json` (if published to npm)
312
-
313
- ---
314
-
315
- ## Deployment & Publishing
316
-
317
- ### Releases
318
-
319
- 1. Update version in `OpenAudio_r.js` header
320
- 2. Update `CHANGELOG.md`
321
- 3. Create a GitHub Release with tag `v2.4.0`
322
- 4. Add release notes summarizing changes
323
-
324
- ### npm Publishing (if applicable)
325
-
326
- ```bash
327
- npm login
328
- npm publish
329
- ```
330
-
331
- This will publish the package to https://www.npmjs.com/package/openaudio-r.
332
-
333
- ---
334
-
335
- ## Questions?
336
-
337
- - 💬 Open a GitHub Discussion
338
- - 📧 Mention me in an issue
339
- - 🐛 Check existing issues first
340
-
341
- ---
342
-
343
- ## Recognition
344
-
345
- Contributors will be listed in CHANGELOG.md and credited in commit messages. Thank you for helping make OpenAudio_r.js better!
346
-
347
- ---
348
-
349
- **Happy coding! 🎵**
64
+ git clone [https://github.com/YOUR-USERNAME/OpenAudio.git](https://github.com/YOUR-USERNAME/OpenAudio.git)