Last active
August 29, 2016 14:49
-
-
Save mattintosh4/397dfdec989780cdad1388261f804dee to your computer and use it in GitHub Desktop.
Audio CD Tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -x | |
qaac64(){ | |
QAAC64=~/Applications/qaac_2.59/x64/qaac64.exe | |
export WINEDEBUG=fixme-all | |
wine "${QAAC64}" "${@}" | |
} | |
: ${1:?} | |
unset artist | |
unset album | |
unset disc | |
for f | |
do | |
case ${f} in | |
artist=*) | |
artist=${f#*=} | |
;; | |
album=*) | |
album=${f#*=} | |
;; | |
dis[ck]=*) | |
case ${f#*=} in | |
[1-9]) | |
disc=${f#*=} | |
;; | |
*) | |
echo disc number must be integer. | |
exit 1 | |
;; | |
esac | |
;; | |
*) | |
echo invalid argment: ${f} | |
exit 1 | |
;; | |
esac | |
done | |
: ${artist:?} | |
: ${album:?} | |
basename="${artist} - ${album}${disc:+ - DISC ${disc}}" | |
select arg in "rip" "enc" "quit" | |
do | |
case ${REPLY} in | |
q) | |
exit 0 | |
;; | |
esac | |
case ${arg} in | |
rip) | |
which cdrdao toc2cue | |
cdrdao read-cd -v 2 --read-raw --datafile "${basename}".bin "${basename}".toc | |
cp -a "${basename}".toc "${basename}".toc.orig | |
toc2cue "${basename}".toc "${basename}".cue | |
;; | |
enc) | |
which wine | |
qaac64 --check | |
qaac64 \ | |
--raw \ | |
--raw-format s16b \ | |
--text-codepage 65001 \ | |
--tvbr 127 \ | |
--quality 2 \ | |
--rate 48000 \ | |
--native-resampler=bats,127 \ | |
--artist "${artist}" \ | |
--album "${album}" \ | |
${disc:+--disk ${disc}} \ | |
--fname-format "${basename} - \${tracknumber}" \ | |
"${basename}".cue | |
;; | |
quit) | |
exit 0 | |
;; | |
esac | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
set -x | |
which sox ffmpeg | |
for f in *.cdr | |
do | |
sox -V3 --guard \ | |
--multi-threaded \ | |
--show-progress \ | |
--type cdr \ | |
--endian little \ | |
"${f}" \ | |
--bits 24 \ | |
--type raw \ | |
- \ | |
rate -v -I 96000 \ | |
compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 \ | |
| ffmpeg -y \ | |
-ac 2 \ | |
-sample_rate 96000 \ | |
-f s24le \ | |
-i - \ | |
-c:a aac \ | |
-b:a 192k \ | |
-vn \ | |
"${f%.*}".m4a | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment