0

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!

Paul R
  • 208,748
  • 37
  • 389
  • 560
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • I understand that you don't really have a problem looping through samples. But you need a lib, that extracts the samples from a *.caf-file, which is nothing else but an AIFF-file http://en.wikipedia.org/wiki/Audio_Interchange_File_Format. – AudioDroid Feb 08 '11 at 16:20

2 Answers2

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.

AudioDroid
  • 2,292
  • 2
  • 20
  • 31
  • Hm. Are you sure...I think it might be not that is, but still not impossible. Did you see this: http://stackoverflow.com/questions/4939268/can-the-libsndfile-library-be-used-on-the-iphone-ios? – AudioDroid Feb 16 '11 at 15:44
  • 1
    I noticed a typo in my last comment. I meant "..might not be easy,.." @Eric: I am not sure what you are trying to say. I pointed out the very same stackoverflow question and there it says you should be able to link the libsndfile-library to an iOS project. Just not dynamically. However you just say, it doesn't work. Why? Did you try it? – AudioDroid Feb 23 '11 at 09:51
  • My apologies for the confusion. I think I read the responses too quickly. No I haven't tried it, but I've found an alternative solution to my problem so therefore won't be looking into this one. Thanks so much for your help though! – Eric Brotto Feb 23 '11 at 10:45
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.

AudioDroid
  • 2,292
  • 2
  • 20
  • 31