1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-01 23:43:07 -07:00
rc/sh/compandy

24 lines
719 B
Plaintext
Raw Normal View History

2015-04-13 18:09:11 -07:00
#!/usr/bin/zsh
2021-07-29 00:37:35 -07:00
# YES_ZSH
2015-04-13 18:09:11 -07:00
# script to make sense of compand's parameters
2021-07-29 00:37:35 -07:00
2015-04-13 18:09:11 -07:00
compandy() {
if [ $# -eq 0 ]; then
2015-04-13 22:29:12 -07:00
echo -E "usage: $0 {threshold} {ratio} [attack] [release] [knee] [gain] [delay]"
2015-04-13 18:09:11 -07:00
return 1
fi
2015-04-13 22:29:12 -07:00
local thresh="${1:-10}" ratio="${2:-2}"
local atk="${3:-1}" rel="${4:-100}"
2015-04-13 18:09:11 -07:00
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)'
2015-04-13 22:29:12 -07:00
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
2015-04-13 18:09:11 -07:00
}
2021-07-29 00:37:35 -07:00
[ "${SOURCING:-0}" -gt 0 ] || compandy "$@"