Sunday, April 10th, 2011, 6:47 am
How to Play Audio (Sub)Segments Repeatedly
esterday I dumped visual media players — a decision that I stand up for at least for now — instead using more flexible scripts to play just particular parts of songs/tracks that I enjoy, even repeatedly. I use mplayer
and bash
to do the heavy lifting. This is handy when good segments, e.g. one part of a long concert, need to be isolated. Segments like these are usually to be found in very large files, which can be found either by name:
find -type f | grep PATTERN
To isolate large tracks (by file size), use something like:
find . -type f -size +{10000}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
$ find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
The self-explanatory shell script to write would look something like
mplayer /media/disk-8/Music/volO/AugMix.mp3 -ss 0:20:0 & sleep 600 killall mplayer mplayer /media/disk-8/Music/volJ/concert.ogg -ss 0:35:0 & sleep 200 killall mplayer
Enjoy.