-
Notifications
You must be signed in to change notification settings - Fork 0
/
import
executable file
·41 lines (34 loc) · 999 Bytes
/
import
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
#
# Audio import handler for xwax (adapted for cmplayer)
#
# This script takes an output sample rate and filename as arguments,
# and outputs signed, little-endian, 16-bit, 2 channel audio on
# standard output. Errors to standard error.
#
# You can adjust this script yourself to customise the support for
# different file formats and codecs.
#
FILE="$1"
RATE="$2"
case "$FILE" in
*.cdaudio)
echo "Calling CD extract..." >&2
exec cdparanoia -r `cat "$FILE"` -
;;
*.mp3)
echo "Calling MP3 decoder..." >&2
exec mpg123 -q -s --rate "$RATE" --stereo "$FILE"
;;
#The output format per default is raw (headerless) linear PCM audio data, 16
#bit, stereo, host byte order (you can force mono or 8bit).
#rawpcm introduced in order to save decoding audio on the rs-pi; just headerless wav
*.$2.rawpcm)
echo "catting file...">&2
cat "$FILE"
;;
*)
echo "Calling fallback decoder..." >&2
exec ffmpeg -v 0 -i "$FILE" -f s16le -ar "$RATE" -
;;
esac