How to Loop Part of a Song

Maybe you are trying to learn how to play a song, or perhaps you are studying another language. Whatever the case, this is what I do to loop part of a media file:

  1. Create a new file and make it executable:

    touch loop; chmod loop +x

  2. Using a text editor, insert the following into the newly created file:
    while true; do
    mplayer -ss 00:00:30 file.mp3 &
    sleep 30
    killall mplayer

  3. Run the file by typing “./loop” When you are finished, press Ctrl-C

Later I found out that the VLC media player has this feature built-in. Simply enable the “Advanced Controls” in the view menu. One of the buttons has a small “A” and a small “B.” Then, define the two points and it will continuously loop that portion of the file:

VLC Advanced Control Set

This entry was posted in Computers. Bookmark the permalink.