[PD] playing long audio files

IOhannes m zmoelnig zmoelnig at iem.at
Fri Jul 19 09:54:27 CEST 2013

Hash: SHA1

On 2013-07-19 03:49, Фывапр Олджэвич wrote:
> Dear List !
> I made this patch to play long stereo audio file. You can load
> audiofile and play, but before - reset the sizes of tables.
> BUT, it plays only one stereo file in my Vanilla. So when i played
> one file and try to load another: i push the RESET-bang .. and PD
> crushes totally..

well, i don't think it's Pd that's crashing - but rather the operating
system that kills it.

at the beginning you create 2 tables and resize them to 1 (what is
this for?) and then to 158760000 samples.
given that Pd uses 4 bytes to save each sample (8 bytes on 64bit),
this means that one table takes approximately 635MB (32bit) resp
1.27GB (64bit).
so this gives you (for both tables) 1.27GB (32bit) resp 2.5GB (64bit)
memory consumption.
now when loading the table, you resize it, which potentially means
allocating a new table which is bigger than the previous one, copying
the data from the old table to the new one and then freeing the old
table. so at some point you have doubled the amount of memory needed
by your patch.

how much RAM do you have?
is your system/OS capable of addressing more than 4GB of memory? (e.g.
is your system/OS capable of addressing more than 4GB of memory within
a single application? (64bit)

apart from that you patch is slightly buggy anyhow.
imaging the following scenario:
- - init tables with 1h of samples
- - load a soundfile that is 3 seconds long
  (the sample gets loaded and the table gets resized to 3 seconds)
- - load a soundfile that is 10 minutes long:
  the sample gets loaded into the 3 seconds table and is truncated.
  after that, the table is resized to 10 minutes - giving you 3
seconds of your soundfile and 9:57 of silence.

did you know that [soundfiler] has a "-resize" switch that
automatically resizes the table to your needs?
btw, you might even want to resize your table to something small (1)
before loading the sample.

Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/


More information about the Pd-list mailing list