Commit 5d6f5ba
Enforce -1 dBTP ceiling during LUFS normalization
- Add findTruePeak() function to measure peak level of audio buffer
- Limit normalization gain to prevent peaks from exceeding -1 dBTP
- If target LUFS would cause clipping, reduce gain to hit ceiling instead
- Log when gain is limited and resulting LUFS level
- Apply to both Electron and web versions
This prevents audio from clipping when normalizing to loud targets
like -6 or -9 LUFS on already-loud source material.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 4a7550c commit 5d6f5ba
2 files changed
Lines changed: 86 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
171 | 192 | | |
172 | 193 | | |
| 194 | + | |
173 | 195 | | |
174 | 196 | | |
175 | | - | |
| 197 | + | |
176 | 198 | | |
177 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
178 | 203 | | |
179 | 204 | | |
180 | 205 | | |
181 | 206 | | |
182 | 207 | | |
183 | 208 | | |
184 | | - | |
185 | | - | |
186 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
187 | 225 | | |
188 | 226 | | |
189 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
172 | 193 | | |
173 | 194 | | |
| 195 | + | |
174 | 196 | | |
175 | 197 | | |
176 | | - | |
| 198 | + | |
177 | 199 | | |
178 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
179 | 204 | | |
180 | 205 | | |
181 | 206 | | |
182 | 207 | | |
183 | 208 | | |
184 | 209 | | |
185 | | - | |
186 | | - | |
187 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
188 | 226 | | |
189 | 227 | | |
190 | 228 | | |
| |||
0 commit comments