[Speex-dev] not hearing the starts of words when encoding

Yusuf X ys1382 at gmail.com
Wed Sep 12 11:41:17 PDT 2007

Hello all. I am able to programmatically decode speex just fine (playing
others' encodings), but my encoding eats the beginning of words. If I encode
a word that gradually increases in volume, like "wonderful", I hear
"nderful", but if I encode something percussive like "beep" I hear almost
all of it. It's as if the modeller does not detect the start of a word. Has
anyone seen this before?

In case you're interested here is the init code:

    int quality = 3;
    int off = 0;

    encoder = speex_encoder_init(&speex_nb_mode);
    speex_encoder_ctl( encoder, SPEEX_GET_SAMPLING_RATE, &sampleRate );
    speex_encoder_ctl( encoder, SPEEX_GET_FRAME_SIZE, &frameSize);

    preprocess = speex_preprocess_state_init( frameSize, sampleRate );
    speex_preprocess_ctl( preprocess, SPEEX_SET_QUALITY, (void*)&quality);

    speexRecordData = (char*)malloc(frameSize*sizeof(char)*CHANNELS); // 2
channels, input and output

and the encoding code:

    speex_bits_reset( &encoderBits );
    if ( speex_preprocess( preprocess, (short*)recording.data(), 0 ) &&
         speex_encode_int( encoder, (short*)recording.data(), &encoderBits )
)    // encode to speex
        int numBytes = speex_bits_write( &encoderBits, speexRecordData,
frameSize );

Thanks in advance for your insight.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/speex-dev/attachments/20070912/08b7deb5/attachment.html

More information about the Speex-dev mailing list