diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2023-08-04 21:34:09 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-08-04 21:34:09 +0300 |
commit | 022f2b7ebc603a02a1bba75a64a5cf25d4dab420 (patch) | |
tree | 77c3f40fc7201cc15262352b07c6b26c79ccac7e | |
parent | f7ee7137425729b4759d868b64ca3d18f2ab0f95 (diff) |
int version for convenience
-rw-r--r-- | dnn/fwgan.c | 8 | ||||
-rw-r--r-- | dnn/fwgan.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/dnn/fwgan.c b/dnn/fwgan.c index cd64d821..b349fe20 100644 --- a/dnn/fwgan.c +++ b/dnn/fwgan.c @@ -301,3 +301,11 @@ void fwgan_synthesize(FWGANState *st, float *pcm, const float *features) OPUS_COPY(&pcm[FWGAN_FRAME_SIZE-SUBFRAME_SIZE], new_pcm, SUBFRAME_SIZE); OPUS_COPY(st->pcm_buf, &new_pcm[SUBFRAME_SIZE], FWGAN_FRAME_SIZE-SUBFRAME_SIZE); } + +void fwgan_synthesize_int(FWGANState *st, opus_int16 *pcm, const float *features) +{ + int i; + float fpcm[FWGAN_FRAME_SIZE]; + fwgan_synthesize(st, fpcm, features); + for (i=0;i<LPCNET_FRAME_SIZE;i++) pcm[i] = (int)floor(.5 + MIN32(32767, MAX32(-32767, 32768.f*fpcm[i]))); +} diff --git a/dnn/fwgan.h b/dnn/fwgan.h index 4f33ddbe..b7fe28c0 100644 --- a/dnn/fwgan.h +++ b/dnn/fwgan.h @@ -76,6 +76,7 @@ void fwgan_init(FWGANState *st); void fwgan_cont(FWGANState *st, const float *pcm0, const float *features0); void fwgan_synthesize(FWGANState *st, float *pcm, const float *features); +void fwgan_synthesize_int(FWGANState *st, opus_int16 *pcm, const float *features); #endif /* FWGAN_H */ |