On Sat, 20 Nov 2004 16:05:00 +0000, Wayne Marsh wrote:
> Hi all.
>
> I am working on an audio application which needs reasonably fast access to
> large amounts of data. For example, the program may load a 120 second
> stereo sound sample stored at 4bytes per sample, which would mean over
> 40MB of data at a 44100Hz sampling rate.
>
> Now, what would be a good way to handle all of this data? Ideally, for the
> sake of my own sanity and the algorithms within directly functional
> portions of the code, I'd like to interface with the data via normal array
> syntax. Are arrays of this size really suitable, or would there be a
> better way? Writing the data to disk and then memory mapping the files
> seemed like an option, although I suspect that would be analogous to the
> operating system's virtual memory system.
>
> Any ideas?
On a PC or similar, 40 MB isn't really that much data nowadays. I would
start by just reading the whole file into an array and accessing the data
via the array.
If that approach proves problematic, you can go back and try to use memory
mapping (which isn't really on topic here) or what have you. This should
have little effect on the rest of your program, so it's not like you lose
anything if you have to change to the memory mapped approach.
If you are not envisioning a PC-type environment, then that is another
story.
--Mac
|