From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Peter P." Newsgroups: gmane.comp.audio.sox Subject: Re: normalize across multiple files in one go? Date: Thu, 1 Dec 2016 19:50:27 +0100 Message-ID: <20161201185027.oz5hch6xb2lzopgu@fastmail.com> References: <20161130101700.ffui6s4n6ehwtteb@fastmail.com> <20161201000114.GA25817@dcvr.yhbt.net> Reply-To: sox-users@lists.sourceforge.net NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1480618253 3720 195.159.176.226 (1 Dec 2016 18:50:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2016 18:50:53 +0000 (UTC) To: sox-users@lists.sourceforge.net Original-X-From: sox-users-bounces@lists.sourceforge.net Thu Dec 01 19:50:48 2016 Return-path: Envelope-to: gcas-sox-users@gmane.org Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of fastmail.com designates 66.111.4.29 as permitted sender) client-ip=66.111.4.29; envelope-from=peterparker@fastmail.com; helo=out5-smtp.messagingengine.com; X-ME-Sender: X-Sasl-enc: VjFbNeRcV1IVWfc1zmFXfVyP0hYlWwPhPG3dVQebml8g 1480618229 Content-Disposition: inline In-Reply-To: <20161201000114.GA25817@dcvr.yhbt.net> X-Headers-End: 1cCWRH-0001lQ-DI X-BeenThere: sox-users@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: sox-users-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.comp.audio.sox:6324 Archived-At: Received: from lists.sourceforge.net ([216.34.181.88]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCWRT-00006r-DJ for gcas-sox-users@gmane.org; Thu, 01 Dec 2016 19:50:47 +0100 Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cCWRK-00081k-Uh; Thu, 01 Dec 2016 18:50:38 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1cCWRJ-00081c-1t for sox-users@lists.sourceforge.net; Thu, 01 Dec 2016 18:50:37 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1cCWRH-0001lQ-DI for sox-users@lists.sourceforge.net; Thu, 01 Dec 2016 18:50:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 107A12070D for ; Thu, 1 Dec 2016 13:50:30 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Thu, 01 Dec 2016 13:50:30 -0500 Received: from localhost (vra-172-143.tu-graz.ac.at [129.27.172.143]) by mail.messagingengine.com (Postfix) with ESMTPA id A19FB7E330 for ; Thu, 1 Dec 2016 13:50:29 -0500 (EST) * Eric Wong [2016-12-01 01:04]: > "Peter P." 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 ------------------------------------------------------------------------------