normalize across multiple files in one go?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

normalize across multiple files in one go?

Peter P.
Hi,

didn't find an answer in the mailing list archives nor the web.
I am trying to normalize multiple files while keeping their relative
levels intact. Is there a way to do this with SoX in one call?

How could it be done with multiple calls (eg. analyze first, then raise
gain of all files)?

thanks for ideas!
Peter

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: normalize across multiple files in one go?

Dave Graff

Can you be more specific about what this phrase means: "normalize multiple files while keeping their relative levels intact."


What sort of "normalization" are you talking about?  Does "keeping relative levels intact" mean, e.g. that if file_A is generally louder (by some proportion) than file_B before normalization, then this is still true after normalization?


   Dave Graff



From: Peter P. <[hidden email]>
Sent: Wednesday, November 30, 2016 5:17:00 AM
To: [hidden email]
Subject: [SoX-users] normalize across multiple files in one go?
 
Hi,

didn't find an answer in the mailing list archives nor the web.
I am trying to normalize multiple files while keeping their relative
levels intact. Is there a way to do this with SoX in one call?

How could it be done with multiple calls (eg. analyze first, then raise
gain of all files)?

thanks for ideas!
Peter

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users

------------------------------------------------------------------------------

_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: normalize across multiple files in one go?

Fmiser
In reply to this post by Peter P.
> Peter wrote:

> I am trying to normalize multiple files while keeping their
> relative levels intact. Is there a way to do this with SoX in
> one call?

Hmmm.  I don't think in one call.

> How could it be done with multiple calls (eg. analyze first,
> then raise gain of all files)?


Idea 1.
wavegain can do this sort of batch process.  It calls in "album" mode -
but it is not "normalizing", rather it is calculating replay-gain.

Idea 2.
You could use soxi (or the effect "stat" or "stats") to figure out
the value for each.

Idea 3.
If the files aren't too big, may concatenate them, then figure the
normalize value for the big file, the apply that amount of gain to
each of the pieces.

The details of the last two ideas are going to be system and/or
shell dependent.  Wavegain I know works on Linux, and may compile
to other platforms, but I don't know.

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: normalize across multiple files in one go?

Eric Wong
In reply to this post by Peter P.
"Peter P." <[hidden email]> wrote:
> Hi,
>
> didn't find an answer in the mailing list archives nor the web.
> I am trying to normalize multiple files while keeping their relative
> levels intact. Is there a way to do this with SoX in one call?
>
> How could it be done with multiple calls (eg. analyze first, then raise
> gain of all files)?

Yes, I do what fmiser said for 2),

assumes no shell-unsafe chars in filenames:

# subtract some from the $PK value if you want a level below 0 dBFS
PK=$(sox $INPUT_FILES -n stats 2>&1 | awk '/^Pk lev dB/ {print($4 * -1)}')

for i in $INPUT_FILES
do
        sox $i normalized-$i gain $PK
done

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users
Reply | Threaded
Open this post in threaded view
|

Re: normalize across multiple files in one go?

Peter P.
* Eric Wong <[hidden email]> [2016-12-01 01:04]:

> "Peter P." <[hidden email]> wrote:
> > Hi,
> >
> > didn't find an answer in the mailing list archives nor the web.
> > I am trying to normalize multiple files while keeping their relative
> > levels intact. Is there a way to do this with SoX in one call?
> >
> > How could it be done with multiple calls (eg. analyze first, then raise
> > gain of all files)?
>
> Yes, I do what fmiser said for 2),
>
> assumes no shell-unsafe chars in filenames:
>
> # subtract some from the $PK value if you want a level below 0 dBFS
> PK=$(sox $INPUT_FILES -n stats 2>&1 | awk '/^Pk lev dB/ {print($4 * -1)}')
>
> for i in $INPUT_FILES
> do
> sox $i normalized-$i gain $PK
> done

Thank you Eric (and fmiser), this is a nice solution and works great!
cheers, P

------------------------------------------------------------------------------
_______________________________________________
Sox-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sox-users