• 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
ExtAudioFileRead -- not reading enough frames
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ExtAudioFileRead -- not reading enough frames


  • Subject: ExtAudioFileRead -- not reading enough frames
  • From: "Edwards, Waverly" <email@hidden>
  • Date: Fri, 10 Sep 2010 18:03:43 -0500
  • Acceptlanguage: en-US
  • Thread-topic: ExtAudioFileRead -- not reading enough frames

I have what an odd problem. For testing purposes, I have two files, ten seconds in length with a sample rate of 44100 Hz, which makes 441000 samples.  The first file is a 16-bit WAV file and the second 32-bit.  If I read file with the following code I get two different results for frames read upon completion of the read.  I am typing this all out but hopefully there are not any errors.

propSize = sizeof( fileLenInFrames );
err = ExtAudioFileGetproperty( inExtAudFileRef, kExtAudioFileProperty_FileLenthFrames, &propSize, &fileLenInFrames );

// fileLenInFrames reports 441000 as expected on both files here

convRatio = outFormat.mSampleRate / inFormat.mSampleRate; //make room for conversion
framesToRead = fileLenInFrames * convRatio;// read samples according to conversion ratio when upsampling
dataSize = ( framesToRead * outFormat.mBytesPerFrame );
soundData = malloc( dataSize );

result = ExtAudioFileRead(inExtAudFileRef, &framesToRead, bufList);

When I read the 16-bit file, upon completion framesToRead returns a result of 440309, not 441000 as expected.  If I read a 32-bit sample file, upon completion, I do get 441000 samples as expected.  Now, if I ask for more frames than what are in the file when using the 16-bit sample test file, I do get the expected 441000 samples.  The conversion factor is in place so that when I read a file that is of lower sampling rate, it automatically upsampled to 44100 Hz.

Is there something I am doing wrong?


Thank you,


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: ExtAudioFileRead -- not reading enough frames
      • From: "Edwards, Waverly" <email@hidden>
  • Prev by Date: Re: What became of the deprecated functions' channel parameters?
  • Next by Date: Re: Minimum frames per slice?
  • Previous by thread: Re: What became of the deprecated functions' channel parameters?
  • Next by thread: RE: ExtAudioFileRead -- not reading enough frames
  • Index(es):
    • Date
    • Thread