Re: Recording in MACE 3:1 and 6:1
Re: Recording in MACE 3:1 and 6:1
- Subject: Re: Recording in MACE 3:1 and 6:1
- From: Tomas Zahradnicky <email@hidden>
- Date: Fri, 09 May 2014 15:43:14 +0200
Hello,
after digging deeply in AudioToolbox.framework I found an answer to my own question. Let me share my experience:
1. AudioQueueNewInput creates an audio queue object checking ASBD.mFormatID for kAudioFormatLinearPCM.
2. If the format is kAudioFormatLinearPCM or the inFlags parameter of the AudioQueueNewInput call had the LSB set to 1, it continues with step 4.
3. The ASBD.mFormatID is passed to AudioFormatGetProperty( 'hvec', 4, &ASBD.mFormatID, NULL, 0 ). This undocumented property selector checks whether an encoder for this format is present in a list of audio encoders ('hvdc' checks a list of decoders). If a codec is present for the questioned format, the funtion returns noErr, otherwise kAudioFormatUnsupportedDataFormatError.
4. AudioConverterNew is called to convert from a 32-bit floating point linear PCM into a format specified in ASBD.
The answer to my question: There're decoders for MACE 3:1 and MACE 6:1 but encoders are missing. For this reason the AudioQueueNewInput failed with the error I described and the error originated from the above AudioFormatGetProperty.
Cheers,
Tomas
Le 26 avr. 2014 à 23:26, Tomas Zahradnicky <email@hidden> a écrit :
> Hello CoreAudio API list members,
>
> I am trying to record an AIFF-C audio file with the MACE 3:1 compression, but weird things happen.
>
> First, I'm wondering how should be an ASBD properly filled for MACE since the docs are all peculiarly quiet on this topic. When I iterate the global file properties, ask for the AIFF-C file format with the MACE 3:1 compression, and extract an ASBD, it is all zero except for ASBD.mFormat=kAudioFormatMACE3. I then set:
>
> ASBD.mSampleRate=44100.0;
> ASBD.mChannelsPerFrame=1;
> ASBD.mBitsPerChannel=0; /* compressed file format */
> ASBD.mFormatFlags=0;
>
> I believe I have to set ASBD.mBytesPerFrame=1=mBitsPerChannel*mChannelsPerFrame/8, but am unsure about ASBD.mBytesPerPacket and ASBD.mFramesPerPacket since this is a compressed format. Should there be 3 frames per packet for MACE 3:1 and 6 for MACE 6:1 or something different? Should I really set mBitsPerChannel to 0 (the docs say so, as the audio is compressed)?
>
> Second, afconvert also behaves oddly. When I let it dump all file formats, AIFF-C/MAC3 is supported,
> $ afconvert -hf
> Audio file and data formats:
> ...
> 'AIFC' = AIFC (.aifc, .aiff, .aif)
> data_formats: I8 BEI16 BEI24 BEI32 BEF32 BEF64 UI8 'ulaw'
> 'alaw' 'MAC3' 'MAC6' 'ima4' 'QDMC' 'QDM2'
> 'Qclp' 'agsm'
>
> and when I request a WAVE file to be converted into AIFF-C with MACE 3:1, I get an error:
>
> $ afconvert -c 1 -d MAC3 -f AIFC cdquality.wav result.aiff
> Error: ExtAudioFileSetProperty ('cfmt') failed ('fmt?')
>
> Am I doing something wrong?
>
> Thank you,
> Tomas
> _______________________________________________
> 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