[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freeswitch-dev
Subject:    Re: [Freeswitch-dev] Recompile mod_opus for 8KHz sampling rate
From:       Anthony Minessale <anthony.minessale () gmail ! com>
Date:       2013-08-05 17:06:46
Message-ID: CAKbxfG-5YuNMVFXjw+GVEQW6tf6iQUkx+LUhjkKuKBiVort5eQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


The programing API for opus only uses 48khz signed linear audio.  We add
the codec to the system with that as the native rate and it translates for
us.
I don't know what the cost is really.  Its not really useful to use if you
plan to bridge to the PSTN anyway but it will work fine in FS at probably
some noticeable cpu usage.


On Mon, Aug 5, 2013 at 9:59 AM, Tamas Jalsovszky <jalsot@gmail.com> wrote:

> Is there any info how much  bandwidth is required for 48kHz audio? How CPU
> hungry is downsampling to 8kHz G711?
> According to opus-codec.org, opus can use sampling rates from 8kHz, not
> just 48kHz. In cases when the call ends in PSTN, won't be appropriate to
> support 8kHz sampling rate in FS too?
>
>
> On Thu, Aug 1, 2013 at 9:18 PM, Anthony Minessale <
> anthony.minessale@gmail.com> wrote:
>
>> Opus always uses 48khz
>> On Aug 1, 2013 2:15 PM, "Dimosthenis Arkoudeas" <
>> dimosthenis@arkoudeas.com> wrote:
>>
>>>  Hi all,****
>>>
>>> ** **
>>>
>>> Playing with mod_opus came up with the following.****
>>>
>>> I am trying to recompile the codec with 8Khz and 40ms ptime. I am not
>>> familiar with the codec internals and not really sure what parameters
>>> should I change…****
>>>
>>> ** **
>>>
>>> In mod_opus.c :****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> Line 59:****
>>>
>>> int bitrate_bps = codec->implementation->bits_per_second;****
>>>
>>>                 int use_vbr = 1;****
>>>
>>>                 int complexity = 10;****
>>>
>>>                 int use_inbandfec = 1;****
>>>
>>>                 int use_dtx = 1;****
>>>
>>>                 int bandwidth = OPUS_BANDWIDTH_FULLBAND;****
>>>
>>>                 int err;****
>>>
>>> ** **
>>>
>>> I suppose that the bandwidth must be changed to
>>> OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I haven’t found yet whether the
>>> FEC parameter is passed to opus encoder.****
>>>
>>> ** **
>>>
>>> And in Line 184 , I think the following parameters must be changed****
>>>
>>> ** **
>>>
>>>  switch_codec_interface_t *codec_interface;****
>>>
>>>         int samples = 480;****
>>>
>>>         int bytes = 960;****
>>>
>>>         int mss = 10000;****
>>>
>>>         int x = 0;****
>>>
>>>         int rate = 48000;****
>>>
>>>         int bits = 32000;****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> Can you propose any values about these parameters to achieve 8khz with
>>> 40ms packet time? ****
>>>
>>> ** **
>>>
>>> ** **
>>>
>>> Thanks for any help,****
>>>
>>> ** **
>>>
>>> Dimosthenis****
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting@freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>>> http://www.cudatel.com
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev@lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>>>
>>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting@freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>> http://www.cudatel.com
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev@lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting@freeswitch.org
> http://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
> http://www.cudatel.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev@lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900

[Attachment #5 (text/html)]

<div dir="ltr">The programing API for opus only uses 48khz signed linear audio.  We \
add the codec to the system with that as the native rate and it translates for \
us.<div>I don&#39;t know what the cost is really.  Its not really useful to use if \
you plan to bridge to the PSTN anyway but it will work fine in FS at probably some \
noticeable cpu usage.</div> </div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Mon, Aug 5, 2013 at 9:59 AM, Tamas Jalsovszky <span \
dir="ltr">&lt;<a href="mailto:jalsot@gmail.com" \
target="_blank">jalsot@gmail.com</a>&gt;</span> wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div>Is there any info how much  bandwidth is \
required for 48kHz audio? How CPU hungry is downsampling to 8kHz G711?<br> \
</div>According to <a href="http://opus-codec.org" \
target="_blank">opus-codec.org</a>, opus can use sampling rates from 8kHz, not just \
48kHz. In cases when the call ends in PSTN, won&#39;t be appropriate to support 8kHz \
sampling rate in FS too?<br>

</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div \
class="gmail_quote">On Thu, Aug 1, 2013 at 9:18 PM, Anthony Minessale <span \
dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com" \
target="_blank">anthony.minessale@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><p dir="ltr">Opus always uses 48khz </p> <div \
class="gmail_quote"><div><div>On Aug 1, 2013 2:15 PM, &quot;Dimosthenis  \
Arkoudeas&quot; &lt;<a href="mailto:dimosthenis@arkoudeas.com" \
target="_blank">dimosthenis@arkoudeas.com</a>&gt; wrote:<br type="attribution">

</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div><div>






<div link="#0563C1" vlink="#954F72" lang="EL">
<div>
<p class="MsoNormal"><span lang="EN-US">Hi all,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Playing with mod_opus came up with the \
following.<u></u><u></u></span></p> <p class="MsoNormal"><span lang="EN-US">I am \
trying to recompile the codec with 8Khz and 40ms ptime. I am not familiar with the \
codec internals and not really sure what parameters should I \
change…<u></u><u></u></span></p>



<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">In mod_opus.c :<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Line 59:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;" lang="EN-US">int bitrate_bps = \
codec-&gt;implementation-&gt;bits_per_second;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US">                int use_vbr = 1;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US">                int complexity = 10;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US">                int use_inbandfec = 1;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US">                int use_dtx = 1;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US">                int bandwidth = \
OPUS_BANDWIDTH_FULLBAND;<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US">            \
</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">int \
err;<u></u><u></u></span></p>



<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;"><u></u> <u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US">I suppose \
that the bandwidth must be changed to OPUS_BANDWIDTH_NARROWBAND and use_vbr=0 and I \
haven’t found yet whether the FEC parameter is passed  to opus \
encoder.<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US">And in Line \
184 , I think the following parameters must be changed<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;" \
lang="EN-US"><u></u> <u></u></span></p> <pre><span lang="EN-US"> </span><span><span \
lang="EN-US">switch_codec_interface_t</span></span><span lang="EN-US"> \
*</span><span><span lang="EN-US">codec_interface</span></span><span \
lang="EN-US">;<u></u><u></u></span></pre>



<pre><span lang="EN-US">        <span>int</span> </span><span><span \
lang="EN-US">samples</span></span><span lang="EN-US"> = \
<span>480</span>;<u></u><u></u></span></pre> <pre><span lang="EN-US">        \
<span>int</span> </span><span><span lang="EN-US">bytes</span></span><span \
lang="EN-US"> = <span>960</span>;<u></u><u></u></span></pre> <pre><span lang="EN-US"> \
<span>int</span> </span><span><span lang="EN-US">mss</span></span><span lang="EN-US"> \
= <span>10000</span>;<u></u><u></u></span></pre> <pre><span lang="EN-US">        \
<span>int</span> </span><span><span lang="EN-US">x</span></span><span lang="EN-US"> = \
<span>0</span>;<u></u><u></u></span></pre> <pre><span lang="EN-US">        \
<span>int</span> </span><span><span lang="EN-US">rate</span></span><span \
lang="EN-US"> = <span>48000</span>;<u></u><u></u></span></pre> <pre><span \
lang="EN-US">        <span>int</span> </span><span><span \
lang="EN-US">bits</span></span><span lang="EN-US"> = \
<span>32000</span>;<u></u><u></u></span></pre> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US">Can you \
propose any values about these parameters to achieve 8khz with 40ms packet time? \
<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier New&quot;" lang="EN-US"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for any help,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Dimosthenis<u></u><u></u></span></p>
</div>
</div>

<br></div></div>_________________________________________________________________________<br>
 Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" \
target="_blank">consulting@freeswitch.org</a><br> <a \
href="http://www.freeswitchsolutions.com" \
target="_blank">http://www.freeswitchsolutions.com</a><br> <br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" \
target="_blank">http://wiki.freeswitch.org</a><br> <a href="http://www.cluecon.com" \
target="_blank">http://www.cluecon.com</a><br> <br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" \
target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br> <a \
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br> \
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br> <a \
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> \
<br></blockquote></div> \
<br>_________________________________________________________________________<br> \
Professional FreeSWITCH Consulting Services:<br> <a \
href="mailto:consulting@freeswitch.org" \
target="_blank">consulting@freeswitch.org</a><br> <a \
href="http://www.freeswitchsolutions.com" \
target="_blank">http://www.freeswitchsolutions.com</a><br> <br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" \
target="_blank">http://wiki.freeswitch.org</a><br> <a href="http://www.cluecon.com" \
target="_blank">http://www.cluecon.com</a><br> <br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" \
target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br> <a \
href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br> \
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br> <a \
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> \
<br></blockquote></div><br></div> \
</div></div><br>_________________________________________________________________________<br>
 Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" \
target="_blank">http://www.freeswitchsolutions.com</a><br> <br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" \
target="_blank">http://wiki.freeswitch.org</a><br> <a href="http://www.cluecon.com" \
target="_blank">http://www.cluecon.com</a><br> <br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
 <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br> \
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" \
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br> <a \
href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br> \
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale \
II<br><br>FreeSWITCH <a \
href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a \
                href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: \
anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a \
href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
                
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> \
#freeswitch<br><br>FreeSWITCH Developer Conference<br><a \
href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a \
href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
 pstn:+19193869900
</div>



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-dev mailing list
FreeSWITCH-dev@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic