[PD] [soundfile_info] made with vanilla (was: Re: Using externals with libpd on Windows)

oliver oliver at klingt.org
Sat May 12 19:06:59 CEST 2018


Joe White wrote:
> Hi all,
> 
> I recently spent a bit of time tracking down why a patch wasn't loading 
> a couple of externals in a windows application that embeds libpd.
> 
> The patch was using /vbap/ [0] and /soundfile_info/ from iemlib [1].

hi,

just the other night i was hacking together a [sound_file] info 
alternative with purely vanilla objects WITHOUT loading an entire file 
into RAM.

the method is basically to use [soundfiler] to load 1 sample of a file 
into a table with a -skip message, and recalculate the skip position 
until [soundfiler]'s left outlet outputs 1 (instead of 0).

all of [soundfile_info]'s other values are also output from 
[soundfiler]'s right outlet as of PD version 0.48.

it takes a tad longer than [soundfile_info] to output the soundfile's 
length, but it's acceptable imho. plus you can use .aiff too !

best

oliver
-------------- next part --------------
#N canvas 89 106 924 643 10;
#X obj 80 274 soundfiler;
#X obj 50 138 table test 1;
#X obj 50 189 t f f, f 8;
#X obj 80 321 f;
#X obj 80 296 sel 0 1, f 58;
#X msg 398 410 1;
#X obj 80 376 list prepend;
#X obj 252 325 f;
#X obj 252 383 list append;
#X obj 80 348 t f f;
#X obj 252 348 t f f;
#X obj 80 489 t f f f;
#X obj 98 517 !=, f 4;
#X obj 50 517 spigot;
#X obj 98 563 f;
#X obj 98 539 sel 0;
#X floatatom 398 578 10 0 0 0 - - -, f 10;
#X obj 717 195 soundfile_info;
#X obj 398 556 realtime;
#X obj 717 120 t b b, f 7;
#X floatatom 756 307 10 0 0 0 - - -, f 10;
#X obj 756 284 realtime;
#X obj 799 260 t b;
#X obj 717 93 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X floatatom 98 608 10 0 0 0 - - -, f 10;
#X floatatom 685 371 10 0 0 0 - - -, f 10;
#X obj 80 400 t l l;
#X msg 107 423 \$2 \$1;
#X obj 107 445 -;
#X obj 107 466 * 0.5;
#X obj 80 466 +;
#X msg 80 423 \$1, f 2;
#X msg 379 353 \$1;
#X msg 685 222 \$3 \$1;
#X obj 685 243 /;
#X obj 322 331 soundfiler;
#X obj 379 376 t b b f;
#X msg 322 261 read \$1 test;
#X msg 80 250 read -skip \$1 \$2 test;
#X obj 238 187 t s s, f 11;
#X obj 80 225 pack 0 s, f 25;
#X obj 98 584 /, f 5;
#X floatatom 418 484 5 0 0 0 - - -, f 5;
#X msg 379 439 5e+008;
#X text 431 326 for some strange reason \, the samplerate has to be
calculated seperatedly first \, or else it doesn't aarive in time for
the final length calculation ..., f 32;
#X obj 238 55 openpanel;
#X obj 238 15 bng 30 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 278 120 list trim;
#X msg 238 145;
#X obj 238 99 t b s;
#X obj 238 76 symbol;
#X obj 278 99 list prepend set symbol;
#X text 450 432 highest possible number (~ 188 minutes at 44100 khz)
, f 30;
#X text 429 409 lowest possible number (1 sample);
#X msg 717 172 read \$1;
#X obj 717 150 symbol;
#X text 167 606 <- length in milliseconds;
#X text 684 388 length in milliseconds;
#X text 728 222 samples / samplerate;
#X text 140 583 samples / samplerate;
#X text 280 20 load soundfile to calculate its length;
#X text 51 33 slower but vanilla:;
#X text 714 68 faster but needs [iemlib]:;
#X text 396 595 calc duration;
#X text 754 322 calc duration;
#X obj 155 101 loadbang;
#X msg 155 127 set;
#X connect 0 0 4 0;
#X connect 2 0 40 0;
#X connect 2 1 3 1;
#X connect 2 1 7 1;
#X connect 3 0 9 0;
#X connect 4 0 3 0;
#X connect 4 1 7 0;
#X connect 5 0 6 1;
#X connect 5 0 12 1;
#X connect 6 0 26 0;
#X connect 7 0 10 0;
#X connect 8 0 26 0;
#X connect 9 0 6 0;
#X connect 9 1 8 1;
#X connect 10 0 8 0;
#X connect 10 1 6 1;
#X connect 11 0 13 0;
#X connect 11 1 12 1;
#X connect 11 2 12 0;
#X connect 11 2 14 1;
#X connect 12 0 13 1;
#X connect 12 0 15 0;
#X connect 13 0 2 0;
#X connect 14 0 41 0;
#X connect 15 0 14 0;
#X connect 15 0 18 1;
#X connect 17 0 33 0;
#X connect 18 0 16 0;
#X connect 19 0 55 0;
#X connect 19 1 21 0;
#X connect 21 0 20 0;
#X connect 22 0 21 1;
#X connect 23 0 19 0;
#X connect 26 0 31 0;
#X connect 26 1 27 0;
#X connect 27 0 28 0;
#X connect 28 0 29 0;
#X connect 29 0 30 1;
#X connect 30 0 11 0;
#X connect 31 0 30 0;
#X connect 32 0 36 0;
#X connect 33 0 34 0;
#X connect 34 0 25 0;
#X connect 34 0 22 0;
#X connect 35 1 32 0;
#X connect 36 0 43 0;
#X connect 36 1 5 0;
#X connect 36 1 18 0;
#X connect 36 2 41 1;
#X connect 36 2 42 0;
#X connect 37 0 35 0;
#X connect 38 0 0 0;
#X connect 39 0 37 0;
#X connect 39 1 40 1;
#X connect 40 0 38 0;
#X connect 41 0 24 0;
#X connect 43 0 2 0;
#X connect 45 0 50 0;
#X connect 46 0 45 0;
#X connect 47 0 48 0;
#X connect 48 0 39 0;
#X connect 49 0 48 0;
#X connect 49 1 51 0;
#X connect 50 0 49 0;
#X connect 50 0 55 1;
#X connect 51 0 47 0;
#X connect 54 0 17 0;
#X connect 55 0 54 0;
#X connect 65 0 66 0;
#X connect 66 0 48 0;


More information about the Pd-list mailing list