Introduction: Guitar Tuner

Often stringed instruments go out of tune due to regular use. In this Instructable, we are going to build a gadget that you can use to re-tune your instrument.

You'll need following to complete this build:

  • Intel Edison with Arduino breakout board
  • USB sound card
  • A microphone and a speaker
  • Grove base shield with button and LCD module

There are two modes of operation

  1. Visual mode
    • In visual mode, you set a target frequency and play the note on your instrument as soon as the target note set is detected, the LCD back light will turn blue from red and also estimated note is displayed on the LCD.
  2. Audio mode
    • This mode is for seasoned musicians. In this mode, a reference note is played back continuously which can be used as a reference to tune your stringed instrument.

Step 1: Configuring Edison

First thing to do is to setup the USB audio card. To connect the USB sound card, you'll need to move the switch near the USB port towards the USB host port as in the attached picture. In this mode, you will have to power the base board with a DC power supply adapter (7V-15V, I used the power adapter that came with Intel Galileo Gen2) .

In the Linux console (refer to this getting started guide if you want to know how you can gain access to the Linux console), type the following command:

aplay -l

Note down by what name your device got recognized. In my setup as "U0xd8c0x13c".

Open up the file "/etc/asound.conf" for editing using "vi"

vi /etc/asound.conf

Press 'i' to start editing the file and enter the following text with replaced by your actual USB audio card name.

pcm.!default sysdefault:<your_device_name>

In my case, that would be:

pcm.!default sysdefault:U0xd8c0x13c

This should setup the audio card. To test if your USB audio card gets used as the default audio card, connect external speaker or headphone to the USB sound card. When you execute the following command you should hear some one speak:

aplay /usr/share/sounds/alsa/Front_Center.wav

Now that the audio card is setup, you'll have to install the port audio.

wget http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz
tar zxvf pa_stable_v19_20140130.tgz
cd portaudio/
./configure
make
make install

Step 2: Hardware Connection

There are only two connections to make on the Grove base shield:

  • Button -- Port D6
  • LCD -- I2C

Connect a microphone to the mic in of the sound card and an externally powered speaker to sound out of the USB sound card.

Step 3: Using the Application

You need to install git on your Edison to proceed with this step.

Follow this page to add new repos.

Add git from the repo

opkg update
opkg install git

Follow these instructions to install the tuner application:

git clone https://github.com/navin-bhaskar/GuitarTuner_EdisonGalileo.git tuner
cd tuner
make

This should build the tuner application. Start the application by typing the following command:

./tuner

Setting the target note:

The target note is the note to which you want to tune your instrument to. A single click of the button cycles the notes from "C" through "B" and back again. For example if the target note is "C", a click advances it to "C#" (C sharp or B flat).

There are two modes of operation for this device:

  • Visual mode:
    • In visual mode, as soon as the target note is detected, the LCD back light changes to blue and also the estimated note is displayed on the LCD
  • Audio mode:
    • You enter audio mode by long press of the button. The audio mode is exited with single button click
    • In this mode, the selected target note is played back in a loop which can be used as a reference for tuning your instrument

You can exit the application any time by hitting "ctrl-c".

This application uses a digital low pass filter to cutoff high frequency noise. On your system if you have installed scipy, then you can use the supplied "filter.py" to generate filter parameters for your needs by changing the cutoff frequency, Fc. Additionally, you might want to increase the order(set to 2 in script), for better performance of the filter but this comes at a performance penalty.

If the application fails with "Invalid sampling rate" then the default sampling rate used by this application is not supported by your audio card. In that case, you'll have to first check for the supported sampling rates for your device.

You can run the following command to know what sampling rates are supported:

cat /proc/asound/card2/stream0

Check for "rates" filed and note it down.

Note that in the above command, I know my sound card is card2 from the "aplay -l" output.

Change the sampling rate in "config.h" line 8 using vi.

vi config.h

Navigate to line 8 and replace the number in "#define SAMPLING_RATE (your_sampling_rate)".

Comments

author
brosati (author)2016-09-28

credit where credit is due. amazing build. my criticism would be that this is the equivalent of climbing everest for a cup of ice. a good tuner is about $25 and as big as a lighter.

author
edwallace (author)2016-05-12

Incredible...

author
rgamble2 (author)2015-10-14

this should be called "how to make a crazy expensive tone generator"

author
NavinB (author)rgamble22015-10-14

May be I should.
But this is not what I want to achieve with this setup.
This is the first step for me learn some DSP stuff and grow this to some DSP audio processor.

author
NavinB (author)NavinB2015-11-11

Hi rgamble2,

This is what I was talking of:

https://www.instructables.com/id/Effecter-A-simple-guitar-effects-processor/

About This Instructable

3,931views

80favorites

License:

More by NavinB:Random news reader on the Linkit smart 7688Effecter: A simple guitar effects processorGuitar Tuner
Add instructable to: