3 #=======================================================================
5 # File ID: e755fe92-820c-11e2-814c-0016d364066c
7 # Convert media files to 16 bit little endian .wav
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
27 " -n "$progname" -- "$@
")"
28 test "$?" = "0" ||
exit 1
37 -c|
--channels) opt_channels
=$2; shift 2 ;;
38 -h|
--help) opt_help
=1; shift ;;
39 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
40 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
41 --version) echo $progname $VERSION; exit 0 ;;
43 *) echo $progname: Internal error
>&2; exit 1 ;;
46 opt_verbose
=$
(($opt_verbose - $opt_quiet))
48 if test "$opt_help" = "1"; then
49 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
52 Convert media files to 16 bit little endian .wav . Works on all kinds of
53 media files that Mplayer/Mplayer2 supports.
55 Usage: $progname [options] file [files [...]]
59 -c NUM, --channels NUM
60 Use NUM channels in the resulting .wav file.
64 Be more quiet. Can be repeated to increase silence.
66 Increase level of verbosity. Can be repeated.
68 Print version information.
75 echo $progname: No files specified
>&2
79 if test -n "$opt_channels"; then
80 echo "$opt_channels" |
grep -qE '^[1-8]$' ||
{
81 echo -n $progname: Argument to
-c/--channels must be an integer
>&2
82 echo " between 1 and 8" >&2
85 chan_str
=",channels=$opt_channels"
93 cp -p "$wavfile" "$wavfile.bck"
94 mplayer
-novideo -af format
=s16le
$chan_str \
95 -ao "pcm:file=$tmpfile" "$wavfile"
96 mv "$tmpfile" "$wavfile"