From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6130 216.105.38.0/24 X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 6DC311F4B4 for ; Sun, 11 Apr 2021 03:47:48 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1lVR4R-0000wq-5j; Sun, 11 Apr 2021 03:47:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVR4H-0000w8-FM for sox-users@lists.sourceforge.net; Sun, 11 Apr 2021 03:47:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Date:Message-ID:Subject: From:To:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8iPFVYGr4q7A8L2VTrURY94xpOHmlW2f8n2UdWObOhM=; b=SWlBEReokhwGYRD4K8pzNS9eZE /+5WrE0gWTW83EEbMG2XalLolZRpWVkEFNon5nD3hdekG7gTw6YDlaJTBxFJeybPXbSHoSnP0MXM0 rBj9pP+077LYGGLSpeHk+1ygV+MuED81oIknsEO26Ks4qVDrVlR8t9cOrvLekIX8XK+w=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:Date:Message-ID:Subject:From:To:Sender:Reply-To :Cc:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=8iPFVYGr4q7A8L2VTrURY94xpOHmlW2f8n2UdWObOhM=; b=d hfIB4S1uOU6zSrO1lhpkB4HQ3wPIQ/s+maQhIkUcSl1Iu9gnyLbGBN2VoedMvUj21Oq34nrtidq92 Sv2AWrrZi92Bq84t5WHBx4ec915/qWCoyc3H0F7Gfrp6cSMe4iFeEWPTTkF1GTNkJ6eZRe9inNoBD i/0nNlsgfMhD2uRA=; Received: from mail-pg1-f179.google.com ([209.85.215.179]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1lVR47-001wmA-GK for sox-users@lists.sourceforge.net; Sun, 11 Apr 2021 03:47:23 +0000 Received: by mail-pg1-f179.google.com with SMTP id z16so6793365pga.1 for ; Sat, 10 Apr 2021 20:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=8iPFVYGr4q7A8L2VTrURY94xpOHmlW2f8n2UdWObOhM=; b=luJhq5J5wGa3UnYn3KWC01F6mS1KIm8oV9uixPyNQLeR6H8nvZDl8NifZC6ct3KIJF jAPKxBICBqeisHgwugq04eTcSs4PJ2+P82kFHnjDAef32t/RMRQc8L3OgdO2CJ2JR9Gt 343MTKk7kP8o8xrNzdupU7LXGhilOGP+LHJIaabmJyF2CAMHGPaKVlnHiSEMdNDV1bYI BxGkve/hn1NIWVRmhHZ1NHn4DK8FMpzIJcBhtJygijnChUxsXbvVxRxIfybszSnVW3pR axtUbFjGWCKKsy8lPr60ku2pTsTm5SRWKMKamd6WCTpvrYM3fAAB6HE5ljxW4Oi+K4CG AuGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=8iPFVYGr4q7A8L2VTrURY94xpOHmlW2f8n2UdWObOhM=; b=C5dB57bNgatHRtJaqRXMM0rc0OGb+dbFElDnXHKPa/CitPQXsmFIQ00YAbTLpvxKhV 9kUkji14iUmL2KvNOPgShRKCEi4aPe/QcmGMljcMU+pjiu4nIs/Em7HtO0tGob5Vd7kz T17uYgqvWhQZt5M5RKU7xcCw+ls4hY6wsYzuyRN3FLTtB+TAn6IE17KWW58duV9q0xmX uMkP+CY4y1gmCMug/yA8T83VldXo6OFSGbAtHsMPyDIe4hK6njoBh21SoE6lK9tdQasi N7/rlbjvnrSrGUP5x0Yv91+mR3Q1mSUAPJG0pfkAfOLy7++qMpy0ADfoixVAz0J9qX/2 aVZg== X-Gm-Message-State: AOAM530KKaS8RqMIMF4w6b/oXehjHQKt9KKBFF1HCxXFUy6mz8UxH4mH LwMvFxYxQbGicEbH45kGbPQM9MptKgk= X-Google-Smtp-Source: ABdhPJwdKpoDhkPbG7IbKAVNIm32qZsXnmJjELtgG5C1wxqIur3MG2AYyFsVT52jsQdWktGcsu25Ag== X-Received: by 2002:a63:5626:: with SMTP id k38mr21577702pgb.128.1618112829798; Sat, 10 Apr 2021 20:47:09 -0700 (PDT) Received: from [192.168.1.106] ([103.8.142.247]) by smtp.gmail.com with ESMTPSA id w4sm6554738pjk.55.2021.04.10.20.47.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Apr 2021 20:47:09 -0700 (PDT) To: sox-users@lists.sourceforge.net From: Robert Jeffares Message-ID: Date: Sun, 11 Apr 2021 15:47:05 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Language: en-US X-Headers-End: 1lVR47-001wmA-GK Subject: Multi Band Processor X-BeenThere: sox-users@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sox-users@lists.sourceforge.net Content-Type: multipart/mixed; boundary="===============3196608083280153403==" Errors-To: sox-users-bounces@lists.sourceforge.net This is a multi-part message in MIME format. --===============3196608083280153403== Content-Type: multipart/alternative; boundary="------------5AE65A7E4AE0BE122D0E8992" Content-Language: en-US This is a multi-part message in MIME format. --------------5AE65A7E4AE0BE122D0E8992 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi all, I spent a very long time trying to get the multi band processor shown in man sox to work. It seems the manual is older then the code which has changed. I needed a processor that would take audio from various not so great sources, adjust the dynamic range to suit a talk radio stream, and try and correct the frequency balance. One source consistently has poor room acoustics. Another has levels that vary wildly and a range of audio frequency bandwidths. compand works as advertised. Perhaps not that clearly. mcompand does not work as implied. It does some of what mcompand does but not all. The manual could do with a makeover. Happy to help but I only know what the code does by trial and error so there may be stuff in there I have missed. This code works, and I share it in the interest of others in like situations looking for a sledge hammer to fix bad audio or a way to try and make the audio sound consistent. This is a SPEECH processor. Do not use it for music! I would encourage comments suggestions and improvements. I also have sox putting an intro and outro on the processed audio using splice so that items are produced complete. This is just the processing engine. ============================ snip ====================================== #! /bin/bash # the delay option is not available when mcompand is called by sox # doing this as a function makes it easy to switch on and off function bandmod { sox -V leveled.wav mcompanded.wav mcompand\ "$f1_process" $f1_crossover\ "$f2_process" $f2_crossover\ "$f3_process" $f3_crossover\ "$f4_process" $f4_crossover\ "$f5_process" $f5_crossover\ "$f6_process" $f6_crossover\ "0,0.8 -38,-38,-28,-28,-0,-6" gain 10 highpass 22 highpass 22 sinc -n 255 -b 16 -12000 } # set up band pass processing #first band f1_crossover='120' f1_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -21 -15' # attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]] #second band f2_crossover='360' f2_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15' #third band f3_crossover='1080' f3_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15' #fourth band f4_crossover='3240' f4_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -19' #fifth band f5_crossover='5000' f5_process='0,2.0 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -24 -19' #sixth band f6_crossover='10000' f6_process='0,1.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -48 -19' #for next loop makes it easy to set up for multiple files for i in $1 do #take spaces out of filename newfile=$(mv "$i" "${i// /}") #now work with new name #get the filename for later use filename=$(basename $1) echo $filename filename="${filename%.*}" echo $filename # lets get the dynamic range sorted before band processing # files are processed as wav so there is no loss of quality sox -V $newfile leveled.wav compand 0,1.2 -60.1,-inf,-60,-160,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -18 -6 sleep 2 bandmod # the processed audio replaces the original audio mv mcompanded.wav $filename.wav rm leveled.wav done exit 0 ============================ snip ====================================== regards Robert --------------5AE65A7E4AE0BE122D0E8992 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit

Hi all,

I spent a very long time trying to get the multi band processor shown in man sox to work.

It seems the manual is older then the code which has changed.

I needed a processor that would take audio from various not so great sources, adjust the dynamic range to suit a talk radio stream, and try and correct the frequency balance. One source consistently has poor room acoustics. Another has levels that vary wildly and a range of audio frequency bandwidths.

compand works as advertised. Perhaps not that clearly.

mcompand does not work as implied. It does some of what mcompand does but not all.

The manual could do with a makeover. Happy to help but I only know what the code does by trial and error so there may be stuff in there I have missed.

This code works, and I share it in the interest of others in like situations looking for a sledge hammer to fix bad audio or a way to try and make the audio sound consistent. This is a SPEECH processor. Do not use it for music!

I would encourage comments suggestions and improvements.

I also have sox putting an intro and outro on the processed audio using splice so that items are produced complete. This is just the processing engine.


============================ snip ======================================

#! /bin/bash


# the delay option is not available when mcompand is called by sox

# doing this as a function makes it easy to switch on and off

function bandmod {

sox -V leveled.wav mcompanded.wav mcompand\

"$f1_process" $f1_crossover\

"$f2_process" $f2_crossover\

"$f3_process" $f3_crossover\

"$f4_process" $f4_crossover\

"$f5_process" $f5_crossover\

"$f6_process" $f6_crossover\

"0,0.8 -38,-38,-28,-28,-0,-6" gain 10 highpass 22 highpass 22 sinc -n 255 -b 16 -12000

}



# set up band pass processing


#first band

f1_crossover='120'

f1_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -21 -15'

# attack1,decay1{,attack2,decay2} [soft-knee-dB:]in-dB1[,out-dB1]{,in-dB2,out-dB2} [gain [initial-volume-dB [delay]]]


#second band

f2_crossover='360'

f2_process='0,0.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15'


#third band

f3_crossover='1080'

f3_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -15'


#fourth band

f4_crossover='3240'

f4_process='0,1.2 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -9 -19'


#fifth band

f5_crossover='5000'

f5_process='0,2.0 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -24 -19'


#sixth band

f6_crossover='10000'

f6_process='0,1.8 -60,-60,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -48 -19'


#for next loop makes it easy to set up for multiple files

for i in $1

do

#take spaces out of filename

newfile=$(mv "$i" "${i// /}")

#now work with new name

#get the filename for later use

filename=$(basename $1)

echo $filename

filename="${filename%.*}"

echo $filename

# lets get the dynamic range sorted before band processing

# files are processed as wav so there is no loss of quality

sox -V $newfile leveled.wav compand 0,1.2 -60.1,-inf,-60,-160,-48,-24,-24,-6,-12,-1.5,-6,-0.3 -18 -6

sleep 2


bandmod


# the processed audio replaces the original audio

mv mcompanded.wav $filename.wav

rm leveled.wav

done


exit 0


============================ snip ======================================



regards

Robert

--------------5AE65A7E4AE0BE122D0E8992-- --===============3196608083280153403== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============3196608083280153403== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Sox-users mailing list Sox-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-users --===============3196608083280153403==--