Managing music and podcasts with bash scripts

Image source:

For a long time I used iTunes as the main tool for managing my music and podcasts and for syncing them up to my phone and portable media players. I was never a great fan, primarily because it tied me to using Windows on a daily basis, whereas Linux is my preferred desktop OS. Now whilst my main device was an iPhone I had no choice.

iTunes just about did the job I needed but there were aspects of it that grated. Most annoying was that it couldn’t monitor my main music directory and automatically add new media.

I recently switched to an Android phone (a Samsung Galaxy S) and this opened up alternative possibilities. It could be mounted as a plain old USB disk which meant I could manage my phone from my Linux desktop. I tested out many of the available media players and managers – Rhythmbox, Banshee, Amarok, Winamp (with wine), and Songbird – but none of them matched the full range of functionality I required. Specifically:

  • Constantly monitor my media library for new items;
  • Regularly check my podcast feeds and automatically download anything new;
  • Build playlists to a fairly specific logic (more on this later);
  • Sync a defined subset of my media to my phone.

To a greater or lesser extent all of the applications I tried were able to cover most of what I wanted but none of them could do all of it in the way I wanted it to work. After kludging along for a few weeks and jotting down my thoughts for how I wanted it to work, I decided to write a set of bash scripts to do it all for me. For those not familiar with bash scripting, it is not dissimilar in concept to the old MS-DOS batch file; a list of terminal commands.

Let’s talk in a little more detail about how I organise my playlists. For years I worked with hand crafted playlists, by album, artist, genre, etc. Then I read a great post at about an alternative way of using smart playlists. What I came up with was this set of playlists:

  • Gems – Around 300 of my favourite tracks that I always want to have available on my device. These were denoted by a rating of 4 or more stars;
  • Interesting – A random selection of around 400 tracks of the albums and artists that I particularly like. These were denoted by a rating of 3 stars;
  • Random – Somewhere in the region of 200-400 tracks plucked at random from the rest of my media library. I vary this number depending on how much space I want to leave available on the device.

One key point to note is that there are a fair number of tracks in my media library that I don’t want to listen to. Of course you could argue that I could just delete them, but I’m a bit of a completist, and it just feels wrong to have, say, all of Stevie Wonder’s Definitive Collection album but to delete “I Just Called To Say I Love You”.

I got round this by flagging all of these tracks with 1 star and then excluding them from all of the randomly selected playlists.

Ok so let us get on to the scripts that I wrote. They are;

  • CheckAndDownloadPodcasts;
  • RebuildPlaylists (which for each mp3 calls AddToPlaylist);
  • PhoneSync.

CheckAndDownloadPodcasts uses a command line utility called hpodder. The script is run every two hours using cron and does exactly what it says on the tin. In addition, one of my favourite podcasts is only available in the UK. I wanted to share this with a friend in the US so everytime a new episode is downloaded the script automatically copies it across to a shared Dropbox folder. Job done.

RebuildPlaylists is the one that really took the time. My first challenge was that, in the mp3 file’s tags (the id3 tag) there is no standard way of representing the rating value. I got round this by using an alternative field; the comment. This is free format text. I flag all of the relevant tracks with the text “gem”, “interesting”, “grim” or blank. The script then runs through the whole of my media library and adds tracks to the relevant playlist. For those that are randomised and truncated, it pipes the playlist into a “sort -R” to randomise it, then to “head -n 300” to cut it to 300 tracks.

PhoneSync uses the fantastic rsync command line utility to copy all of the tracks over to the phone (or another media device). One of the great things about rsync is that it compares source and destination and only copies the file if there are differences. My script uses the “–delete” option so that it tidies up the old tracks no longer required. For the first few weeks of use I was happily syncing just my music, until I realised that this script could do a bit more. Now it backs up all of the pictures and videos I’ve taken with my phone and syncs with a document library on my laptop, so that I can always make sure I have copies of some key documents with me, or indeed that any documents I update when I’m out and about find their way back on to my laptop.

If you want to look through my scripts in more detail you can see them below, but please be aware, they are just built for me, to work with my directory structures, with a lot of my own logic hard-coded. If you want to make use of them you’ll have to amend for your own circumstances.


