The idea of this python challenge is to write a python program to help guitar players learn and practise new songs.
Our program will read all the chords used in a song and display and animate a visual representation/chart of the chord being played.
First, let’s recap what are the main chords when playing the guitar:
The code appearing underneath each chord indicates the position of the fingers as described on each chart. With this code:
- “x” means the string is not played,
- “0” means the string played as an open string,
- a number tells you which fret to place your finger on.
The following python code makes use of different data structures:
- chords is a dictionary where each chord (e.g. C) if given a “fret notation” such as “x32010”
- songChords is a list containing all the chords used in the given song
The subroutine displayChord() takes one parameter, the name of the chord (e.g. “C”) and displays the chart for this chord. e.g.
Your Challenge #1
You can improve this challenge by adding more chords to the dictionary.
You can then add your own songs to this code and let the user decide which songs they would like to visualise.
You can use websites such as www.ultimate-guitar.com to find all he chords with their “fret notation” used in wide range of songs.
Your Challenge #2
How could you improve this code further to display the lyrics alongside the chords being played?