-->

Looping through the samples of CAF file

2019-09-04 07:38发布

问题:

Could anyone give me a suggestion or an example of how I would loop through the samples of CAF (Core Audio Format) file? Like taking the first 1000 samples and changing them to 0?

Something like:

for(int i=0; i < numberOfSamples; i++)
{
    cafFile.sample[i] = methodThatUsesSampleValue(cafFile.sample[i]);
}

Keep in mind:

  1. I don't need to do this live. No buffers, etc. needed.
  2. I would like to do this in C, C++ or Objective-C.
  3. Would like to be able to use the code on the iOS platform.

Any help appreciated!

回答1:

Recently I stumbled over the amazing OpenFrameWorks library: http://www.openframeworks.cc/about And I know it compiles on MacOS and iPhone. Amongst many(!) other libs it come with an interface to rtAudio: http://www.music.mcgill.ca/~gary/rtaudio/index.html. You might want to consider also using that directly. Hope that helps.



回答2:

The libsndfile C++ library is well-known and provides -among lot of other functions - a function to read AIFF-files: http://www.mega-nerd.com/libsndfile/, the lib is distributed under the "Gnu Lesser General Public License". I don't know if that is an issue.



标签: c++ c ios audio caf