Simplest way to get per-sample access to audio file?

I have a class that I’d like to associate with a short aif audio file. What I’d like is for my class to maintain a sample index position, and be able to retrieve the corresponding number from that sound file. So far I didn’t find information that seems relevant to achieving this (as far as i could tell, ofSoundPlayer and ofSoundStream don’t do per-sample lookups)

Any pointers would be greatly appreciated.

this particular library can help you out very well for this:

http://www.mega-nerd.com/libsndfile/

“Libsndfile is a C library for reading and writing files containing sampled sound (such as MS Windows WAV and the Apple/SGI AIFF format) through one standard library interface.”

if you need to play the sound, through ofSoundStream, you might also look at libsamplerate to help get the sample rate of what you’ve loaded in to match the sample rate of your audiostream:

http://www.mega-nerd.com/SRC/

take care,
zach

Thanks very much zach! that looks like the thing. (i posted a follow up question about how to use libsndfile as a dynamically loaded library over here: http://forum.openframeworks.cc/t/saving-audio-file-to-disk/1136/5 )