diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-07-13 20:21:46 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2017-07-13 20:21:46 +0300 |
commit | e271268a4c484e04cdc3615b53cb5794c9977d2b (patch) | |
tree | 32fecce84c9a81ca632aa0c637d78f8808ca10d2 | |
parent | d9a92a78f84d6e4f903062f430325b77a72afc03 (diff) |
Think I fixed the look-ahead probs (mostly)
-rw-r--r-- | src/analysis.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/analysis.c b/src/analysis.c index f501826f..9077317e 100644 --- a/src/analysis.c +++ b/src/analysis.c @@ -277,17 +277,19 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int info_out->tonality = MAX32(tonality_avg/tonality_count, tonality_max-.2f); pos = pos0; - /* If we have enough look-ahead, discard the first 5 frames to compensate for the + /* If we have enough look-ahead, discard the first 2 frames to compensate for the delay in the features. */ - if (curr_lookahead > 15) + if (curr_lookahead > 10) { - pos += 5; + pos += 2; if (pos>=DETECT_SIZE) pos -= DETECT_SIZE; } info_out->music_prob = tonal->info[pos].music_prob; - prob_min = prob_max = prob_avg = tonal->info[pos].music_prob; + prob_avg = tonal->info[pos].music_prob; + prob_min = 1; + prob_max = 0; vad_prob = tonal->info[pos].activity_probability; prob_count = MAX16(.1, vad_prob); while (1) @@ -304,6 +306,8 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int prob_min = MIN16(prob_avg - TRANSITION_PENALTY*(vad_prob - pos_vad)/prob_count, prob_min); prob_max = MAX16(prob_avg + TRANSITION_PENALTY*(vad_prob - pos_vad)/prob_count, prob_max); } + prob_min = MIN16(prob_avg, prob_min); + prob_max = MAX16(prob_avg, prob_max); prob_min = MAX16(prob_min, 0); prob_max = MIN16(prob_max, 1); info_out->music_prob_min = prob_min; |