Re: Wav to Ogg Vorbis conversion

"Dmitriy Reznik" <[email protected]> Thu, 10 Mar 2011 16:31:32 -0500
Newsgroups gmane.comp.multimedia.ogg.vorbis.devel
Message-ID <[email protected]>
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: [email protected] [mailto:[email protected]] 
Sent: Thursday, March 10, 2011 12:15 PM
To: Dmitriy Reznik
Cc: [email protected]
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