Tune your guitar using the command-line

Posted by – November 6, 2009

Sometimes you need to get your guitar back to standard pitch, but you don't have a tuner ready. Fortunately, you can also tune with style using your linux command-line!

To use this method, first install the sox utility using your favorite package manager. Now you can issue the following command to produce a nice A:

play -n synth sine 220

Press Ctrl + c to stop the tone. Admittedly, this way of tuning requires you to use your ears, but it does the job, doesn't it? What about this one-liner:

for freq in {164.81,220,293.67,392,493.88,659.26}; do play -n synth sine $freq; done

This will give you the lower E, then an A, then a D and so on until the higher E, after which it will terminate. Press Ctrl + c every time you finish tuning a string. Ain't that nice for just one line of shell script?

Edit: brendan fahy came up with a much nicer version of the line that should work with newer versions of sox and gives an actual guitar sound:

for n in E2 A2 D3 G3 B3 E4; do play -n synth 4 pluck $n repeat 2; done

Pretty nifty, isn't it?

Did you like this solution? Do you know of an even better way to tune your guitar using the command-line? Leave a comment! And if you like this blog, why not subscribe?

7 Comments on Tune your guitar using the command-line

Respond | Trackback

  1. brendan fahy says:

    Looked interesting so I read the manpage for play, turns out there is a command in the man page that gives a much better one liner. Uses actual guitar sounds rather than sine waves.

    for n in E2 A2 D3 G3 B3 E4; do play -n synth 4 pluck $n repeat 2; done

    • admin says:

      That sure looks much nicer, thanks for posting! However, the sox version I have here doesn't seem to know the pluck synth or the 'E2'-like notation. I'll mention your version, but keep mine for backwards compatibility.

  2. Zemoth says:

    AAAAAAAAAAWWWWWWWWWWWWWW YEEEAAAAAAAAH.

    This is a bitchin' script, Thanks!

  3. [...] This post was mentioned on Twitter by John Yerhot, Tim I., Luke Triantafyllidis, stephen, stephen and others. stephen said: Tune your guitar from the command line: http://is.gd/5ho6h [...]

  4. Todd Roberts says:

    Ok this is cool. Thanks very much

  5. xteraco says:

    My guitar has been out of tune for over a year now. Used the script to tune it and jammed for a while. Brings back memories >)

Respond

Comments

Comments