Commit 364b18a
fix(audio): correct resampling rate adjustment and eliminate pops
Two bugs were causing resampling-based sync correction to fail:
1. The +8 sample margin in inputSamplesNeeded calculation was exactly
canceling out the ~1% rate reduction. At rate 0.9914 with count=960:
ceil(960 * 0.9914) + 8 = 952 + 8 = 960 = count (no reduction!)
2. Bypassing the resampler when rate ≈ 1.0 caused audible pops when
transitioning in/out of resampling mode due to WDL filter state
discontinuity.
Fixes:
- Remove +8 margin: inputSamplesNeeded = ceil(count * rate)
- Always route through resampler to maintain consistent filter state
- Add logger for debugging rate change subscriptions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent d95d736 commit 364b18a
File tree
2 files changed
+17
-8
lines changed- src/SendspinClient.Services/Audio
2 files changed
+17
-8
lines changedLines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
81 | 83 | | |
82 | 84 | | |
83 | 85 | | |
84 | | - | |
| 86 | + | |
| 87 | + | |
85 | 88 | | |
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
| |||
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
132 | 140 | | |
133 | | - | |
| 141 | + | |
134 | 142 | | |
135 | 143 | | |
136 | 144 | | |
| |||
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| 151 | + | |
143 | 152 | | |
144 | 153 | | |
145 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| |||
0 commit comments