• Skip to primary navigation
  • Skip to main content

Algorithm.co.il

  • About
  • Best Posts
  • Origami
  • Older Projects

One-liner Guitar Tuner in Python

Posted on 2010-04-22 by lorg 2 Comments

Guitar

On windows, assuming imports are free:

import winsound
winsound.Beep(220*((2**(1/12.0))**7), 2000)

import winsound winsound.Beep(220*((2**(1/12.0))**7), 2000)

But that’s just because I like to tune to E. If you prefer a more “natural looking” note, you can use A:

winsound.Beep(110, 1000)

winsound.Beep(110, 1000)

But why choose at all when you can go for all of them?

[winsound.Beep(220*((2**(1/12.0))**i), 500) for i in [7, 2, -2, -7, -12, -17]]

[winsound.Beep(220*((2**(1/12.0))**i), 500) for i in [7, 2, -2, -7, -12, -17]]

Image by Keela84

Filed under: Python, Sound

Reader Interactions

Comments

  1. Inger says

    2010-04-23 at 8:45 am

    Nice! But it’s not a deaf-friendly guitar tuner as the FFT tuner you wrote a few years ago :)

    Got a new project for ya: check the influences of this one-liner on mosquitoes.

    Reply

Leave a Reply Cancel reply

© 2022 Algorithm.co.il - Algorithms, for the heck of it