hi list
I'm building a normalizer for two channel wav-files , which are recorded with [writesf~ 2] -bytes 2 . I've tried two files ( 36.4MB & 95.3MB )
36.4MB 9.54e+06 samples /Users/pd/Desktop/normalized.wav: biggest amplitude = 1.000000
the first file seems to be normalized as expected with increased volume .
95.3MB 2.49e+07 samples /Users/pd/Desktop/normalized.wav: normalizing max amplitude inf to 1
I had 95.3MB of silence after normalizing .
'normalizing max amplitude inf to 1' what does inf mean ?
I can't imagine why it's just silence . just read and write the same file with soundfiler is not a problem at all .
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 :-)
thanks in advance e
Hi Enrique,
Enrique Erne wrote:
I'm building a normalizer for two channel wav-files , which are recorded with [writesf~ 2] -bytes 2 .
I can't help you with your patch, I looks rather compicated at the first sight. But, my question is: do you really want to do these calculations in pd? I'm sure, there are some more appropriate solutions. E.g. in Matlab (you can use Octave, as well), my solution is:
x=wavread('filename'); y=x./max(max(abs(x))); % find the max. peak in any channel wavwrite(y, FS, 'newfilename'); % FS=sampling rate
br, Peter
hi peter
thanks for your suggestion .
But, my question is: do you really want to do these calculations in pd?
not necessary but as pd is my only audio tool ... ... yes
I'm sure, there are some more appropriate solutions.
yes
E.g. in Matlab (you can use Octave, as well), my solution is:
x=wavread('filename'); y=x./max(max(abs(x))); % find the max. peak in any channel wavwrite(y, FS, 'newfilename'); % FS=sampling rate
this code looks nice .
I'm still curious about 'normalizing max amplitude inf to 1'.
eni
should I just look for a sample editor ... ... no I like my pd-stuff to be pure (sick?)
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
dear list
I found some time and 'finished' my normalizer , you'll need zexy 2 [tabminmax]
thanks to iohannes for help and zexy and thanks to nico for compiling zexy for me ;-)
eni