First of all, Flash Player can only publish Speex at 16 kHz. 20 ms of audio (320 samples) will result in compressed payload size of 106 bytes (42.4 kbps). When Flash Player sends a TC message, there is 11 bytes TC message header and a single byte of audio message header. For more information, please see ActionScript 3 reference http://help.adobe.com/en_US/AS3LCR/Flash_10.0/ Jozsef ---------------------------------------------------------------------- Message: 1 Date: Wed, 17 Mar 2010 11:39:18 +0300 From: Max Lapshin <max.lapshin at gmail.com> Subject: [Speex-dev] Speex in flash player: how to work with? To: speex-dev at xiph.org Message-ID: <e2a8f3fc1003170139y3638462cu329fb4df3c5e91ed at mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Hi everyone. I want to work with Speex audio, that sends Flash player, but I don't understand how. These are settings in flash: _microphone.setSilenceLevel(0); _microphone.codec = SoundCodec.SPEEX; _microphone.encodeQuality = 10; _microphone.rate = 8; _microphone.framesPerPacket = 1; _microphone.gain = 70; _microphone.setUseEchoSuppression(false); With this settings I get frames exactly 106 bytes. speexdec.c has a hardcoded constant of 160 shorts. How must I initialize speex_decoder to work with flash audio stream? I've seen that someone here in list succeded with it.
On Fri, Mar 19, 2010 at 3:27 AM, Jozsef Vass <jovass at adobe.com> wrote:> First of all, Flash Player can only publish Speex at 16 kHz. 20 ms of audio (320 samples) will result in compressed payload size of 106 bytes (42.4 kbps). When Flash Player sends a TC message, there is 11 bytes TC message header and a single byte of audio message header.So what sample size should I set to work with 106 bytes packets? driver->den = speex_preprocess_state_init(320, 16); ?? so?
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 -----Original Message----- From: Max Lapshin [mailto:max.lapshin at gmail.com] Sent: Thursday, March 18, 2010 10:57 PM To: Jozsef Vass Cc: speex-dev at xiph.org Subject: Re: [Speex-dev] Speex in flash player: how to work with? On Fri, Mar 19, 2010 at 3:27 AM, Jozsef Vass <jovass at adobe.com> wrote:> First of all, Flash Player can only publish Speex at 16 kHz. 20 ms of audio (320 samples) will result in compressed payload size of 106 bytes (42.4 kbps). When Flash Player sends a TC message, there is 11 bytes TC message header and a single byte of audio message header.So what sample size should I set to work with 106 bytes packets? driver->den = speex_preprocess_state_init(320, 16); ?- so?