I got stuck on an issue on my objective C app.
I am reading a byte array a software (socket C #) that sends me PCM encoded sound, and I am currently looking for a sample code that is available for me by this byte array (NSDATA) Decodes and runs it.
Does anyone know the solution? Or how can I read a u-law audio?
Thanks a lot! This link contains information about the mu law encoding and decoding:
P>
define MULAW_BIAS 33 / * * Description: * Decode 8-bit signed integer using Mu-Law * Parameter: * Number - Number which decoders * Return: * Decode number * / Int 16_t MLUDD code (int 8_T number) {uint8_t sign = 0, position = 0; Int16_t decode = 0; Number = ~ number; If (number and amp 0x80) {number & amp; = ~ (1 <7); Sign = -1; } Status = ((number and 0xF0)> 4) + 5; Decoded = ((1 & lt; & lt; position) | ((number and amp; 0x0F) & lt; (lb-4)) | (1 & lt; & lt; (position -5) )) - MULABUAS; Return (sign == 0)? (Decoded): (- (decode)); } When you have uncompressed audio, you should be able to play it using audio queue API.
Good luck!
Comments
Post a Comment