Re: Does iPhone's iLBC Audio Format support 30ms mode?
Re: Does iPhone's iLBC Audio Format support 30ms mode?
- Subject: Re: Does iPhone's iLBC Audio Format support 30ms mode?
- From: Eric Allamanche <email@hidden>
- Date: Sun, 11 Apr 2010 22:49:27 -0700
both 20 and 30ms modes are supported on iPhone OS. Since this codec is also supported on SnowLeopard, you can verify that you get the same results on both systems for encoding and decoding.
Eric
On Apr 8, 2010, at 9:59 PM, Sauw Ming wrote:
> Hi all,
>
> I'm trying to encode/decode from linear PCM (8KHz, mono, 16 bits) to
> kAudioFormatiLBC (8 KHz, mono) format on iPhone OS 3.1.2.
>
> Following iPhone's sample application in:
> http://developer.apple.com/iphone/library/samplecode/iPhoneExtAudioFileConvertTest/Listings/ExtAudioFileConvert_cpp.html#//apple_ref/doc/uid/DTS40009222-ExtAudioFileConvert_cpp-DontLinkElementID_7
>
> When I use the following function:
> dstFormat.mSampleRate = 8000.0;
> dstFormat.mFormatID = kAudioFormatiLBC;
> dstFormat.mChannelsPerFrame = 1;
> // use AudioFormat API to fill out the rest of the description
> AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
> 0, NULL, &size, &dstFormat);
>
> It will always gives me:
> dstFormat.mFramesPerPacket = 160;
> dstFormat.mBytesPerPacket = 38;
> i.e. the 20ms mode, which, I supposed, is the default format here.
> Using this mode, the encoding/decoding worked flawlessly. However, my
> application needs to support the 30ms mode (i.e. the encoding/decoding
> of 240 to 50), so I try to manually set mFramesPerPacket to 240 and
> mBytesPerPacket to 50. It seems to be successful since all functions
> return successfully (both AudioConverterNew() and
> AudioConverterFillComplexBuffer() return noErr). The encoding works
> fine, however the decoding (from iLBC to PCM) doesn't seem to work
> anymore, I can only hear something similar to clicking sound. So I am
> just wondering whether iLBC AudioConverter actually supports the 30ms
> mode (especially the decoding from 50 bytes iLBC format to 240 samples
> of PCM, since the encoding seems OK)?
>
> Below is the srcFormat (the PCM format):
>
> Thank you,
> Ming
>
> srcFormat.mSampleRate = 8000.0;
> srcFormat.mFormatID = kAudioFormatLinearPCM;
> srcFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
> | kLinearPCMFormatFlagIsPacked;
> srcFormat.mBitsPerChannel = 16;
> srcFormat.mChannelsPerFrame = 1;
> srcFormat.mBytesPerFrame = srcFormat.mChannelsPerFrame
> * srcFormat.mBitsPerChannel >> 3;
> srcFormat.mFramesPerPacket = 1;
> srcFormat.mBytesPerPacket = srcFormat.mBytesPerFrame *
> srcFormat.mFramesPerPacket;
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden