473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Handling large amounts of data

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?
Nov 14 '05 #1
3 2825
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?


It depends on how much memory is there in the computer. If you work
in a PC environment, machines now come routinely equipped with 1GB
of RAM, and 40MB is nothing. Just load it into RAM and use it as an
array. The VM system will do the paging for you if your OS is UNIX
or windows.

It would be surprising if you wanted to process all this data in an
embedded system with a few K of RAM anyway.

jacob
Nov 14 '05 #2
Mac
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

Nov 14 '05 #3

"Wayne Marsh" <wm****@dsl.pipex.com> wrote
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?

There isn't really an answer. It depends on the exact platform, and nature
of calculations performed.
Some computers will happily chomp 40MB of data and represent it as a flat
array, whilst others will struggle. Often there is no point trying to
implement a virtual memory system of your own if the OS will do it for you.
In other cases there is a point. For instance if you need to access data in
5K chunks one megabyte apart, then a clever system of memory allocation will
beat the standard swap space algorithm hands down. However your data is
audio, so it is unlikely you want to do this.
The question is, do you really need random access over the whole 40MB array,
or can you treat the data as streamed? If you can treat it as streamed, then
it is probably best not to waste all that memory, unless you know that the
computer you are running on has the capacity to handle it, and the memory
would otherwise simply go unused.
Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: flamesrock | last post by:
Hi, Basically, what I'm trying to do is store large amounts of data in a list or dictionary and then convert that to a custom formatted xml file. My list looks roughly like this: (d,r,p]]])...
1
by: michaaal | last post by:
If I use a form to pass data (say, for example, through a textbox) the data seems to be limited to somewhat smaller amounts. What should I do if I want to pass a large amount of data? For example...
10
by: Digety | last post by:
We are looking to store a large amount of user data that will be changed and accessed daily by a large number of people. We expect around 6-8 million subscribers to our service with each record...
4
by: oshanahan | last post by:
Does anyone have ideas on the best way to move large amounts of data between tables? I am doing several simple insert/select statements from a staging table to several holding tables, but because...
2
by: Dennis C. Drumm | last post by:
What is the best way to add several pages of text to a readonly TextBox? The text does not change and was created in a Word rtf document but could as easly be put in a ASCII text file. Can this be...
1
by: Bart | last post by:
Dear all, I would like to encrypt a large amount of data by using public/private keys, but I read on MSDN: "Symmetric encryption is performed on streams and is therefore useful to encrypt large...
3
by: Brent | last post by:
Hi, I'm wondering if it is good to use datasets for large amounts of data with many users. I'm talking tables with 130,000 records and 15 columns. And we want current data, so no cached data....
7
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're...
4
by: bcomeara | last post by:
I am writing a program which needs to include a large amount of data. Basically, the data are p values for different possible outcomes from trials with different number of observations (the p...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.