Date: Tue, 4 Jan 2011 11:57:35 +0300 From: Peter Vereshagin <peter@vereshagin.org> To: freebsd-questions@freebsd.org Subject: Re: randomising tracks: scripting question Message-ID: <20110104085734.GC5302@external.screwed.box> In-Reply-To: <20110104042338.GA29930@shell.eskimo.com> References: <20101226170930.GA68817@orange.esperance-linux.co.uk> <20110104042338.GA29930@shell.eskimo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
You know St. Peter won't call my name, freebsd-questions!
2011/01/03 20:23:38 -0800 Joseph Olatt <joji@eskimo.com> => To Frank Shute :
JO> On Sun, Dec 26, 2010 at 05:09:30PM +0000, Frank Shute wrote:
JO> >
JO> > I generally play my tracks of an album like so:
JO> >
JO> > for track in $(cat trombone_shorty-backatown.m3u); do
JO> > mplayer $track
JO> > done
JO> >
JO> > They then play in the correct order.
JO> >
JO> > How would I go about randomising the order of play using
JO> > sh (preferably) or perl?
I have several tens of thousands of MIDI files from 90s. They are too many for 'random play' feature of the Timidity++ which is used with 'eawpats', the GUS patches.
Here is my bash script to play them in random order:
===
#!/usr/local/bin/bash
IFS='
'
fns=(`find ~/mid/ -iname '*.mid'`)
while :; do
timidity -a -OdS -in -j -t 1251 -E t -p a -R 500 -EFreverb=127 -EFns=4 ${fns[$((${#fns[@]}*$RANDOM/32767))]}
done
===
Of course I miss the 'Previous track' functionality.
73! Peter pgp: A0E26627 (4A42 6841 2871 5EA7 52AB 12F8 0CE1 4AAC A0E2 6627)
--
http://vereshagin.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110104085734.GC5302>
