Sumin Seo
2007-Dec-21 17:18 UTC
[Speex-dev] Continous decoding of several audio files without destroying speex_decoder
Hi All, We are using speex decoder only for narrow band decoding. Quite often, even though source frame is not silence, decoded audio is silence. I wonder there is a problem in the way we uses speex decoder API. Basically, we initialize speex decoder only once and just reset the decoder before we decoding another file. Do we need to intialize speex decoder and destory decoder for each audio file decoding ? Here is current pseudo code. main() { m_speex = speex_decoder_init(speex_nb_mode); speex_decoder_ctl(m_speex, SPEEX_SET_ENH, &tmp); speex_bits_init(&m_bits); while(end of files) { speex_decoder_ctl(m_speex, SPEEX_RESET_STATE, &tmp); speex_bits_reset(&m_bits); OpenFile(speex audio file); while(end of file) { fread(speex frame); speex_bits_read_from(); speex_decode_int(); fwrite(decoded audio); } CloseFile(speex audio file); } speex_decoder_destroy(); speex_bits_destroy(); } Thanks in advance for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20071221/735ce2cf/attachment.htm
Jean-Marc Valin
2007-Dec-23 21:20 UTC
[Speex-dev] Continous decoding of several audio files without destroying speex_decoder
> We are using speex decoder only for narrow band decoding. > Quite often, even though source frame is not silence, decoded audio is > silence. > I wonder there is a problem in the way we uses speex decoder API. > Basically, we initialize speex decoder only once and just reset the decoder > before we decoding another file. > Do we need to intialize speex decoder and destory decoder for each audio > file decoding ?You can do a reset if you don't want to destroy and re-initialise. Cheers, Jean-Marc> Here is current pseudo code. > main() > { > m_speex = speex_decoder_init(speex_nb_mode); > speex_decoder_ctl(m_speex, SPEEX_SET_ENH, &tmp); > speex_bits_init(&m_bits); > > while(end of files) > { > speex_decoder_ctl(m_speex, SPEEX_RESET_STATE, &tmp); > speex_bits_reset(&m_bits); > > OpenFile(speex audio file); > while(end of file) > { > fread(speex frame); > speex_bits_read_from(); > speex_decode_int(); > fwrite(decoded audio); > } > CloseFile(speex audio file); > } > > speex_decoder_destroy(); > speex_bits_destroy(); > } > > Thanks in advance for your help. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Speex-dev mailing list > Speex-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/speex-dev