Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/rnnoise.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2017-07-28 21:45:10 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2017-07-28 21:45:10 +0300
commit4353702475b88ccc9655f1ede9f10a37f4f6a320 (patch)
tree25d775a735b8af0aec6b1a6aad6a8976fe18ec9d
parente2daf0b91d46c87eff245ba66c676ac3c08a7d31 (diff)
add pitch features
-rw-r--r--src/denoise.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/denoise.c b/src/denoise.c
index 4d14383..c36551d 100644
--- a/src/denoise.c
+++ b/src/denoise.c
@@ -29,7 +29,7 @@
#define CEPS_MEM 8
#define NB_DELTA_CEPS 6
-#define NB_FEATURES (NB_BANDS+2*NB_DELTA_CEPS+1)
+#define NB_FEATURES (NB_BANDS+3*NB_DELTA_CEPS+2)
static const opus_int16 eband5ms[] = {
/*0 200 400 600 800 1k 1.2 1.4 1.6 2k 2.4 2.8 3.2 4k 4.8 5.6 6.8 8k 9.6 12k 15.6 20k*/
@@ -286,12 +286,15 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float *
forward_transform(P, p);
compute_band_energy(Ep, P);
compute_band_corr(Exp, y, P);
-#if 0
+ for (i=0;i<NB_BANDS;i++) Exp[i] = Exp[i]/sqrt(.001+Ey[i]*Ep[i]);
if (features) {
- for (i=0;i<NB_BANDS;i++) printf("%f ", Exp[i]/sqrt(.001+Ey[i]*Ep[i]));
- printf("\n");
+ float tmp[NB_BANDS];
+ dct(tmp, Exp);
+ for (i=0;i<NB_DELTA_CEPS;i++) features[NB_BANDS+2*NB_DELTA_CEPS+i] = tmp[i];
+ features[NB_BANDS+2*NB_DELTA_CEPS] -= 1.3;
+ features[NB_BANDS+2*NB_DELTA_CEPS+1] -= 0.9;
+ features[NB_BANDS+3*NB_DELTA_CEPS] = .01*(pitch_index-300);
}
-#endif
}
{
if (features != NULL) {
@@ -333,7 +336,7 @@ static void frame_analysis(DenoiseState *st, kiss_fft_cpx *y, float *Ey, float *
}
spec_variability += mindist;
}
- features[NB_BANDS+2*NB_DELTA_CEPS] = spec_variability/CEPS_MEM-2.1;
+ features[NB_BANDS+3*NB_DELTA_CEPS+1] = spec_variability/CEPS_MEM-2.1;
}
}
}
@@ -418,7 +421,7 @@ int main(int argc, char **argv) {
g[i] = sqrt((Ex[i]+1e-15)/(Ey[i]+1e-15));
if (g[i] > 1) g[i] = 1;
}
-#if 0
+#if 1
for (i=0;i<NB_FEATURES;i++) printf("%f ", features[i]);
for (i=0;i<NB_BANDS;i++) printf("%f ", g[i]);
for (i=0;i<NB_BANDS;i++) printf("%f ", Ln[i]);