-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaudio-split-by-cue
More file actions
executable file
·42 lines (28 loc) · 868 Bytes
/
audio-split-by-cue
File metadata and controls
executable file
·42 lines (28 loc) · 868 Bytes
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/bash
# Split an album audio file into several tracks using a cue file
source bash-helpers
audio_file_path=${1?Specify audio file}
wd=$(dirname $audio_file_path)
audio_file=$(basename $audio_file_path)
audio_file_prefix=$(filename $audio_file)
audio_file_type=$(extension $audio_file)
cue_file=$2
cd "$wd"
if [[ ! "$cue_file" ]] ; then
cue_file=$(filename $audio_file).cue
cue_file=$(echo $cue_file | perl -pe 's/\.(ogg|flac|ape)//g')
fi
cue_file=$(abs $cue_file)
INFO "Splitting file $audio_file via cue $cue_file"
if [[ ! -f "$cue_file" ]] ; then
DIE "Cue file not found: $cue_file"
fi
if [[ $audio_file_type = .ogg ]] ; then
oggsplt -c $cue_file $audio_file
elif [[ $audio_file_type = .mp3 ]] ; then
mp3splt -c $cue_file $audio_file
else
DIE "Don't know how to split $audio_file_type files"
fi
rm $audio_file
INFO "Done"