On Wed, 2007-07-18 at 14:55 -0700, Craig Hoedebeck wrote:
> I am relatively new to audio programming, but I have a task that
> requires converting between various audio formats:
>
> unsigned 16 bit linear to signed 16 bit linear
> u_law to signed 16 bit linear
> a_law to signed 16 bit linear
> unsigned 8 bit linear to signed 16 bit
> signed 8 bit linear to signed 16 bit
>
> Anyone know what the conversion functions for these would look like?
> Or even what a good reference is where I can find these? I have been
> googling around for about an hour and I have come up empty.
For a_law an u_law you could try wikipedia, which will also give you a
nice link for further reading and implementation here:
http://hazelware.luggle.com/tutorials/mulawcompression.html
The linear conversions should be trivial, something like:
// unsigned 16 bit linear to signed 16 bit linear:
short s_16 = u_16 - 32758
// signed 8 bit linear to signed 16 bit
short s_16 = s_char << 8
// unsigned 8 bit linear to signed 16 bit
short s_16 = (u_char - 128) << 8
Mind you, i haven't had my coffee yet ...
>
>
>
> ______________________________________________________________________
> Luggage? GPS? Comic books?
> Check out fitting gifts for grads at Yahoo! Search.
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@email-addr-hidden
> http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
-- _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@email-addr-hidden http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-devReceived on Thu Jul 19 12:15:04 2007
This archive was generated by hypermail 2.1.8 : Thu Jul 19 2007 - 12:15:04 EEST