Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created December 5, 2014 11:16
Show Gist options
  • Save coderofsalvation/24721097737d6da5259d to your computer and use it in GitHub Desktop.
Save coderofsalvation/24721097737d6da5259d to your computer and use it in GitHub Desktop.
soxmasterhouse fft maximizer
#
# bashmasteraudio configuration file
#
# probably only I and god know what these params are for.
# but at least you now know somebody actually used this tool :D
# fftdelaycompensation
# formula = (window_size+2*hopsize)/sr (got this from csound forum)
FFTSIZE=2048; # 128,512,1024,2048 or 4096
(( HOPSIZE = (FFTSIZE/4) )) # calculate overlap/hopsize
SHIFT_SAMPLES="$( echo "($FFTSIZE+(2*$HOPSIZE))" | bc )s"
FFT_GAIN=-5 # volume of transientsmear of side
INPUTGAIN_MID=+13 # boost mid (will be limited by 0)
INPUTGAIN_SIDE=-14
SIDE_KICK_FREQ=90 # boost sub in side (I know this is not done)
SIDE_KICK_GAIN=10 # boost sub in side (I know this is not done)
SIDE_BITCRUSH=27838
[[ -f /usr/lib/ladspa ]] && export LADSPA_PATH="/usr/lib/ladspa"
[[ ! -f /usr/lib/ladspa/csladspa.so ]] && echo "please install csladspa (csound)"
ln -fs /usr/lib/ladspa/csladspa.so maximizefft/csound/.
process_pre(){
input="$1"; output="$2"; echo "preprocessing"
GAINL="2.5" ../lib/balanceLR "$input" "$output"
}
process_mid(){
input="$1"; output="$2"; echo "processing mid of M/S"
# aplay "$input" -d 2s # uncomment this to preview the dry mid-channel
sox "$input" "$output" gain $INPUTGAIN_MID gain -l 0 norm && cp "$output" "$input"
}
process_side(){
input="$1"; output="$2"; echo "processing side of M/S"
#aplay "$input" -d 1s # uncomment this to preview the dry mid-channel
# add boost in high *and* low (I know this is not done)
sox "$input" "$output" treble +10 equalizer $SIDE_KICK_FREQ 0.8 $SIDE_KICK_GAIN && mv "$output" "$input"
# add decimator limiter
sox "$input" "$output" gain $INPUTGAIN_SIDE gain -l 0 ; cp "$output" "$input"
}
process_post(){
input="$1"; output="$2"; echo "post processing "
# sox "$input" -c 1 "$output"
# smear transients (bass)
sox "$input" "$output" norm gain -20
lame -b 10 "$output" "$output.mp3"
lame --decode "$output.mp3" "$output.low.wav"
play "$output.low.wav" gain -10
# delay compensation + mix
# sox "$output.fft.wav" "$output.fft.compensate.wav" trim $SHIFT_SAMPLES
#sox -m "$input" "$output.fft.compensate.wav" "$output"
return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment