Reading the contents of an AudioFile

  • Hi All

                I want to read an audio file to get its sound value (frequancy value) using core audio or QT. I can take the values using QT but it takes the time as long as the duration of the file. That means a 5 min file requires 5 min to read sound values from the file. I am doing it using a callback.
                i want to read the sound values or frequency value as faster as possible.
    like i want to read the values in less than 30 seconds. is any one knows an alternate method to read the file to get sound value very fastly

                                    thanks in Advance

                                                                                                                                        Sheen


    ---------------------------------
    Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.
  • Hi Sheen,

    This is probably better as a core audio list question, but this may
    help...

    Look at CAAudioFile & AUOutputBL

    - Use CAAudioFile to manage the file stuff:  open, read, close.
    Also, you can use CAAudioFile to covert the format if you need to do
    that.
    - Use AUOutputBL to hold the data.  Once the data is read in you can
    access the buffer for the values.

    Here is some (very incomplete) code...

    CAAudioFile srcFile;
    srcFile.Open( inFileRef );

      // Get the file's audio format
    CAStreamBasicDescription srcDesc( srcFile.GetFileDataFormat() );

    #if !CAAF_USE_EXTAUDIOFILE
    mNumFrames = srcFile.GetNumberPackets();  // pre-Tiger
    #else
    mNumFrames = srcFile.GetNumberFrames();  // Tiger and beyond
    #endif

      // Create a buffer for the data
    mOutputBufferList = new AUOutputBL( & srcDesc );
    mOutputBufferList->Allocate( mNumFrames );
    mOutputBufferList->Prepare();

      // Read the file into the Audio Buffer
    UInt32 numFrames = mNumFrames;
    srcFile.Seek( 0 ); // start at the start
    srcFile.Read( numFrames, mOutputBufferList->ABL() );

    Hope this helps.

    On Oct 25, 2006, at 8:04 AM, sheen mac wrote:

    > Hi All
    >
    > I want to read an audio file to get its sound value
    > (frequancy value) using core audio or QT. I can take the values
    > using QT but it takes the time as long as the duration of the file.
    > That means a 5 min file requires 5 min to read sound values from
    > the file. I am doing it using a callback.
    > i want to read the sound values or frequency value as
    > faster as possible.
    > like i want to read the values in less than 30 seconds. is any one
    > knows an alternate method to read the file to get sound value very
    > fastly
    >
    > thanks in Advance
    >

    Craig Hopson
    Red Rock Software

    ***************************************************
    "If every household in the U.S. replaced one light bulb with an
    ENERGY STAR qualified compact fluorescent light bulb (CFL), it would
    prevent enough pollution to equal removing one million cars from the
    road."  http://www.energystar.gov/index.cfm?c=cfls.pr_cfls
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today