Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Sunday, April 10th, 2011, 6:47 am

How to Play Audio (Sub)Segments Repeatedly

Yesterday 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.

Technical Notes About Comments

Comments may include corrections, additions, citations, expressions of consent or even disagreements. They should preferably remain on topic.

Moderation: All genuine comments will be added. If your comment does not appear immediately (a rarity), it awaits moderation as it contained a sensitive word or a URI.

Trackbacks: The URI to TrackBack this entry is:

https://schestowitz.com/Weblog/archives/2011/04/10/mplayer-and-bash/trackback/

Syndication: RSS feed for comments on this post RSS 2

    See also: What are feeds?, Local Feeds

Comments format: Line and paragraph breaks are automatic, E-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Back to top

Retrieval statistics: 21 queries taking a total of 0.112 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|