<div dir="ltr">Some more question, <div>>(0-11) bytes(12) - Header removed</div><div>>13 byte(1) - TOC byte removed ( and it tells me that only 1 frame, mono),</div><div>>rest of bytes are payload, (20 msec frame, i.e. 960 sample), I just want to know, this payload by encoder is type of uint8, uint16, float??</div><div> i.e. how could I decide the type of these 960 samples from the payload, so I can unpack this payload? </div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Regards,<br>Rizwan Ishaq<br>PH:00<font face="'Times New Roman', serif">34-632 711 767</font></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Jun 17, 2016 at 1:54 PM, Ralph Giles <span dir="ltr"><<a href="mailto:giles@thaumas.net" target="_blank">giles@thaumas.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2016-06-17 10:50 AM, Rizwan Ishaq wrote:<br>
<br>
> 1) does 960 means number of samples in the (20msec frame)? (fs=48KHz)<br>
<br>
</span>That's correct.<br>
<span class=""><br>
> 2) The raw opus packet (i.e OPUS payload), how can I convert it to an<br>
> playable format?<br>
<br>
</span>You can pass the payload section of the RTP packets directly to an opus<br>
decoder to convert to PCM float or integer samples.<br>
<br>
To save it in a file other audio players can handle, you need to<br>
re-encapsulate the data in a media container. Such files use the '.opus'<br>
filename extension. There's some rough example code for this in the<br>
opus-tools package. See for example<br>
<a href="https://git.xiph.org/?p=opus-tools.git;f=src/opusrtp.c;hb=HEAD#l103" rel="noreferrer" target="_blank">https://git.xiph.org/?p=opus-tools.git;f=src/opusrtp.c;hb=HEAD#l103</a><br>
<br>
This disk and stream format is specified in<br>
<a href="https://tools.ietf.org/html/rfc7845.html" rel="noreferrer" target="_blank">https://tools.ietf.org/html/rfc7845.html</a><br>
<span class=""><br>
<br>
> 3) is there any information OPUS payload has(except TOC(first byte))???<br>
<br>
</span>The first several bytes define how the audio is split into frames, the<br>
duration, audio bandwidth, and the coding mode. This is described in<br>
<a href="https://tools.ietf.org/html/rfc6716#section-3.1" rel="noreferrer" target="_blank">https://tools.ietf.org/html/rfc6716#section-3.1</a><br>
<span class=""><br>
> 4) I have RAW opus packets now, I want to convert it to representable<br>
> files, integer, float any method?? or any help (decoder)??<br>
<br>
</span>You need to call `opus_decoder_create` to set up a decoder instance, and<br>
then pass each successive payload buffer to `opus_decode` or<br>
`opus_decode_float`.<br>
<br>
Hope that helps,<br>
-r<br>
<br>
</blockquote></div><br></div>