From dbff4183176768bbd9e0d4a4488fbe3aedc450e3 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Mon, 13 Apr 2015 22:29:12 -0700 Subject: [PATCH] why am i doing this --- home/-shrc | 9 ++++++--- sh/compandy | 13 ++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/home/-shrc b/home/-shrc index 716a468..dac825d 100644 --- a/home/-shrc +++ b/home/-shrc @@ -105,14 +105,17 @@ function trash() { . ~/sh/z/z.sh MPV_STREAM_FLAGS="--quiet --no-sub" -LIVESTREAMER_FLAGS="" +[ -e "$HOME/sh/compandy" ] && _MPV_COMPAND="$(~/sh/compandy -30 10 1 140 6 18 1)" +_MPV_LAPTOP='--af=lavfi=[aformat=channel_layouts=stereo,'"$_MPV_COMPAND"',lowpass=f=1000:p=1,lowpass=f=4000:p=2]' + if [[ "$(uname -n)" != "banshee" ]]; then MPV_STREAM_FLAGS="$MPV_STREAM_FLAGS --vo=opengl:swapinterval=0" else - _COMPAND="$(~/sh/compandy 1 140 -30 10 6 18 1)" - MPV_STREAM_FLAGS="$MPV_STREAM_FLAGS "'--af=lavfi=\"aformat=channel_layouts=stereo,'"$_COMPAND"',lowpass=f=1000:p=1,lowpass=f=4000:p=2\"' + MPV_STREAM_FLAGS="$MPV_STREAM_FLAGS $_MPV_LAPTOP" fi +LIVESTREAMER_FLAGS="" + twitch(){ livestreamer "twitch.tv/$1" best -p mpv $LIVESTREAMER_FLAGS -a \ "$MPV_STREAM_FLAGS ${2:+--autofit=}${2:-} {filename}" diff --git a/sh/compandy b/sh/compandy index 3ea3f37..b20a229 100755 --- a/sh/compandy +++ b/sh/compandy @@ -2,20 +2,19 @@ # script to make sense of compand's parameters compandy() { if [ $# -eq 0 ]; then - echo -E "usage: $0 {attack} {release} {threshold} {ratio} [knee] [gain] [delay]" + echo -E "usage: $0 {threshold} {ratio} [attack] [release] [knee] [gain] [delay]" return 1 fi - local atk="${1}" rel="${2}" - local thresh="${3}" ratio="${4}" + local thresh="${1:-10}" ratio="${2:-2}" + local atk="${3:-1}" rel="${4:-100}" local knee="${5:-1}" gain="${6:-0}" delay="${7:-0}" let 'atk/=1000.' let 'rel/=1000.' let 'delay/=1000.' local end= start= let 'end=thresh - thresh/(ratio + 0.0)' - local start=$thresh - printf "compand=%.5f|%.5f:%.5f|%.5f:%.1f/%.1f|0/%.2f:%.2f:%.2f:%.1f" \ - $atk $atk $rel $rel $thresh $thresh $end $knee $gain $start - #echo "compand=$atk|$atk:$rel|$rel:$thresh/$thresh|0/$end:$knee:$gain:$start:$delay" + let 'start=thresh' + printf "compand=%.5f|%.5f:%.5f|%.5f:%.1f/%.1f|0/%.2f:%.2f:%.2f:%.1f:%.5f" \ + $atk $atk $rel $rel $thresh $thresh $end $knee $gain $start $delay } compandy "$@"