• 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
AudioFileGetProperty values, reading an MP3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioFileGetProperty values, reading an MP3


  • Subject: AudioFileGetProperty values, reading an MP3
  • From: "Edwards, Waverly" <email@hidden>
  • Date: Mon, 9 Aug 2010 15:34:41 -0500
  • Acceptlanguage: en-US
  • Thread-topic: AudioFileGetProperty values, reading an MP3

I am reading an MP3 using AudioFileReadPackets and I've come across something strange.  After reading the documentation and looking at some examples I am unable to reconcile why the calculated buffer size does not match the byte count I get from AudioFileGetProperty.

err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataPacketCount, &dataSize, &packetCount);

err = AudioFileGetProperty(audioFile, kAudioFilePropertyMaximumPacketSize, &dataSize, &maxPacketSize);

err = AudioFileGetProperty(audioFile, kAudioFilePropertyAudioDataByteCount, &dataSize, &byteCount);

I create a buffer based on the number of packets multiplied by the packet count.  The byte count does not match when opening mp3's

buffer = calloc( 1, packetCount * maxPacketSize );

mp3: packetCount * maxPacketSize > byteCount
wave: packetCount * maxPacketSize == byteCount

I thought the multiplication method would be correct however when I inspect the buffer, there is no sound data in the difference between the two sizes.

Should I always use kAudioFilePropertyAudioDataByteCount to determine my buffer size?  Shouldn't these methods always match perfectly?


Thanks,


W.
 _______________________________________________
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: AudioFileGetProperty values, reading an MP3
      • From: William Stewart <email@hidden>
  • Prev by Date: Re: Call MIDI methods in Audio thread
  • Next by Date: AudioReflectorDriver: won't unload
  • Previous by thread: Re: Call MIDI methods in Audio thread
  • Next by thread: Re: AudioFileGetProperty values, reading an MP3
  • Index(es):
    • Date
    • Thread