sox-users@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
* Multi Band Processor
@ 2021-04-11  3:47 Robert Jeffares
  2021-04-18 18:50 ` Dr. Thomas Tensi
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Jeffares @ 2021-04-11  3:47 UTC (permalink / raw)
  To: sox-users


[-- Attachment #1.1: Type: text/plain, Size: 3273 bytes --]

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


[-- Attachment #1.2: Type: text/html, Size: 8984 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-02 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11  3:47 Multi Band Processor Robert Jeffares
2021-04-18 18:50 ` Dr. Thomas Tensi
2021-04-19 21:52   ` Robert Jeffares
2021-04-20 13:54     ` Dr. Thomas Tensi
2021-05-02 15:14       ` SoX Plugins for DAWs Dr. Thomas Tensi

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).