[Freeswitch-users] Conference and Speex Wideband audio quality problem

Richard Alam ritzalam at gmail.com
Fri Jul 30 14:47:59 PDT 2010


OK...figured out what the problem.

Flash Player by default sends 2 frames per packet with 20ms of audio
(320 samples) per frame. FS expects only a frame every packet.
So setting mic.framesPerPacket = 1; in the flash client worked.

Here's the complete Actionscript setting in case somebody in the
future wants to work with Flash.

		private function setupMicrophone():void {
			mic.setUseEchoSuppression(true);
			mic.setLoopBack(false);
			mic.setSilenceLevel(0,20000);
			mic.codec = SoundCodec.SPEEX;
			mic.gain = 60;
			mic.framesPerPacket = 1;
			mic.rate = 16; // use 8 for Nelly
			LogUtil.debug("codec=SPEEX,gain=60,encodeQuality=10,framesPerPacket=2,rate=16");
		}

Richard

On Fri, Jul 30, 2010 at 5:11 PM, Richard Alam <ritzalam at gmail.com> wrote:
> Hi Everyone,
>
> Hopefully, the answer to my problem isn't in the book as I've yet to
> order it. :)
>
> First off, I'm one ot the devs of BigBlueButton
> (http://code.google.com/p/bigbluebutton/). We currently use Asterisk
> for voice conference.
>
> Leif Jackson made BBB work with FreeSWITCH. Now, from BBB, a user can
> join a voice conference in FS. We have a java SIP client (based on
> Red5Phone) that calls FS.
>
> All is working well for Ulaw.
>
> I am now trying to make Speex WB work since Flash Player (where our
> client runs) supports Speex WB. Using Speex WB frees the java SIP
> client from  transcoding between Nellymoser and Ulaw. The java SIP
> client just takes the speex audio data from RTMP and sends it to FS
> through RTP.
>
> However, the sound quality is bad. It is choopy and robotic.
>
> Let me describe what I have done and what I found from debugging so far.
>
> I modified vars.xml to add the speex codec.
> ================
>  <X-PRE-PROCESS cmd="set"
> data="global_codec_prefs=speex at 16000h@20i,speex at 8000h@20i,G7221 at 32000h,G7221 at 16000h,G722,PCMU,PCMA,GSM"/>
>  <X-PRE-PROCESS cmd="set"
> data="outbound_codec_prefs=speex at 16000h@20i,PCMU,PCMA,GSM"/>
>
>
> Setup the conference in dialplan/public.xml
> ==================
>    <extension name="bbb_conferences">
>      <condition field="destination_number" expression="^(7\d{4})$">
>          <action application="answer"/>
>          <action application="conference" data="$1 at wideband"/>
>      </condition>
>    </extension>
>
> When I start up freeswitch, it looks like it's loading the speex codec
> fine. Full console log is here http://pastebin.com/rnHfgQYj
> ===============
> 2010-07-30 16:04:10.620375 [NOTICE] switch_loadable_module.c:251
> Adding Application 'AvoidingDeadlock'
> 2010-07-30 16:04:10.620658 [CRIT] switch_loadable_module.c:926 Error
> Loading module /opt/freeswitch/mod/mod_g723_1.so
> **/opt/freeswitch/mod/mod_g723_1.so: cannot open shared object file:
> No such file or directory**
> 2010-07-30 16:04:10.620726 [CRIT] switch_loadable_module.c:926 Error
> Loading module /opt/freeswitch/mod/mod_g729.so
> **/opt/freeswitch/mod/mod_g729.so: cannot open shared object file: No
> such file or directory**
> 2010-07-30 16:04:10.621189 [CRIT] switch_loadable_module.c:926 Error
> Loading module /opt/freeswitch/mod/mod_amr.so
> **/opt/freeswitch/mod/mod_amr.so: cannot open shared object file: No
> such file or directory**
> 2010-07-30 16:04:10.621547 [CONSOLE] switch_loadable_module.c:944
> Successfully Loaded [mod_ilbc]
> 2010-07-30 16:04:10.621618 [NOTICE] switch_loadable_module.c:185
> Adding Codec 'iLBC' (iLBC) 8000hz 30ms
> 2010-07-30 16:04:10.621647 [NOTICE] switch_loadable_module.c:185
> Adding Codec 'iLBC' (iLBC) 8000hz 20ms
> 2010-07-30 16:04:10.622043 [CONSOLE] switch_loadable_module.c:944
> Successfully Loaded [mod_speex]
> 2010-07-30 16:04:10.622108 [NOTICE] switch_loadable_module.c:185
> Adding Codec 'SPEEX' (Speex) 32000hz 20ms
> 2010-07-30 16:04:10.622135 [NOTICE] switch_loadable_module.c:185
> Adding Codec 'SPEEX' (Speex) 16000hz 20ms
> 2010-07-30 16:04:10.622160 [NOTICE] switch_loadable_module.c:185
> Adding Codec 'SPEEX' (Speex) 8000hz 20ms
> 2010-07-30 16:04:10.622513 [CONSOLE] switch_loadable_module.c:944
> Successfully Loaded [mod_h26x]
>
> When I call into the conference, it looks like mod_conference does not
> use speex codec but L16 at 16000hz.
> ======
> 2010-07-30 16:05:56.874138 [DEBUG] sofia.c:4317 Channel
> sofia/external/75115 at 192.168.0.166 entering state [completed][200]
> 2010-07-30 16:05:56.874138 [DEBUG] switch_core_session.c:647 Send
> signal sofia/external/75115 at 192.168.0.166 [BREAK]
> 2010-07-30 16:05:56.874138 [DEBUG] switch_channel.c:2494
> (sofia/external/75115 at 192.168.0.166) Callstate Change RINGING ->
> ACTIVE
> 2010-07-30 16:05:56.874138 [NOTICE] mod_dptools.c:746 Channel
> [sofia/external/75115 at 192.168.0.166] has been answered
> EXECUTE sofia/external/75115 at 192.168.0.166 conference(75115 at wideband)
> 2010-07-30 16:05:56.875481 [DEBUG] mod_conference.c:5237 Raw Codec
> Activation Success L16 at 16000hz 1 channel 20ms
> 2010-07-30 16:05:56.875481 [DEBUG] mod_conference.c:5282 Raw Codec
> Activation Success L16 at 16000hz 1 channel 20ms
> 2010-07-30 16:05:56.877940 [DEBUG] switch_core_codec.c:116
> sofia/external/75115 at 192.168.0.166 Push codec L16:10
> tport_wakeup_pri(0x95bfd98): events IN
>
>
> Is this the correct behavior? I've tried using xlite to connect to the
> conference, and the audio is good. Also, when connecting from our
> client,
> the audio file that gets played by FS to notify how many users are in
> the conference is good. It's my voice that's bad.
>
> I tried to use the echo application instead of the conference. When I
> call from the BBB client, the sound quality is good.
>
> I appreciate any tips on how I can fix the problem or proceed to
> figure out how to fix it.
>
>
> Thank you very much.
>
> Richard
>
> --
> ---
> BigBlueButton
> http://www.bigbluebutton.org
> http://code.google.com/p/bigbluebutton
>



-- 
---
BigBlueButton
http://www.bigbluebutton.org
http://code.google.com/p/bigbluebutton



More information about the FreeSWITCH-users mailing list