Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / icedax / pitchplay
1 #! /bin/sh
2 #
3 # Script to play audio tracks with different pitches 
4 # through a soundcard (cdda2wav must have soundcard
5 # support enabled).
6 #
7 # Pitches are specified in percentage with 100% being
8 # the original pitch, 50% being one octave lower, 200%
9 # one octave higher.
10 #
11 # based on a script from Raul Sobon, who created the pitch
12 # feature. Thanks Raul.
13 #
14 # usage: pitchplay <track a> <pitch a> <track b> <pitch b> ...
15 #
16 # example: pitchplay 1 90  3 140  5 50
17 # will play track 1 with a pitch of 90%,
18 #           track 3 with a pitch of 140%, and
19 #           track 5 with a pitch of 50%.
20 #
21 CDDA2WAV=icedax
22 #CDDA2WAVOPTS="-qeNP0 -n75"
23 CDDA2WAVOPTS="-qeNP0 -n40"
24
25 if [ $(( $# % 2 )) -eq 0 ]; then
26   while [ $# -ge 2 ]; do
27     echo playing track $1 with a pitch of $2%
28     $CDDA2WAV $CDDA2WAVOPTS -t $1 -p $2
29     RES=$?
30     if [ $RES -ne 0 ]; then
31       echo "$CDDA2WAV error, return value "$RES". Aborted." >&2
32       break
33     fi
34     shift 2
35   done
36 else
37   echo "usage: $0 [<Tracknr> <Pitch>] ..." >&2
38 fi
39