Another memory-related question:
When I load an audio file to an array, the array resizes to a certain length and loads the audio in mono. Does this mean that only the samples which are in the array are stored RAM, or is the whole file kept in RAM?
I ask because I have been using several very large samples for live granulation, and PD keeps hanging because it runs out of memory, so I want to know if squeezing down the files would help.
thx, d.
derek holzer wrote:
Another memory-related question:
When I load an audio file to an array, the array resizes to a certain length and loads the audio in mono. Does this mean that only the samples which are in the array are stored RAM, or is the whole file kept in RAM?
Ahhhh.... just found this!!!!! read on...
Subject: Re: [PD] the max size of array? Date: Mon, 7 Apr 2003 09:02:00 +0200 From: Thomas Grill t.grill@gmx.net Thomas Grill wrote:
For your wav file: Don't forget that a 16 bit file will be blown up to double size (32 bits) and will then take up 304 MB. It depends on
your RAM
size if that can be handled.
It would seem that the file takes up twice as much room even when only one track is being used? The story gets stranger and stranger!
So how much RAM does a 3 minute, stereo, 16-bit file @ 44100 Hz actually take up when loaded into a single-channel, 1323000-element [30 sec @ 44100 Hz] array? Seems like a simple math question, but I feel like I don't have all the factors figured in yet... [Bonus question: would it make a difference if PD were using 48 Khz?]
Don't use a graphical array! The graphical representation can't handle this large arrays properly.
Which array should I use then? I haven't seen a non-graphical array object... Usually, I just hide it in a subpatch for that "non-graphical" approach. Can you point me in the right direction?
d.
For your wav file: Don't forget that a 16 bit file will be blown up to double size (32 bits) and will then take up 304 MB. It depends on your RAM size if that can be handled.
It would seem that the file takes up twice as much room even when only one track is being used? The story gets stranger and stranger!
Nothing strange here. All numbers in PD (signal or float) are represented in 32-bit floating point. So when you read data from a CD-quality soundfile (which is 16-bit integer) into memory, it is converted to 32-bit FP, and thus takes up twice as much space in RAM as on disk. If you were using, e.g., a 24-bit soundfile, it would only use 1.333... times as much space.
Jer
Hallo, derek holzer hat gesagt: // derek holzer wrote:
Don't use a graphical array! The graphical representation can't handle this large arrays properly.
Which array should I use then? I haven't seen a non-graphical array object... Usually, I just hide it in a subpatch for that "non-graphical" approach. Can you point me in the right direction?
I think he means: [table arrayname]
Frank Barknecht _ ______footils.org__
Hi Derek,
So how much RAM does a 3 minute, stereo, 16-bit file @ 44100 Hz actually take up when loaded into a single-channel, 1323000-element [30 sec @ 44100 Hz] array? Seems like a simple math question, but I feel like I don't have all the factors figured in yet...
meaning that the array will take up about 1,3 MSamples *4 bytes = 5,2 Mbytes.
that would result in about 8 MSamples *4 bytes= 32 MBytes. Please note that there's also some built-in limit (that i have cancelled out in my PD version and that can also be overridden by some soundfiler flag) chopping the sound file and restricting the load process to 4 MSamples = 16 MBytes.
There's a shorthand form to these calculations: 1 minute of 32 bit mono data (or 16 bit stereo data) at 44,1 kHz takes up about 10 MBytes.
[Bonus question: would it make a difference if PD were using 48 Khz?]
No, that just influences eventual playing speed. Loaded sound data is not resampled, so a 44.1 kHz sound file will sound pitched higher when played with tabplay~.
best greetings, Thomas