Commit c6c8dab
committed
feat(streaming): Add sample rate normalization, tuning support, and improve chord detection
Enhance streaming analyzer with robust audio handling and improved chord accuracy:
Audio preprocessing:
- Add automatic resampling for high sample rates (>44100 Hz) to internal 44100 Hz
- Add normalization gain support for loud/compressed audio via setNormalizationGain()
- Add tuning reference frequency support via setTuningRefHz() for non-standard tuning
Chord detection improvements:
- Replace chroma averaging with median filtering for better noise robustness
- Enhance chord template correlation with third and fifth note emphasis
- Add penalty for notes not present in chord pattern
- Add diatonic chord bonus in voted pattern computation based on detected key
- Add pattern correction using known progressions for confusable chords
Pattern locking:
- Lock chord progression pattern once detected with high confidence
- Use expected duration (if set) to optimize lock timing
- Prevent pattern changes after early-song detection
API additions:
- setExpectedDuration(): Set total duration for optimal pattern lock timing
- setNormalizationGain(): Apply gain for loud audio normalization
- setTuningRefHz(): Correct chroma analysis for non-440Hz tuning
Cleanup:
- Remove package-lock.json from repository1 parent 2ff331d commit c6c8dab
8 files changed
Lines changed: 494 additions & 1368 deletions
File tree
- js
- src
- analysis
- streaming
- wasm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
| |||
1649 | 1652 | | |
1650 | 1653 | | |
1651 | 1654 | | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
1652 | 1687 | | |
1653 | 1688 | | |
1654 | 1689 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
412 | 415 | | |
413 | 416 | | |
414 | 417 | | |
| |||
0 commit comments