Target peak amplitude of -6 dBFS in automatic gain selection #370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #238.
Fixes #333.
nrsc5's automatic gain selection currently works by stepping through all possible gain values, and measuring the amount of power present in the frequency ranges occupied by the HD Radio sidebands compared to the amount of power present at frequencies just below and just above the HD Radio sidebands.
This approach has some problems:
I think it would be better to instead measure the peak amplitude of the incoming signal, and target -6 dBFS (i.e. 6 dB below full scale, where clipping would begin). So far this approach seems to work well, and selects more sensible gain values. When no interfering signals are present, the -6 dBFS signal level is more than sufficient to receive an error-free signal, while leaving a decent amount of headroom. (Bit errors only begin occurring when the signal level is below -24 dBFS.)
I'd appreciate feedback from anyone who can take this for a spin to confirm whether it works better than the old approach.