[Vorbis-dev] Wav to Ogg Vorbis conversion

Dmitriy Reznik dreznik at tantor.com
Thu Mar 10 13:31:32 PST 2011


Dear experts,

>>       for(i=0;i<bytes/4;i++){
>>
>>         buffer[0][i]=((readbuffer[i*4+1]<<8)|
>>
>>                       (0x00ff&(int)readbuffer[i*4]))/32768.f;
>>
>>         buffer[1][i]=((readbuffer[i*4+3]<<8)|
>>
>>                       (0x00ff&(int)readbuffer[i*4+2]))/32768.f;
>>
>>       }

>This seems to be converting 16 bit stereo integer samples to float samples.

Could you please explain to me what each part of the code doing, not just general outcome?



>> Maybe you could recommend some tutorial to understand how this works?

>http://www.bluishcoder.co.nz/2009/06/26/decoding-vorbis-files-with-libvorbis.html

This is decoding tutorial. I wonder if there is any encoding tutorial.

Thanks,
Dmitriy

-----Original Message-----
From: ogg.k.ogg.k at googlemail.com [mailto:ogg.k.ogg.k at googlemail.com] 
Sent: Thursday, March 10, 2011 12:15 PM
To: Dmitriy Reznik
Cc: vorbis-dev at xiph.org
Subject: Re: [Vorbis-dev] Wav to Ogg Vorbis conversion


>       for(i=0;i<bytes/4;i++){
>
>         buffer[0][i]=((readbuffer[i*4+1]<<8)|
>
>                       (0x00ff&(int)readbuffer[i*4]))/32768.f;
>
>         buffer[1][i]=((readbuffer[i*4+3]<<8)|
>
>                       (0x00ff&(int)readbuffer[i*4+2]))/32768.f;
>
>       }

This seems to be converting 16 bit stereo integer samples to float samples.


> Maybe you could recommend some tutorial to understand how this works?

http://www.bluishcoder.co.nz/2009/06/26/decoding-vorbis-files-with-libvorbis.html


More information about the Vorbis-dev mailing list