0

Using CoreAudio, I am able to get the sampleRate (frames per second) and the file size, but in order to get the "total" time of the song, I need to know the Real file size of that compressed mp3.

        AudioStreamBasicDescription asbd;
        UInt32 asbdSize = sizeof(asbd);

        // get the stream format.
        err = AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_DataFormat, &asbdSize, &asbd);
        if (err)
        {
            [self failWithErrorCode:AS_FILE_STREAM_GET_PROPERTY_FAILED];
            return;
        }

        sampleRate = asbd.mSampleRate;

Is there any way I can know the real size of the song using Objective-C?

Thanks in advance.

RoundOutTooSoon
  • 9,821
  • 8
  • 35
  • 52

1 Answers1

1

See the answer to this question

There's a property you can ask in AudioFileGetProperty called kAudioFilePropertyEstimatedDuration that should do the trick.

Community
  • 1
  • 1
pgb
  • 24,813
  • 12
  • 83
  • 113
  • hi pgb, I looked at your answer on the other post u linked to, but I always got the outDataSize to be 0 every time. Can you help me with this? thanks – RoundOutTooSoon Aug 26 '09 at 01:19