mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
bug is 100% related to bs412
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
#define LOG2_19000 log2f(19000.0f)
|
||||
|
||||
inline float dbr_to_deviation(float dbr) {
|
||||
return 19000.0f * powf(10.0f, dbr / 20.0f);
|
||||
return 19000.0f * powf(2.0f, dbr * 0.332193f);
|
||||
}
|
||||
|
||||
inline float deviation_to_dbr(float deviation) {
|
||||
if(deviation == 0.0f) return -100.0f;
|
||||
return 20.0f * (log2f(deviation) - LOG2_19000) * 0.30103f;
|
||||
return 10.0f * (log2f(deviation) - LOG2_19000) * 0.30103f;
|
||||
}
|
||||
|
||||
void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
|
||||
|
||||
@@ -578,13 +578,6 @@ int main(int argc, char **argv) {
|
||||
float target_gain = dbr_to_deviation(-excess_power)/mpx_deviation;
|
||||
bs412_audio_gain = 0.9f * bs412_audio_gain + 0.1f * target_gain;
|
||||
audio *= bs412_audio_gain;
|
||||
} else if (peak_mpower > (mpx_power + 0.1f)) {
|
||||
float excess_power = peak_mpower - mpx_power - 0.1f;
|
||||
excess_power = deviation_to_dbr(dbr_to_deviation(excess_power) - dbr_to_deviation(peak_mpx_only));
|
||||
|
||||
float target_gain = dbr_to_deviation(-excess_power)/mpx_deviation;
|
||||
bs412_audio_gain = 0.8f * bs412_audio_gain + 0.2f * target_gain;
|
||||
audio *= bs412_audio_gain;
|
||||
}
|
||||
|
||||
iirfilt_rrrf_execute(mpx_lpf, audio, &audio); // Should have no effect, as audio should be 0-15, and 23-53, this is a filter for 53, assuming the filter is good, this is precaution and recomendation
|
||||
|
||||
Reference in New Issue
Block a user