• 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: How to find loop length of MP3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to find loop length of MP3


  • Subject: Re: How to find loop length of MP3
  • From: Kevin Boyce <email@hidden>
  • Date: Fri, 12 Nov 2010 21:52:01 -0500

To follow up on this, I found a strange solution, possibly a bug in AudioFile.

I was getting integer numbers of seconds for kAudioFilePropertyEstimatedDuration which seemed rather odd. Turns out I get a much more accurate number after reading the ExtAudioFile property kExtAudioFileProperty_FileLengthFrames. Perhaps that forces a scan of the file? If so, it would be nice if that were added to the documentation. If not, it should be a bug.

So now I read kExtAudioFileProperty_FileLengthFrames and discard it, since it seems to include priming and/or trailing frames, and then use kAudioFilePropertyEstimatedDuration to get the maximum loop length. As near as I can tell, that works. Pure luck I stumbled across it though.

-Kevin


On Nov 9, 2010, at 8:17 AM, Kevin Boyce wrote:

Thanks, I may end up using that. I guess what I really want is to know how long the AudioFile Player thinks a file is, so I can be sure to set a loop length equal to or less than that limit. If I have to scan the entire file, so be it.

Thanks,
Kevin


On Nov 8, 2010, at 11:04 PM, Stephen F. Booth wrote:

Hi Kevin,

You may or not may be able to accurately determine how many audio frames are in an MP3. If the encoder wrote a proper Xing/Info/LAME header you're in luck. If it didn't, well, you would have to guesstimate.

The definition of the Info header is on http://gabriel.mp3-tech.org/mp3infotag.html

I've written code using MAD to decode MP3s, including parsing the Xing/Info header: https://github.com/sbooth/SFBAudioEngine/blob/master/Decoders/MPEGDecoder.cpp

I assume you could use AudioFile to read a single MPEG frame (packet) and pull the Info header from that, but I've never tried.

Stephen

_______________________________________________ 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: How to find loop length of MP3
      • From: Kyle Sluder <email@hidden>
References: 
 >How to find loop length of MP3 (From: Kevin Boyce <email@hidden>)
 >Re: How to find loop length of MP3 (From: "Stephen F. Booth" <email@hidden>)
 >Re: How to find loop length of MP3 (From: Kevin Boyce <email@hidden>)

  • Prev by Date: OpenAL AL_GAIN unwanted ramping
  • Next by Date: Re: How to find loop length of MP3
  • Previous by thread: Re: How to find loop length of MP3
  • Next by thread: Re: How to find loop length of MP3
  • Index(es):
    • Date
    • Thread