Get the latest version of randomplay as a tarball (v0.60, released 10/15/06).

Randomplay is a command-line based shuffle music player that remembers songs between sessions.Randomplay plays your music collection (or execute any arbitrary commands on any arbitrary filetypes) in random order, remembering songs played across sessions. It also has many features to make command-line music playing more convenient, including recursive regexp searching for tracks and the ability to specify a certain number of tracks, bytes, or minutes to play. Randomplay will also generate a list of music files to be loaded onto a portable music player device. It includes a ‘random weighting’ feature, so your favorite songs are more likely to come up in the random shuffle.Randomplay is a convenient tool for the user who does everything in an xterm window or console and is constantly devising complex find/grep/sed command lines to play just the right set of songs.

Following are some example invocations of randomplay to give a general sense of its flexibility; see the manpage for more complete information:

Play all ogg files in dir1 and dir2 under your home directory, and dir3 under the base directory specified in ~/.randomplayrc, which have not been played for 15 days in random order with 5 seconds between songs:

randomplay --days=15 --pause=5 --player ogg=ogg123 ~/dir1 ~/dir2 =dir3

Play all ogg, wav, and mp3 files under the current directory (or base directory, if specified in .randomplayrc file) which have not been played for 10 days in alphabetical order, switch the ‘skip to next song’ keystroke to ‘G’ or ‘g’ and ‘quit’ to ‘q’ or ‘c’:

randomplay --norandom --key next=Gg --key quit=qc

Play all files under the current directory with the strings “frisell” and “bill” in the filename, in any order, (saves having to hunt down a file in a hierarchy), ignore whether the file has been played recently, but stop playing after 15 minutes:

 randomplay --regexp 'frisell bill' -0 --maxtime=15m

Display 100M worth of music files, randomly sorted, without recording the history of tracks, using the default music directory (or the current directory if not specified):

randomplay --maxsize=100M --noremember --names-only

Play the last 10 songs played over again:

randomplay --last=10

Play songs test.ogg, test2.ogg, test3.ogg, and all files in musicdir in random order without weighting preferred songs:

randomplay --noweight test.ogg test2.ogg test3.ogg musicdir

Copy 128M of songs into a Neuros Audio Player, using positron:

positron add `randomplay --names-only --maxsize=128M`

Pick a random jpeg or png file that has not been displayed in the last week from the ‘images’ directory and display it with ImageMagick ‘display’ command:

randomplay --player jpg=display --player gif=display --days 7 ~/images

randomplay is listed on freshmeat.net.

You can download randomplay as a Debian package, or get it directly from the Debian archive.

You can take a look at randomplay, the main script, with nice highlighting, also see the changelog.


  1. Jim Morrison Jan 28

    Where is the rc file documented?

  2. Adam Rosi-Kessel Jan 28

    The rc file is not separately documented, but it is described in the manpage under DESCRIPTION. It says:

    All options can also be kept in ~/.randomplayrc, with one option
    per line, option name followed by a space followed by the option value. Command line settings will o
    verride settings specified in ~/.randomplayrc; later settings will override earlier settings.

    There is also a small sample randomplayrc file included in the package. I could, perhaps, set out a separate section in the manpage or README with a more detailed description of randomplayrc.

  3. Bruno Engelmann Jan 28

    Thanks, this is just what I’ve been looking for. Any chance of an option to play all songs from a random album in order of track numbers?

  4. Adam Rosi-Kessel Jan 28

    Bruno: that’s definitely a great idea. I’ll try to implement it in the next month or two. One question would be how the track memory would work in that case–if a track from an album had already been played in the last x days, would it still play the album? Would it skip that track? Etc.. It might be that the “random album order” feature would just be orthogonal to the “random memory” feature.

  5. sylvan aka sdb Jan 28

    Great stuff! Just discovered ‘randomplay’.

    Feature idea, parse ‘.m3u’ style playlists. That might also suffice as a first-pass on the stored index idea as well. For example, I use a little shell script which generates ‘allsubs.m3u’ in every parent (not leaf) directory. If I could pass that playlist to randomplay, it would not need to traverse the dir structure.

  6. slystone Jul 3

    great script :)
    what about adding more file formats? ex: FLAC, APE, WV.

    xmms plays them very well..

  7. adam Jul 3

    Slystone: you can configure the script to play any format you want by altering the config file. Just look at the sample randomplayrc for examples.

  8. slystone Jul 5

    Am I the only one with high cpu usage? (70%-90%, AMD Barton 2500)

  9. ben.wing Sep 19

    I’ve been doing some hacking to “improve” the console display to my preferences. I can post my updates to you somewhere if you’re interested.

  1. randomplay 0.60 released | Substantially Similar

Leave a Reply

(Markdown Syntax Permitted)