• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Decoding raw AMR
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decoding raw AMR


  • Subject: Re: Decoding raw AMR
  • From: William Stewart <email@hidden>
  • Date: Fri, 26 Jan 2007 12:30:53 -0800

Use the AudioConverter API - if you look at:

/Developer/Examples/CoreAudio/SimpleSDK/ConvertFile

this should give you enough to get started.

Bill

On 21/01/2007, at 4:47 PM, Martin Storsjö wrote:

Hello,

I've been trying to decode raw blocks of AMR-NB encoded data, without success.

The data to decode is recorded using low-level recording APIs on a mobile phone, and is supplied to my application as raw blocks (in my case 32 bytes per block, which should be uncompressed to 160 samples of 16 bit data) with no other framing except that the length of the blocks is known.

I'm able to decode these blocks without problems using the reference AMR implementation from 3gpp.org, but I haven't succeeded in doing the same using CoreAudio or QuickTime.

First I tried using the AudioConvert-API, but AudioConverterFillComplexBuffer returned the error code '! stt' (kAudioCodecStateError), which I didn't manage to debug any further.

The current attempt is to directly use the AudioCodec component, but this approach also gives me the '!stt' error code. The code I'm trying to use is this (error checks omitted for readability):

AudioStreamBasicDescription inputFormat, outputFormat;

memset(&inputFormat, 0, sizeof(inputFormat));
inputFormat.mFormatID = 'samr';
inputFormat.mSampleRate = 8000;
inputFormat.mChannelsPerFrame = 1;

OpenADefaultComponent('adec', 'samr', &codec);
UInt32 size = sizeof(outputFormat);
AudioCodecGetProperty(codec, kAudioCodecPropertyCurrentOutputFormat, &size, &outputFormat);


AudioCodecInitialize(codec, &inputFormat, &outputFormat, NULL, 0);


UInt32 inputSize = size; // 32 bytes
UInt32 numberPackets = 1;
// this gives no error, but numberPackets is set to 0
AudioCodecAppendInputData(codec, inputData, &inputSize, &numberPackets, NULL);


UInt32 outputSize = sizeof(buffer);
numberPackets = 1;
UInt32 outStatus = 0;
// this returns '!stt'
AudioCodecProduceOutputPackets(codec, buffer, &outputSize, &numberPackets, NULL, &outStatus);




Since the error is a codec state error, I assume I should initialize the codec further, but more exactly what is missing?

Or is there any example code anywhere showing how to decode this kind of low-level unframed AMR data using e.g. the AudioConverter API?


Kind regards, // Martin _______________________________________________ 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

--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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


  • Follow-Ups:
    • Re: Decoding raw AMR
      • From: Martin Storsjö <email@hidden>
References: 
 >Decoding raw AMR (From: Martin Storsjö <email@hidden>)

  • Prev by Date: Re: Node based Audio mixing
  • Next by Date: Re: Follow up to CocoaUI question...
  • Previous by thread: Decoding raw AMR
  • Next by thread: Re: Decoding raw AMR
  • Index(es):
    • Date
    • Thread