Re: Help Please - failure in creating audio file.
Re: Help Please - failure in creating audio file.
- Subject: Re: Help Please - failure in creating audio file.
- From: tahome izwah <email@hidden>
- Date: Fri, 15 Jan 2010 07:21:58 +0100
I found the DIRAC2 example project on Stephan Bernsee's web site very
helpful - it has code to read from and write to sound files using the
ExtAudioFile API in his example iPhone project that comes with his
free time stretching library:
http://www.dspdimension.com/technology-licensing/dirac2/
(click the "get Dirac LE" button). The files you will want are called
EAFRead.mm and EAFWrite.mm in the iPhone/Classes folder
HTH
--th
2010/1/15 wm schauweker <email@hidden>:
> I would be most grateful for any guidance anyone could offer.
>
> o On iPhone, using SDK 3.1.2, testing in emulator.
> o I am trying to use Core Audio to create a file from audio sample data.
> oThis is in the nature of an "export" routine - exporting audio data that
> was originally taken from an Audio Unit and stashed in a "sample" file.
> o Now, I want to read the sample file and convert to .wav format.
>
> After much hacking I have the following working to the point that I can
> create an AudioConverter. However the CreatAudioFile function is failing
> with a fmt? error. (I had the whole copy sequence working earlier, but the
> the formats were bogus - I specified only one channel, but the sample file
> format is two-channel mono - buffer of sound, buffer of silence, ... .)
>
> Here are the ASBDs I am defining, and a snippet of the code in question:
>
> // Specify sample format. (AudioUnit input samples - 8.24
> uninterleaved, 2 channels)
> inputFormat.mSampleRate = 44100.0;
> inputFormat.mFormatID = kAudioFormatLinearPCM;
> inputFormat.mFramesPerPacket = 1;
> inputFormat.mChannelsPerFrame = 2;
> inputFormat.mBytesPerFrame = 4;
> inputFormat.mBytesPerPacket = 4;
> inputFormat.mBitsPerChannel = 32;
> inputFormat.mReserved = 0;
> inputFormat.mFormatFlags =
> kLinearPCMFormatFlagIsSignedInteger |
> kLinearPCMFormatFlagIsPacked |
> kAudioFormatFlagIsNonInterleaved;
>
> // Specify output recording format. (16-bit samples,
> noninterleaved.)
> outputFormat.mSampleRate = 44100.0;
> outputFormat.mFormatID = kAudioFormatLinearPCM;
> outputFormat.mFramesPerPacket = 1;
> outputFormat.mChannelsPerFrame = 2;
> outputFormat.mBytesPerFrame = 2;
> outputFormat.mBytesPerPacket = 2;
> outputFormat.mBitsPerChannel = 16;
> outputFormat.mReserved = 0;
> outputFormat.mFormatFlags =
> kLinearPCMFormatFlagIsSignedInteger |
> kLinearPCMFormatFlagIsPacked |
> kAudioFormatFlagIsNonInterleaved;
>
>
> // Create AudioConverter
> XThrowIfError(AudioConverterNew(&inputFormat, &outputFormat,
> &converter), "Exporter: Error creating AudioConverter");
>
> // Open output file.
> CFURLRef exportURL = CFURLCreateFromFileSystemRepresentation(NULL,
> (UInt8*)exportPath_, strlen(exportPath_), false);
> /** This is the call that is failing **/
> XThrowIfError(AudioFileCreateWithURL(exportURL,
> kAudioFileWAVEType,
> &outputFormat,
> kAudioFileFlags_EraseFile,
> &outputFile), "Exporter:
> Error opening export output file");
>
>
>
> _______________________________________________
> 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