3

I am currently studying at college and for my personal project I am going to create a guitar chord picking application where chords will be saved in a database (I would be using Oracle Database 11g Express Edition). The user can type the name of a chord or the notes that are associated with that chord and it will display a chord image to give a visual representation of it. I am stuck as to how the chords will be stored within a database. Would I need one table for the chord family (A, C, D, G etc.) one table for the separate notes that the chord uses and another table for all of the notes that are on a fret board? any help for this would be greatly appreciated.

My application will be developed within Android Studio. When I create the database, how would this be connected to my application?

Thanks.

Matthieu Brucher
  • 19,950
  • 6
  • 30
  • 49
  • 1
    As far as I know if you're into creating an android application, there's already SQLite that you can use. Since android apps are supposed to be light in weight, considering the fact that they are usually installed on handheld devices, using Ora DB is of no use here. Or if its a java app that you are looking to develop, you could use JDBC/ or ORM framework like Hibernate/ iBatis to obtain a connection to the specified db. – robot_alien Mar 16 '17 at 14:24
  • Coming to your query, you could associate some unique id/ name to each of the chord, and store them into the CHORD_T table, and then when you retrieve info about that chord from the db, you'd get its id, now find the associated image to that corresponding id and display it on the GUI. Notes that are on the Fret board could be considered as Templates. – robot_alien Mar 16 '17 at 14:31
  • Well my initial idea was to use SQLite but I have never used it before and thought it maybe easier to use the Oracle DB. Does SQLite work the same? How would I insert a lot of data into it, through the Android Studio interface? – Nathan Jackson Mar 16 '17 at 15:03
  • There are tools like DB viewers that help you by providing a UI where you could create a database, create tables, view data in them and do all sorts of operations even w/o having to run a query. Ex: http://sqlitebrowser.org/ – robot_alien Mar 16 '17 at 15:10

1 Answers1

3

I would do it like this:

Table 1 with semitone order mapped to notes:

0 -> C
1 -> C#
2 -> D 
3 -> D#
4 -> E
5 -> F
6 -> F#
etc.

Table 2 with chord name mapped to multiple semitones intervals:

Major -> 0
Major -> 4
Major -> 8
Minor -> 0
Minor -> 3
Minor -> 8
etc

Now you have everything you need to construct and identify chords.

Example: Find notes of D major

1) Look for the index of D to start at in Table 1, that is 2

2) Find all intervals from the major cord in Table 2, that is 0, 4 and 8.

3) Find the notes in Table 1 by adding the intervals found in Table 2, to the start index.

Like this:

2 + 0 = 2 => D,
2 + 4 = 6 => F#,
2 + 8 = 10 => A

When the result of the addition of 3 is above 11 you need to subtract 12 to get the correct note, one octave higher. When you have cords spanning over more than an octave, you either need to have two octaves in Table 1 or subtract 24 for numbers above 23.

This does not handle when to use # or b for semi tones.

If you need to visually construct where to put the fingers on the fret board, instead of only one octave of notes in Table 1, store all notes on the fret board, and in Table 2, store all indexes for all frets on the six strings to hold. In this case you would need different cord identifiers for all cords, i.e. A major, A# major etc.