diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2018-11-03 00:25:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2018-11-03 00:32:39 +0300 |
commit | f91a13ba50ea7645b59eea632f6d0ff541800674 (patch) | |
tree | 3e86c8a9df8e1f0beba2192f32daa23361ace680 /src | |
parent | ea08660cc9e28a44a1512a5a56f85e7258d9832d (diff) | |
download | libgha-f91a13ba50ea7645b59eea632f6d0ff541800674.tar.gz |
Add function to extract analysed harmonic from given pcm
Added dtmf analysation example
Diffstat (limited to 'src')
-rw-r--r-- | src/gha.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -202,3 +202,14 @@ void gha_analyze_one(const FLOAT* pcm, struct gha_info* info, gha_ctx* ctx) gha_generate_sine(ctx->tmp_buf, ctx->size, info->freq, info->phase); gha_estimate_magnitude(pcm, ctx->tmp_buf, ctx->size, info); } + +void gha_extract_one(FLOAT* pcm, struct gha_info* info, gha_ctx* ctx) +{ + int i; + FLOAT magnitude; + gha_analyze_one(pcm, info, ctx); + magnitude = info->magnitude; + + for (i = 0; i < ctx->size; i++) + pcm[i] -= ctx->tmp_buf[i] * magnitude; +} |