• 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
ExtAudioFile woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ExtAudioFile woes


  • Subject: ExtAudioFile woes
  • From: John Weeks <email@hidden>
  • Date: Wed, 03 Jun 2015 13:46:34 -0700

I hope this list is alive- I haven't seen anything since I signed up 24 hours ago!

I am using ExtAudioFile API's to extract the data from sound files (we publish a scientific data analysis application). I can open a file and read the data just fine. Core Audio makes it pretty easy to do that with a large variety of sound files.

I'm doing this on a 5k iMac running OS X 10.10.3. Writing in C++, not Objective C++, in case that's relevant.

BUT...

I can't seek. I am trying to use this:

 	SInt64 seekFrames = 0;
	if (_startAndEndSet)
	{
		seekFrames = _starttime*formatDescription.mSampleRate;
		seekFrames = std::max(SInt64(0), seekFrames);
		if (seekFrames >= fileFrames)
		{
			_error = SYNERR;			// TODO: better errors
			return;
		}
		if (seekFrames > 0)
		{
			_error = ExtAudioFileSeek(_audioFileRef, seekFrames);
			if (_error)
				return;
		}

	...

I always get  kExtAudioFileError_InvalidSeek no matter what value seekFrames has.

At least I get a documented error code!

I would also like to get at some of the metadata, like the channel layout. For that I use code like this:

 	Boolean writable;

	AudioChannelLayout * filechannelLayout;
	_error = ExtAudioFileGetPropertyInfo (_audioFileRef, kExtAudioFileProperty_FileChannelLayout, &datasize, &writable);
	filechannelLayout = reinterpret_cast<AudioChannelLayout *>(malloc(92));
	_error = ExtAudioFileGetProperty(_audioFileRef, kExtAudioFileProperty_FileChannelLayout, &datasize, filechannelLayout);
	if (_error)
		return;
	std::cerr << "ChannelLayout struct basic size =" << sizeof(AudioChannelLayout) << "; real size:" << datasize << std::endl;
	std::cerr << "Channel layout for file:" << ChannelLayoutTagToString(filechannelLayout->mChannelLayoutTag) << std::endl;
	free(filechannelLayout);

For a .mp4 file, I get back the  kAudioChannelLayoutTag_MPEG_5_1_D tag. That's good!

For an AIFF file with four channels, I get back the  kAudioChannelLayoutTag_UseChannelDescriptions tag. That's OK- I can dump the file and I see a CHAN chunk with what appear to be good channel descriptors. But ExtAudioFileGetPropertyInfo tells me that the data size is 12 bytes (just enough for the three basic members of the structure, but not enough for the array of channel descriptors).

I've been beating my head on this wall for two days...

-John Weeks
WaveMetrics, Inc.


 _______________________________________________
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: ExtAudioFile woes
      • From: Christian Rober <email@hidden>
  • Next by Date: Re: ExtAudioFile woes
  • Next by thread: Re: ExtAudioFile woes
  • Index(es):
    • Date
    • Thread