• 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: Audio Converter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Audio Converter


  • Subject: Re: Audio Converter
  • From: George Malayil-Philip <email@hidden>
  • Date: Mon, 19 Dec 2005 04:11:16 -0500
  • Thread-topic: Audio Converter

Hi,
   Figured out how to set the format as signed integer..as simple as
clientFormat.mFormatFlags = ~(clientFormat.mFormatFlags &
kAudioFormatFlagIsFloat);
    clientFormat.mFormatFlags |= kAudioFormatFlagIsSignedInteger;
    And it might be that lame is comfortable with bigEndian signed integers
too as is AudioUnits...so, I might have one conversion lesser than I had
originally thought...need to investigate some more :)

George

> Hi,
>     I was actually using that code as the base for mine. Anyways, went
> through the underlying CAAudioFileStreamer.cpp etc. and figured out why it
> was showing 'lpcm' as the data type. Apparently, it has a converter and it's
> client type is set to lpcm, so, the aac is automatically converted to lpcm.
> The first problem was solved by setting targetFormat.mFormatID =
> kAudioFormatLinearPCM which is defined in coreaudio.h.
>     So, far so good except I would like the format to be in little endian
> integer instead of big-endian floats (lame which I am using to convert this
> buffer to .mp3 doesn't seem to like big-endian floats...it has a lot of
> noise in the encoded file).
>     I have tried a couple of approaches to getting little endian with
> varying degrees of success..
>     targetFormat.mFormatFlags = ~(targetFormat.mFormatFlags &
> kAudioFormatFlagIsBigEndian)
>     fileReader.GetFile().SetClientDataFormat(targetFormat);
>     successfully changes the format to LE floats but now my default output
> unit gives out pure noise...I am assuming here the output audio unit needs
> BE and I need to do a conversion again before playing?
>     targetFormat.mFormatFlags = ~(targetFormat.mFormatFlags &
> kAudioFormatFlagIsBigEndian)
>     targetFormat.mFormatFlags = targetFormat.mFormatFlags &
> kAudioFormatFlagsNativeEndian;
>     fileReader.GetFile().SetClientDataFormat(targetFormat);
>     The above code sets the targetFormat to 32 bit LE unsigned Int..but, the
> client data format is not set accordingly..it remains 32 bit BE float...why
> would this be? Also is there any way to set it to 32 bit LE int instead of
> unsigned int?
>     Trying to read as much code in the audiofile-new and public utility
> examples but not getting anywhere...would appreciate any help on this.
>
> Thanks
>
> Regards
> George M.P.
>
>> Have a look at the ConvertFile example in the SDK's Simple Examples
>> directory.
>>
>> It has two flavours, one that uses the ExtAudioFile, the other uses a
>> combination of the AuidoFile and AudioConverter APIs directly (kind
>> of what ExtAF does underneath the hood).
>>
>> Bill
>>
>> On 16/12/2005, at 12:26 AM, George Malayil-Philip wrote:
>>
>>> Hi,
>>>     I am trying to write a audio converter to convert from iTunes
>>> ripped
>>> .m4a files to uncompressed audio. I tried setting up a audio
>>> converter with
>>> the target audio format being set as
>>>     //fill in output format
>>>     OSType type;
>>>     StrToOSType("lpcm", type);
>>>     targetFormat.mFormatID = type;
>>>     targetFormat.mSampleRate = srcFileFormat.mSampleRate;
>>>     targetFormat.mChannelsPerFrame = srcFileFormat.mChannelsPerFrame;
>>>
>>>     UInt32 size = sizeof(targetFormat);
>>>     XThrowIfError(AudioFormatGetProperty
>>> (kAudioFormatProperty_FormatInfo, 0,
>>> NULL, &size, &targetFormat),
>>>                   "getting target format info");
>>>
>>>     While no errors are thrown with this, if I then try
>>> targetFormat.Print()
>>> I crash with "terminate called after throwing an instance of
>>> 'CAXException'"
>>>   Calls to AudioConverterNew() also fail on account of this. I am
>>> not sure
>>> what I am doing wrong and would appreciate some help on this.
>>>     Another thing that has me confused is when I do
>>> srcFileFormat.Print() it
>>> prints
>>> AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x0000002B)
>>> 32-bit
>>> big-endian float, deinterleaved
>>>     Shouldn't the format be 'aac '? This has me a bit confused. Any
>>> help
>>> much appreicated. Thanks.
>>>
>>> Regards
>>> George M.P.
>>>
>>>
>>>  _______________________________________________
>>> 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


 _______________________________________________
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

References: 
 >Re: Audio Converter (From: George Malayil-Philip <email@hidden>)

  • Prev by Date: Re: Audio Converter
  • Next by Date: Re: AudioUnit Framework Version
  • Previous by thread: Re: Audio Converter
  • Next by thread: encoding to mp3 (from java)
  • Index(es):
    • Date
    • Thread