[Speex-dev] Speex in flash player: how to work with?

Max Lapshin max.lapshin at gmail.com
Tue Mar 30 08:52:42 PDT 2010


On Sat, Mar 20, 2010 at 12:04 AM, Jozsef Vass <jovass at adobe.com> wrote:
> Nicer way:
>
> void* speexState = speex_encoder_init(&speex_wb_mode);
> int speexFrameSize, speexRate;
> speex_encoder_ctl(speexState, SPEEX_GET_FRAME_SIZE, &speexFrameSize);
> speex_encoder_ctl(speexState, SPEEX_GET_SAMPLING_RATE, &speexRate);
> SpeexPreprocessState* speexPreprocessState = speex_preprocess_state_init(speexFrameSize, speexRate);
>

Jozsef, would you kindly help me.

Both, this code:

_microphone = Microphone.getMicrophone();
_microphone.setSilenceLevel(0);
_microphone.codec = SoundCodec.SPEEX;
_microphone.encodeQuality = 10;
_microphone.rate = 16;
_microphone.framesPerPacket = 1;
_microphone.gain = 80;
_microphone.setUseEchoSuppression(false);

and this code:

_microphone = Microphone.getMicrophone();
_microphone.codec = SoundCodec.SPEEX;
_microphone.gain = 80;


generate frames, which are 10 or 52 bytes long. I try to parse them on C:


speex_bits_init(&driver->bits);
driver->decoder = speex_decoder_init(&speex_wb_mode);
speex_decoder_ctl(driver->decoder, SPEEX_GET_FRAME_SIZE, &driver->frame_size);
speex_decoder_ctl(driver->decoder, SPEEX_GET_SAMPLING_RATE,
&driver->sample_rate);
driver->den = speex_preprocess_state_init(driver->frame_size,
driver->sample_rate);

...
spx_int16_t rec[SPX_SIZE];   // -- here I copy incoming packets, which
are 10 or 52 bytes long.
speex_preprocess_run(driver->den, rec);  // Here I get segfault.


It is really not clear for me, how speex understand what size of data
is expected.
Maybe I'm doing something wrong?


More information about the Speex-dev mailing list