The microphone peak level can go far above its documented 0...1 range
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- swift
- Domain
- audio-video-rtc
Research direction
Read CONTRIBUTING.md, then inspect Sources/UttrflowAudio/SampleAccumulator.swift:37-55 and :99-116 to trace peakLevel and momentaryLevel handling. Extend Tests/UttrflowAudioTests/SampleAccumulatorTests.swift with out-of-range, NaN, and infinite inputs, preserving the existing non-finite-sample test. Run make verify with the specified DEVELOPER_DIR; done means both levels remain in 0...1 and all tests pass.
Written by the indexing model from the issue text.
Description
What happens
SampleAccumulator.append (Sources/UttrflowAudio/SampleAccumulator.swift:43-47) skips NaN and infinite samples, but keeps any finite magnitude as the new peak. peakLevel is documented at line 99 as being in 0...1, yet a block containing Float.greatestFiniteMagnitude (about 3.4e38), or any sample above 1, sets the peak to that value. The momentary level is already protected against the same input by the isFinite check on the RMS at line 52.
Why it matters
The peak is what says afterwards whether the microphone was muted or clipping. A driver glitch or a converter bug that delivers an out-of-range sample leaves a nonsense peak that anything comparing against 1 will misread.
How to check
In Tests/UttrflowAudioTests/SampleAccumulatorTests.swift, append [Float.greatestFiniteMagnitude, 0.3] and read peakLevel: it is about 3.4e38, not a value in 0...1.
Acceptance criteria
peakLevelis always in0...1, for any input, including values just above 1, huge finite values, NaN and infinities.momentaryLevelstays in0...1for the same inputs (add an expectation if one is missing).- The existing tests, including "ignores a non-finite sample instead of pinning the meter", still pass.
Where to start
Sources/UttrflowAudio/SampleAccumulator.swift:37-55and:99-116- Tests to extend:
Tests/UttrflowAudioTests/SampleAccumulatorTests.swift. - Before pushing, run
make verify(export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer first). It is the same command CI runs, and it enforces the 95% coverage floor per module. - Read CONTRIBUTING.md first, and say on this issue that you are taking it.
Size: S, about 1-2 hours.
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 18h 15m
- Merged PRs (30d)
- 442
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uttrflow/uttrflow-swift
-
Docs/performance.md says the clipboard panel waits for catchUp; toggleQuickPanel no longer waits Openarea:docs documentation good first issue P2
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
uttrflow/uttrflow-swift#1032 ·
-
area:docs documentation good first issue P2
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
uttrflow/uttrflow-swift#1023 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
uttrflow/uttrflow-swift#827 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
uttrflow/uttrflow-swift#802 ·
-
area:general enhancement good first issue P2
Difficulty 2/5 Under an hour Newbie friendliness 92/100
uttrflow/uttrflow-swift#755 ·
All issues in uttrflow/uttrflow-swift
Similar issues
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·