[PD] [soundfiler] normalizing max amplitude inf to 1 ?

IOhannes m zmoelnig zmoelnig at iem.at
Fri Sep 2 14:58:15 CEST 2005


Enrique Erne wrote:
> 
> I had 95.3MB of silence after normalizing .
> 
> 'normalizing max amplitude inf to 1'
> what does inf mean ?

"inf" means "infinity", which is larger than 1000000000000000.

> 
> I can't imagine why it's just silence . just read and write the same
> file with soundfiler is not a problem at all .

if the largest values in your soundfile would be 1000000000000000, than
all samples would be multiplied be 1/1000000000000000 (which is rather
small).
if the largest value is "inf", all samples will be multiplied by "1/inf"
which is exactly "0".
thus you get the silence.


> as there are long [repeat] cycles , it may need a little time to finish
> each step . after each of the 4 steps is a print to see when it's done .
> use a cpu-monitor while waiting :-)

i haven't tried out your patch, but i have some remarks:

-> to get the maximum of two numbers you can use [max]
if you want to get the maximum of a stream of numbers, use something like

 [f]   +--+
 |     |  |
 [max 0]  |
 |        |
 [t f f]  |
 |     |  |
 |     +--+
 |
 [ \

don't forget to reset the initial max-value to "0" before you try to get
a new maximum.
the same applies for "[min] and the minimums" (which would be a nice
band-name, btw)


-> if you want to repeat a "bang", you can also use the builtin [until]
object. this way your abstraction does not need any external at all.

-> if you don't care about not using externals, there are some that
might help you more:
 : [tabminmax] in zexy should give you the minimum and maximum value of
a table.
 : there is a [iemtab] library (but knowing thomas musil's release
cycles, i doubt if it is be available somewhere).
 : thomas grill's [vasp] library will also give you the possibility to
process tables as a whole.




some more things:
:it would be good to know what is going on (why your abstraction thinks
that one value is "inf"); try debugging it by printing all the maximum
values and their index (to see at which index the weird maximum is
generated)
:2.49e07 is a very large number for single-precision floating point (and
all numbers in pd are single precision floats); your precision will be
less than "1e0" (which means that in pd "24900000 + 1 = 24900000" !!!)
:to normalize a table to a certain value, you can also send the table a
message like "normalize 0.5"
:if you want to use an external program for normalization (like peter
suggested) and you are on linux, why not use sox? it is perfect for
batch (scripted!) editing of soundfiles, so you could even do this with
[shell]



mfg.asd.r
IOhannes




More information about the Pd-list mailing list