#! /bin/bash
# fetch latest podcasts
hpodder fetch
# set genre to "101" for "Speech"
find /home/davmac/podcasts -name '*.mp3' -exec id3v2 -g 101 {} \;
# copy to Dropbox for Larry
find /home/davmac/podcasts -name '*joy*.mp3' -exec cp {} /home/davmac/Dropbox/DaveLarryShare \;


#! /bin/bash
# delete existing playlists
rm /home/davmac/Music/*.m3u
# find all mp3s and add to the relevant playlists
find /home/davmac/Music -name '*.mp3' -exec /home/davmac/Applications/scripts/AddToPlaylist {} \;

# sort, randomise and cutdown where relevant
cat /home/davmac/Music/gem.m3u | sort -R | head -n 300 | sort > /home/davmac/Music/gems.m3u
cat /home/davmac/Music/int.m3u | sort -R | head -n 400 | sort > /home/davmac/Music/interesting.m3u
cat /home/davmac/Music/rnd.m3u | sort -R | head -n 200 | sort > /home/davmac/Music/random.m3u
rm /home/davmac/Music/rnd.m3u
rm /home/davmac/Music/int.m3u
rm /home/davmac/Music/gem.m3u


#! /bin/bash
case `mp3info -p "%c" /"$1"` in
		echo $1 >> /home/davmac/Music/gem.m3u ;;
		echo $1 >> /home/davmac/Music/int.m3u ;;
		echo $1 >> /home/davmac/Music/rnd.m3u ;;


#! /bin/bash
if [ -d /media/867B-0D15 ] ; then
	# sync stuff from laptop to phone
	rsync -vrut --delete /home/davmac/podcasts /media/867B-0D15
	rsync -vrut --delete --files-from=/home/davmac/Music/gems.m3u / /media/867B-0D15/Music
	rsync -vrut --delete --files-from=/home/davmac/Music/interesting.m3u / /media/867B-0D15/Music
	rsync -vrut --delete --files-from=/home/davmac/Music/random.m3u / /media/867B-0D15/Music
	# sync stuff from phone to laptop
	rsync -vrut /media/867B-0D15/Documents /home/davmac/Documents/android
	rsync -vrut /media/867B-0D15/DCIM /home/davmac/Pictures/android
exit 0

The Bullmastiff: A DIY Fuzz Pedal

I’ve finished my DIY fuzz pedal based on the Roger Mayer Classic Fuzz.

I found schematics for it at Fuzz Central and based on this and this, drafted my own version.

I made two key changes to the original schematic;

  1. I found the quality of the fuzz was very sensitive to the value of the resistor that sits between the battery negative and the collector of the first transistor, so I replaced the specified 5.6k ohm resistor with a 47k pot.
  2. I had a pair of silicon transistors available and so wired these in with a DPDT mini switch that allows me to switch between the germanium and silicon transistors. Amazing the difference this makes. The germanium sounds much smoother and “creamier” whereas the the silicon transistors have a real sharp edge to them.

I used veroboard (aka stripboard) for the circuit board and here are the details of the layout, should you wish to do something similar yourself.

Review of the Benford Custom – A Telecaster/Les Paul Hybrid


I’ve had the Benford Lestercaster a couple of weeks now and am in a better position to write up a more considered review than my babbling initial impressions.

Here I’m just going to try to discuss the guitar itself, rather than the extras that were included in the package, or the service that Steve Benford offered.

Benford Custom

Design and construction

The basic idea for the guitar was to build a Les Paul Studio that looked like a Telecaster. For the look, I wanted something sparse and classy that was just a mixture of plain satin finished wood and black hardware.

So it has a set/glued neck, 24.75″ scale length, tune-o-matic bridge and stop tail piece. Like the Les Paul, the neck is set at an angle of a couple of degrees to the body so that it clears the higher bridge.

The body wood is a piece of London Plane, a type of lacewood. The neck is mahogany. Fingerboard and headstock veneer are ebony.

Benford Custom


OK, let’s get it out of the case and pick out some of the details…

The black logo on the ebony headstock looks superb. Very understated. This was a touch Steve added without asking and just fits in perfectly with my aesthetic sensibilities. The finishing on the neck pocket and heel is just astounding – totally flawless – as is the finishing of the fingerboard and frets. A couple of other details of note are the countersunk controls and the two tail-end strap buttons. These were specified by me, but the execution of my ideas is exactly as I conceived them. The two tail-end strap buttons mean that the guitar will securely stand up against a wall or amp, but also gives the guitar a better balance when strapped on. Only a very minor point, but the upper bout strap button is placed about an inch too high for my preference. The matt black EMG-style covers on the Seymour Duncan P-Rails pickups complete the plain and simple look.

Unplugged sound

As is traditional in a guitar review, let’s give it a strum before plugging it in. First impressions are that it sounds very lively; almost jangly. I had expected a darker/warmer nature to the tone, and this was quite a surpise – not a bad one – just different to expectation. As you would expect with a set neck and high quality materials, the sustain is phenomenal. The only guitar I’ve ever played with more sustain was a thru-neck Westone Thunder (a very under-rated piece of kit itself).

Benford Custom

Plugged sound

I’d originally planned to go for plain old PAF humbucking pickups, although I did toy with the idea of P90s. When I mentioned this to Steve he pointed me in the direction of Seymour Duncan’s P-Rails. This is a pickup that combines a Fender-esque single coil, with a P90, that also gives series and parallel humbucker wiring options. The wiring scheme, taken directly from the Seymour Duncan website, offers an amazing range of sounds with a minimum of complexity. And from an aesthetical point of view, with no more than a pickup selector switch and two knobs, because I wanted to stay close to the Telecaster control layout.

It is a fairly traditional pickup selector, master volume and master tone, that’ll be familiar to anyone who has picked up a telecaster. The volume and tone pots each have push/pull switches and in combination to the work of selecting which of the pickup coils are used:

  • Both down – Humbucker with coils wired in series;
  • Volume down, Tone up – P90;
  • Volume up, Tone down – Single coil;
  • Both up – Humbucker with coils wired in parallel.

There are a couple of limitations with this wiring scheme:

  • No independent volume or tone for each pickup;
  • Not able to select different pickup type configs for neck and bridge at the same time, so, for example, it can’t do a bridge single coil plus neck series humbucker.

I preferred to accept this limitation rather than have additional mini-switches on the front.

When I had been thinking about using traditional PAF humbuckers, I briefly considered using concentric stacked volume and tone pots, so that I could put in a Les Paul type control scheme, but keep the look of the Telecaster.

The actual sound? Oh rest assured I’m absolutely delighted. It is such a versatile guitar. It can handle anything from razor sharp C&W twang with the bridge single coil to creamy PAF-esque jazz tones with the neck series humbucker – with almost every stop in between these two extremes. At the sharp end it is easily a match for my Telecaster although having this biting sound but still with the incredible sustain takes some getting used to.

Personal favourites are:

  • The bridge series humbucker through my wee valve amp with everything turned up to 10;
  • Neck humbucker through a clean amp for a warm, but still very clear and distinct, jazzy tone;
  • Neck and bridge P90s with the amp up full but the guitar’s volume rolled back just so it is on the verge of break up.

It is amazing how much difference the scale length makes to the feel of the guitar and it is taking quite a while to “recalibrate” my fingers. Bending strings is so much easier, without the string feeling “flappy”, even to the point where I can now do a whole tone bend on the A and D strings with my pinkie. This does have a downside because, on a more frequently used bend like a whole tone on the G string with my ring finger, I’ve now got a tendency to over-shoot and go too sharp. This is not just about the scale length though. The ultra smooth finishing of the frets has a big effect too.

One thing I may change eventually is the fret height. I specified Dunlop 6130 fretwire and whist the width of the fret wire is perfect, it is a fair bit higher than I’d thought it would be. This is not an issue above the 7th fret, but below that it shows up a flaw in my technique: my inclination to press the string down harder than is needed. If I hold a chord shape, say an open A, as I would normally, then as I press the string to the fretboard it is pulling the fretted notes sharp. Perhaps it is just going to require more personal “recalibration” and an improvement in my technique, so I’ll give it a few more months before I go for the more radical solution of getting the frets stoned flatter.

Benford Custom

The neck profile itself is a thing of beauty, and I’m not quite sure how Steve has achieved this. It feels both substantial and slim at the same time. Fast and solid and some bizarre hybrid of a classic baseball bat and Ibanez shredder’s neck. I think it is a combination of a fairly conservative depth (note the small “C” – real Conservatives are much thicker) and a slight “V” profile, although I don’t think the profile, in section, is symetrical. If forced to guess I’d say that the bass side of the neck is slightly rounder, and the treble side flatter. This no more than deduction on my behalf because I can think of no other way a neck could feel this substantial under the thumb and yet so fluid under the fingers. Of course the immaculate gentle satin finish also adds a massive amount to the neck feel.

For the first time since the Benford arrived, I picked up my Telecaster over the weekend. Despite this previously being one of the most playable necks I’d ever encountered, I was shocked by how hard it was to play in comparison to the Benford. The glossy laquer on neck and fingerboard just felt sticky and unpleasant. Way to go Steve – you’ve just ruined some of my favourite guitars for me!


As you can probably tell from the above, I’m a hugely satisfied customer. Just considering the intrument alone; if I’d walked into a guitar shop and bought this thing off the hook for under £830, I’d have considered that I’d got a damn good deal. When you add in all of the extras, the joy of designing it (with help and advice), the fact that it is a totally one-off original, the superb craftsmanship/care that has gone into every aspect of the build, I feel like I’ve walked away with the bargain of the century.

Benford Custom


Demo of the amp with VVR installed

Just recorded a short-ish snippet on a digital camera, using the in-built mic, while I was testing the VVR installation. Not one for the audiophiles!

It’s the Benford Lestercaster straight into the amp. The amp’s plugged into the 12″ speaker in my Roland Cube 100 combo. The volume is fairly low and, if you listen carefully you can hear the TV from the next room.

Installing Variable Voltage Regulator (VVR) in a valve amp

As I mentioned in an earlier post, just for noodling about at home without disturbing my family and neighbours, the 5 watt SE-5a valve amp is just a bit loud.

This is not a problem when I’m playing clean tones, the SE-5a is just a perfect amp for that. It took a little experimentation and I found that at low levels on the master volume the sound was a bit thin and lacking in warmth, even on a neck humbucker, if you whack the master volume right up and control the level at the guitar, you can get a fantastic tone even at low volumes.

The problem comes when you’re after that crunch – just as the power valves are starting to lose the battle with what you’re asking them to do – is the sound I love and the SE-5a delivers this in spades. Trouble is to get that sweet spot you need to gain and the master volume both up around 7 or 8, with the guitar volume up full. This is just too loud for “normal” home use.

I investigated a number of options for solving this:

  • an attenuator which sits between amp and speaker and soaks up the power;
  • switching to a less powerful output valve like the 6n1p which will deliver around 1 watt, or even using half the valve to give around 0.5 watt;
  • variable voltage regulation (aka VVR) which reduces the DC voltage powering the valves, allowing them to overload at lower volume.

I know a lot of guitarists like the sound when the speakers too are right at the limit of their capabilities. Obviously none of the solutions I talked about above would solve this. In my circumstances it is not an issue because, with two 75 watt Eminence Legends, the amp, even at full whack, never comes close to pushing the speakers.

After a lot of research, and advice from Barry at, I decided to go with the last of these options and Barry recommended I contact Dana Hall at

I ordered a VVR kit from Dana and, because the SE-5a is a cathode biased amp, I was able to buy the simple (and cheaper) version.

Fitting the kit is relatively simple, but I did put a lot of effort into looking at the schematic of the SE-5a and the schematics and instructions supplied by Dana beforehand, and planned out in detail exactly what I was going to do.

Here are the key install decisions I made:

  • I was going to apply the VVR to the whole amp. It is possible to apply it just to the power valves, leaving the pre-amp untouched. There are pros and cons of each approach and not being sure which would suit me best I chose the easier install;
  • I wasn’t going to mount the MOSFET on to the VVR PCB, because it would limit the placement options. The MOSFET can get warm and needs a good contact to the chassis, or a heat sink, to dissipate this. By running three wires from PCB to MOSFET it gave me a wider choice about where to put it;
  • I was going to install the VVR in place of the master volume. As I mentioned above, the best sound is when it is turned up full anyway. Once I can use the VVR to control the overall amp volume, the master volume is essentially obsolete. I did think about drilling a new hole in the front panel or getting a combined on/off/standby switch to replace the two current switches, leaving a spare hole for the VVR, but again, in the pursuit of simplicity, decided against either of these options (which would also have involved re-labelling the front panel too).

The install steps were:

  • Prepped my work area and grabbed all the relevant tools and prints of all the instructions, schematics, sketches and my original build log;
  • Took the amp out of the combo enclosure and tested the voltage across all of the key exposed parts to check I wasn’t about to kill myself;
  • Soldered five wires on to the board. Three for the MOSFET, one for the input to the VVR and one for the ground connection, then soldered the MOSFET to the three wires, then quickly unsoldered the MOSFET, turned it round and put it on the right way (NB: the picture below is the wrong way round). I kept to the red and black standard colours for the input and ground, but must have had a reggae themed mindset as I went for red, gold and green for the MOSFET;


  • I took the master volume control out of the front panel, turned it up to max, and cable tied it into a small plastic bag. Long term the pot will get removed/bypassed but I didn’t want to do this until I had the VVR working, and the plastic bag was to stop it shorting out on anything whilst it wasn’t fastened down;


  • Desoldered the output from the standby switch and attached this wire to the output of the VVR;
  • Attached the new wire from the VVR input to the recently vacated solder tag on the standby switch;
  • Soldered the VVR’s ground wire to the ground tag right next to the master volume;
  • There’s an unused 3mm hole right next to the power transformer which coincidentally matches the 3mm mounting hole in the MOSFET, so I bolted it down to this making sure that the thin plastic insulator sits between MOSFET and chassis;
  • Mounted the VVR pot and PCB into the vacated master volume hole;


  • Turned the VVR up to full and, with the valves out, went through the test measurements from the original SE-5a build guide and compared the new readings to my original record;
  • Turned the VVR down to min to observe the reduction in voltages across the big capacitors and… bollocks… they were exactly the same as when it was turned up to max. Back to the drawing board…
  • With my updated sketch of the schematic, I used a highlighter pen to trace the actual connections against the logical picture of the schematic (i.e. comparing how it was wired with how it should be wired);
  • I quickly discovered that I’d taken the wrong wire off the standby switch for the input to the VVR. It took a matter of seconds to switch them over and retesting showed it was all working as I’d expected;
  • Valves back in, another quick test to see nothing had changed and plug the guitar in.
  • I played for about an hour and kept checking to see that the MOSFET wasn’t overheating

So how does it work? To be frank I’m astounded by how successful it is. I can now get exactly the right tone and level of crunch that I’m after, using the gain/TMB controls and then with the VVR, pick the volume I want. The tone stays remarkably consistent from 10 down to about 3. Any lower than 3 and, whilst the sound itself stays true, you can start to hear the unamplified guitar (particularly in the treble register) over the amp itself. I’d read that a couple of people had a noise problem after installing the VVR, but I had no such issue, and the amp remains very quiet and hum free.

As I lay in bed, after completing this I couldn’t help but wonder why all valve amps don’t have this. It really is so simple and so effective I can’t, as yet, see a downside.

I left two jobs outstanding which finished up over the weekend:

  1. Removed the master volume pot, which was as simple as taking the wire that came from the centre lug of the master volume and attaching it to the centre lug of the treble pot, and snipping the other wires;
  2. Some slight changes to the pre-amp circuit because at low levels on the VVR it pushes a little bit of DC back through to the guitar which makes the guitar’s volume control slightly scratchy. It takes a couple of extra capacitors and an extra 1M resistor to sort this out. Dana recommended 0.1uF and this works fine for me. So the last steps to finish the job off are;
    • Desolder resistor and centre of shielded cable from lug 1 of input jack
    • Solder 0.1uF capacitor to lug 1 of input jack
    • Solder resistor from lug 4 and centre of shielded cable to other end of capacitor
    • Insert 0.1uF capacitor between lug 2 of the gain pot and the existing wire from lug 2, and add 1M resistor between this wire and lug 3 of gain.

    Here’s a before/after sketch, which I scribbled down, to plan out what I was going to do.

    Pre amp changes
    [click to enlarge]

A great source of guitar news

If you like keeping up with the latest news on guitars and guitarists then I’d recommend that you head over to Guitar News Daily. You can also subscribe to the feed and get it delivered straight into your feed reader.

And in the interests of full disclosure, I do occasionally contribute there myself, so if you come across any guitar related news that the world needs to know about, don’t hesitate to drop me a line (or leave a comment here).