• 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: trouble creating working Apple Lossless file under iOS 3.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble creating working Apple Lossless file under iOS 3.2


  • Subject: Re: trouble creating working Apple Lossless file under iOS 3.2
  • From: Ian Esten <email@hidden>
  • Date: Fri, 05 Nov 2010 00:59:48 -0700

ALAC data can be written to either CAF or Apple MPEG-4 audio formats. Perhaps if you switch to MPEG-4 you will get files that Quicktime and iTunes can play. I experienced the same problem with AAC data - Quicktime and iTunes would not play the files I created, but AFConvert could convert them back to PCM no problem.

Ian


On Nov 4, 2010, at 11:09 PM, Christopher Penrose wrote:

> I am able to create Apple Lossless files with my iPad app under iOS 3.2 using either an m4a or caf transport.  I receive no errors from the API.  The problem is that they are unplayable -- they lock Finder, Quicktime Player, iTunes, and afplay for about 10 seconds.   Upon inspection with afinfo they look normal to me (I haven't found an indication that a channel layout is needed for ALAC files to be playable).  I am passing audio buffers to ExtAudioFileWrite ()which are in iOS canonical format (which might be the issue perhaps, but AIFF and WAV work fine using them).
>
> % afinfo hobo.caf
> File:           hobo.caf
> File type ID:   caff
> Data format:     2 ch,  44100 Hz, 'alac' (0x00000003) from 24-bit source, 4096 frames/packet
>                no channel layout.
> estimated duration: 12.423 sec
> audio bytes: 1784876
> audio packets: 134
> audio 547840 valid frames + 0 priming + 1024 remainder = 548864
> bit rate: 1147286 bits per second
> packet size upper bound: 15781
> audio data file offset: 12288
> optimized
> ----
>
> % afplay hobo.caf
> Error: start audio output unit (-536870185)
>
> % ls -alt hobo.caf
> -rw-r--r--  1 penrose  admin  1797164 Nov  4 22:40 hobo.caf
>
>
>
> I use the following code fragment to configure the ASBD for Apple Lossless:
>
>
> 	// clear output audio format ASBD
>
> 	bzero(&performOutputFormat, sizeof(AudioStreamBasicDescription));
>
> 	// adjust format id for Apple Lossless codec
>
> 	performOutputFormat.mFormatID = kAudioFormatAppleLossless;
> 	performOutputFormat.mSampleRate = performClientFormat.mSampleRate;
> 	performOutputFormat.mChannelsPerFrame = performClientFormat.mChannelsPerFrame;
>
> 	// adjust format flags for Apple Lossless codec
>
> 	performOutputFormat.mFormatFlags = kAppleLosslessFormatFlag_24BitSourceData;
>
>
> 	// trust the AudioFormat API to hopefully fill out the rest.
>
>    	UInt32 size = sizeof(performOutputFormat);
>    	OSStatus err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &performOutputFormat);
>
> 	// whine about failure should it occur
>
> 	if (err != noErr) {
>
> 		[STButler alertPanelTitle:@"Audio Export Error" message:
> 				@"Failure to get format requirements for Apple Lossless codec."];
> 	}
>
>
> I open the file for writing with:
>
> 	err = ExtAudioFileCreateWithURL (cfFileUrl, fileType, &performOutputFormat, NULL, kAudioFileFlags_EraseFile, &recordPerformAudioFileRef);
>
>
> I write buffers to the the audiofileref once it is opened using:
>
> 		OSStatus err = ExtAudioFileWrite(recordPerformAudioFileRef, bufferCount, currentAudioBuffer);
>
>
> I have used the same code base to write playable AIFF and WAV files without issue.   I am not sure what I have neglected here.  Thanks for any input.
>
> Christopher
>
> _______________________________________________
> 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

  • Follow-Ups:
    • Re: trouble creating working Apple Lossless file under iOS 3.2
      • From: Aran Mulholland <email@hidden>
References: 
 >afinfo (From: email@hidden <email@hidden>)
 >Re: afinfo (From: Jean-Daniel Dupas <email@hidden>)
 >Re: afinfo (From: Robert Martin <email@hidden>)
 >trouble creating working Apple Lossless file under iOS 3.2 (From: Christopher Penrose <email@hidden>)

  • Prev by Date: Re: afinfo
  • Next by Date: Re: trouble creating working Apple Lossless file under iOS 3.2
  • Previous by thread: trouble creating working Apple Lossless file under iOS 3.2
  • Next by thread: Re: trouble creating working Apple Lossless file under iOS 3.2
  • Index(es):
    • Date
    • Thread