2021-07-29 00:37:35 -07:00
|
|
|
#!/usr/bin/env false
|
2015-12-11 01:06:01 -08:00
|
|
|
# awful things
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 07:26:45 -07:00
|
|
|
# YES_BASH
|
2021-09-23 06:48:05 -07:00
|
|
|
# NO_DASH
|
|
|
|
# NO_ASH
|
2015-12-11 01:06:01 -08:00
|
|
|
|
2021-07-31 21:46:41 -07:00
|
|
|
mpvs() { ### @- invoke mpv with some extra flags suited for streamed sources.
|
|
|
|
mpv --quiet \
|
|
|
|
--loop-playlist=no --no-resume-playback \
|
|
|
|
--no-sub \
|
|
|
|
--no-initial-audio-sync --mc=0.02 --autosync=30 \
|
|
|
|
"$@"
|
|
|
|
}
|
2015-12-11 01:06:01 -08:00
|
|
|
|
2021-06-19 20:28:32 -07:00
|
|
|
# Q: Why are these variables prefixed with _M_?
|
|
|
|
# A: I don't remember. :shobon:
|
2019-08-26 23:30:58 -07:00
|
|
|
_M_PRE_EMPH='equalizer=f=50:g=-10:width_type=o:w=4,equalizer=f=5000:g=+5:width_type=o:w=4'
|
|
|
|
_M_POST_EMPH='equalizer=f=50:g=+10:width_type=o:w=4,equalizer=f=5000:g=-5:width_type=o:w=4'
|
2019-06-22 14:24:11 -07:00
|
|
|
_M_COMPRESS="acompressor=threshold=0.0032:ratio=1.414:attack=17:release=640:makeup=5.5:knee=8:mix=0.8"
|
|
|
|
_M_KILL="$_M_PRE_EMPH,$_M_COMPRESS,$_M_POST_EMPH"
|
2018-08-03 20:45:41 -07:00
|
|
|
_M_MULTI="volume=10,mcompand=0.256\,2.56 9 -90/-90\,-44/-44\,0/-26.4\,20/0 80 0 -44 0 | 0.128\,1.28 9 -90/-90\,-36/-36\,0/-18\,20/0 160 0 -36 0 | 0.064\,0.64 9 -90/-90\,-37/-37\,0/-18.5\,20/0 320 0 -37 0 | 0.032\,0.32 9 -90/-90\,-38/-38\,0/-19\,20/0 640 0 -38 0 | 0.016\,0.16 9 -90/-90\,-40/-40\,0/-20\,20/0 1280 0 -40 0 | 0.008\,0.08 9 -90/-90\,-41/-41\,0/-20.5\,20/0 2560 0 -41 0 | 0.004\,0.04 9 -90/-90\,-44/-44\,0/-22\,20/0 5120 0 -44 0 | 0.002\,0.02 9 -90/-90\,-52/-52\,0/-26\,20/0 10240 0 -52 0 | 0.001\,0.01 9 -90/-90\,-60/-60\,0/-36\,20/0 20480 0 -60 0"
|
2019-08-26 23:30:58 -07:00
|
|
|
_M_MULTI2="volume=10,mcompand=0.256\,5.12 9 -90/-90\,-46/-46\,0/-18.9\,20/0 62.9 0 -46 0 | 0.128\,2.56 9 -90/-90\,-34/-34\,0/-9.7\,20/0 141.1 0 -34 0 | 0.064\,1.28 9 -90/-90\,-37/-37\,0/-10.6\,20/0 316.8 0 -37 0 | 0.032\,0.64 9 -90/-90\,-39/-39\,0/-11.1\,20/0 711.2 0 -39 0 | 0.016\,0.32 9 -90/-90\,-41/-41\,0/-11.7\,20/0 1596 0 -41 0 | 0.008\,0.16 9 -90/-90\,-46/-46\,0/-13.1\,20/0 3584 0 -46 0 | 0.004\,0.08 9 -90/-90\,-49/-49\,0/-14\,20/0 8046 0 -49 0 | 0.002\,0.04 9 -90/-90\,-58/-58\,0/-23.9\,20/0 18062 0 -58 0"
|
2019-06-22 14:24:11 -07:00
|
|
|
_M_INSANE="$_M_PRE_EMPH,acompressor=threshold=0.001:ratio=2:attack=1000:release=9000:makeup=3:knee=6:mix=0.5,acompressor=threshold=0.002:ratio=2:attack=320:release=2880:makeup=3:knee=6:mix=0.5,acompressor=threshold=0.004:ratio=2:attack=100:release=900:makeup=3:knee=6:mix=0.5,acompressor=threshold=0.008:ratio=2:attack=32:release=288:makeup=3:knee=6:mix=0.5,acompressor=threshold=0.016:ratio=2:attack=10:release=90:makeup=3:knee=6:mix=0.5,$_M_POST_EMPH,alimiter"
|
2021-06-19 20:28:32 -07:00
|
|
|
_M_LESS_INSANE="$_M_PRE_EMPH,acompressor=threshold=0.0020:ratio=1.41:attack=1000:release=9000:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0028:ratio=1.41:attack=320:release=2880:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0040:ratio=1.41:attack=100:release=900:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0057:ratio=1.41:attack=32:release=288:makeup=2.2:knee=6:mix=0.6,acompressor=threshold=0.0080:ratio=1.41:attack=10:release=90:makeup=2.2:knee=6:mix=0.6,$_M_POST_EMPH,alimiter=level_in=2.2:level_out=0.45"
|
2019-09-04 03:14:21 -07:00
|
|
|
_M_NEO="equalizer=700:o:1.3:-5,equalizer=1200:o:1.3:-3,equalizer=1090:o:0.5:-5,equalizer=970:o:1.2:-10,equalizer=4100:o:0.3:-6"
|
2021-09-22 20:19:03 -07:00
|
|
|
_M_DANNY="$_M_PRE_EMPH,alimiter,dynaudnorm=f=400:g=5:p=1:m=32:r=0.1:c=1:s=9:t=0.0003,$_M_POST_EMPH,alimiter=level_in=2.6:level_out=0.91"
|
2015-12-11 01:06:01 -08:00
|
|
|
|
|
|
|
getladspa() {
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -eq 1 "$0" "$@" || return
|
2019-06-22 14:24:11 -07:00
|
|
|
REPLY=volume
|
2015-12-11 01:06:01 -08:00
|
|
|
if [ -e "/usr/lib/ladspa/${1}.so" ]; then
|
2015-12-11 06:30:03 -08:00
|
|
|
REPLY="ladspa=f=${1}:p=${1}"
|
2015-12-11 01:06:01 -08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-12-18 18:59:30 -08:00
|
|
|
getladspa crap_level
|
2015-12-11 01:06:01 -08:00
|
|
|
_M_LEVEL="$REPLY"
|
|
|
|
|
2017-03-13 05:17:24 -07:00
|
|
|
earphones() {
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -eq 0 "$0" "$@" || return
|
2018-02-20 02:56:10 -08:00
|
|
|
_M_PROCESS="lowpass=8000:p=1,$_M_KILL,alimiter=level_out=0.707"
|
2017-03-13 05:17:24 -07:00
|
|
|
}
|
|
|
|
|
2021-09-22 20:19:03 -07:00
|
|
|
case "$(uname -n | tr A-Z a-z)" in
|
|
|
|
spectre)
|
|
|
|
_M_PROCESS="$_M_DANNY,alimiter=level_out=0.7071"
|
|
|
|
;;
|
|
|
|
|
|
|
|
neobanshee)
|
|
|
|
speakers() {
|
|
|
|
argc -eq 0 "$0" "$@" || return
|
|
|
|
_M_PROCESS="highpass=311,$_M_KILL,$_M_NEO,alimiter=level_in=2"
|
|
|
|
}
|
|
|
|
speakers
|
|
|
|
;;
|
|
|
|
|
|
|
|
banshee)
|
|
|
|
getladspa crap_eq_const_T420
|
|
|
|
_M_SPEAKERS="$REPLY"
|
|
|
|
speakers() {
|
|
|
|
argc -eq 0 "$0" "$@" || return
|
|
|
|
_M_PROCESS="$_M_LEVEL,$_M_SPEAKERS,alimiter=level_in=0.5"
|
|
|
|
}
|
|
|
|
speakers
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
_M_PROCESS="alimiter"
|
|
|
|
;;
|
|
|
|
esac
|
2021-07-21 15:30:05 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
mpv_watch() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### play some media in mpv with a bunch of unnecessary filters.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2018-08-05 18:54:50 -07:00
|
|
|
pushd ~/play >/dev/null
|
|
|
|
local url="$1"; shift
|
2019-08-26 23:31:29 -07:00
|
|
|
mpv \
|
|
|
|
--af=lavfi="[$_M_PROCESS]" \
|
2020-03-07 21:29:11 -08:00
|
|
|
--ytdl-format='[width<=1280]/best' \
|
2020-08-12 14:16:40 -07:00
|
|
|
"$@" -- "$url"
|
2018-08-05 18:54:50 -07:00
|
|
|
popd >/dev/null
|
2016-02-06 12:17:18 -08:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
mpv_stream() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### watch a stream in mpv with a bunch of unnecessary filters.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2016-11-01 15:22:38 -07:00
|
|
|
pushd ~/play >/dev/null
|
2018-08-05 18:54:50 -07:00
|
|
|
local url="$1"; shift
|
2021-08-23 04:53:13 -07:00
|
|
|
mpvs --af=lavfi="[$_M_PROCESS]" "$@" -- "$url"
|
2016-11-01 15:22:38 -07:00
|
|
|
popd >/dev/null
|
2015-12-11 01:06:01 -08:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
twitch() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### watch a twitch stream in mpv with a bunch of unnecessary filters.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2018-08-05 18:54:50 -07:00
|
|
|
local user="$1"; shift
|
|
|
|
mpv_stream "http://twitch.tv/$user" "$@"
|
2015-12-11 01:06:01 -08:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
yt() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### watch a youtube video in mpv with a bunch of unnecessary filters.
|
2021-07-30 17:57:08 -07:00
|
|
|
### this can be given a full URL or just a video ID.
|
|
|
|
### remaining arguments are passed to mpv.
|
|
|
|
### there exist several variants for more specific use cases.
|
2021-08-02 06:06:13 -07:00
|
|
|
###
|
|
|
|
### **NOTE:** there also exists a yt(1) program provided by
|
|
|
|
### the *python3-yt* package that i don't use.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2018-08-05 18:54:50 -07:00
|
|
|
local vid="$1"; shift
|
2021-07-31 21:27:31 -07:00
|
|
|
[ -e "$vid" ] || [ "$vid" != "${vid#http}" ] || vid="ytdl://$vid"
|
2018-08-05 18:54:50 -07:00
|
|
|
mpv_watch "$vid" "$@"
|
2016-03-12 09:32:57 -08:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
ytg() { ### @-
|
|
|
|
### watch a youtube video. like `yt`, but with a preference for different formats.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2020-08-12 14:16:40 -07:00
|
|
|
local vid="$1"; shift
|
|
|
|
yt "$vid" --ytdl-format=22/95/300/best "$@"
|
2017-10-06 05:33:02 -07:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
ytll() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### watch a stream from youtube in mpv, etcetera etcetera.
|
2021-07-30 17:57:08 -07:00
|
|
|
### this is the low latency version that does not support seeking.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2019-02-12 19:49:41 -08:00
|
|
|
youtube-dl -q -f best "$1" -o - | mpv_stream - --no-ytdl
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
ytgll() { ### @-
|
2021-09-22 20:19:03 -07:00
|
|
|
### watch a stream from youtube in mpv. like `ytll`, but with a preference for different formats.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2019-05-30 01:26:28 -07:00
|
|
|
youtube-dl -q -f 22/95/300/best "$1" -o - | mpv_stream - --no-ytdl
|
2019-05-26 11:54:34 -07:00
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
ai() { # @-
|
|
|
|
# hai domo!
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2017-10-05 03:12:32 -07:00
|
|
|
yt "$@" --slang=en --sub-font='Tekton Pro' --sub-bold=yes \
|
|
|
|
--sub-font-size=60 --sub-border-color='#DD6180' --sub-margin-y=52
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
asmr() { # @-
|
|
|
|
# for your aural pleasure.
|
2021-07-31 23:32:43 -07:00
|
|
|
argc -ge 1 "$0" "$@" || return
|
2019-12-20 06:27:14 -08:00
|
|
|
_M_PROCESS="acompressor=threshold=0.001:ratio=1.33:attack=900:release=6000:makeup=6:knee=8:mix=0.9,alimiter" \
|
2019-12-20 06:26:00 -08:00
|
|
|
yt "$@" --volume=90 --ytdl-format=251/300/best
|
2018-03-21 04:04:55 -07:00
|
|
|
}
|