-
Notifications
You must be signed in to change notification settings - Fork 2
/
bpmdjraw
executable file
·80 lines (70 loc) · 3 KB
/
bpmdjraw
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#
# BpmDj: Free Dj Tools
# Copyright (C) 2001-2011 Werner Van Belle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
songname="$2"
songlocation=$songname
rawname=$1"`basename "$2"`.raw"
extension=${songname##*.}
#echo "BPMDJ-RAW arguments"
#echo LOCATION = $songlocation
#echo RAWNAME = $rawname
#echo EXTENSION = $extension
#echo DECODER = $DECODER
# if the raw filename already exists, don't write it
(test -f "$rawname") && exit 0;
# the song must exist
(! (test -f "$songlocation") ) && songlocation=music/"$songlocation" \
&& (! (test -f "$songlocation") ) && exit 2;
#____________________________________________________________
# DECODER 1: mpg123 decoder
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if test $DECODER = "1"; then
echo "Information: decoder is mpg123"
mpg123 -r 44100 --stereo -s "$songlocation" >"$rawname" ;
#____________________________________________________________
# DECODER 2: mpg321 decoder
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elif test $DECODER = "2"; then
echo "Information: decoder is mpg321"
mpg321 -s "$songlocation" >"$rawname";
#____________________________________________________________
# DECODER 3: ogg123 decoder
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elif test $DECODER = "3"; then
echo "Information: decoder is ogg123"
ogg123 --audio-buffer 0 -q -d raw -f "$rawname" "$songlocation";
#____________________________________________________________
# DECODER 4: mplayer 1.0pre6-3.3.5 decoder
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elif test $DECODER = "4"; then
echo "Information: decoder is mplayer 1.0pre6"
mplayer "$songlocation" -ao pcm -aofile "$rawname" -af resample=44100 -vo null -quiet;
#____________________________________________________________
# DECODER 5: mplayer 1.0pre7-3.3.5 decoder
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
elif test $DECODER = "5"; then
echo "Information: decoder is mplayer 1.0pre7"
# the pre7 release is somewhat troubling because it seems unable to
# use a resmapling filter of the same freq as the normal data format
mplayer "$songlocation" -ao pcm:file="$rawname" -af resample=44100 -vo null -quiet;
(test -f "$rawname") && exit 0;
mplayer "$songlocation" -ao pcm:file="$rawname" -vo null -quiet;
fi
(test -f "$rawname") && exit 0;
exit 1