Guitar Tutor Design

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 22: Line 22:
  
 
Initially the chart will just be a simple text file but eventually the files will be in [http://www.musicxml.org/ MusicXML] and maybe other formats will be useful. The [[Strategy|Strategy pattern]] would leave the program in a state that is easily extended in this direction.
 
Initially the chart will just be a simple text file but eventually the files will be in [http://www.musicxml.org/ MusicXML] and maybe other formats will be useful. The [[Strategy|Strategy pattern]] would leave the program in a state that is easily extended in this direction.
 +
 +
 +
 +
== Class responsibilities==
 +
 +
{|  cellpadding="5"
 +
|-valign="top"
 +
|width="15%"|'''Class Name'''
 +
|width="30%"|'''Class Responsabilities'''
 +
|width="15%"|'''Super Class'''
 +
|width="15%"|'''Collaborations'''
 +
|width="20%"|'''Notes'''
 +
 +
 +
|-valign="top"
 +
|''Instrument''
 +
|
 +
* Produce notes from input.
 +
|
 +
|''Chart''
 +
|Is the note passed to the chart for insertion when it it begins creation or after the end has been detected?
 +
 +
|-valign="top"
 +
|''Main''
 +
|
 +
* Initialise all components and create program structure.
 +
|
 +
|''Chart'', ''Instrument''
 +
|
 +
 +
|-valign="top"
 +
|''Metronome''
 +
|
 +
* Know the elapsed time,
 +
* Click for each beat.
 +
|
 +
|''Chart'', ''Instrument''
 +
|Watches system clock.
 +
The metronome is polled by ''Instrument'' when notes are created and [[Observer|observed]] by ''Chart'' so the chart is notified for each beat.
 +
Maybe a good candidate for a separate thread.
 +
 +
|-valign="top"
 +
|''Tempo''
 +
|
 +
* know the speed of the tempo,
 +
* Draw self
 +
|
 +
 +
|-valign="top"
 +
|''Bar''
 +
|
 +
* Draw Self
 +
* Add notes
 +
* Know how many beats to hold
 +
* Know type of beat
 +
* Know the next bar
 +
* Draw progress marker
 +
|
 +
|''Note''
 +
|Abstract class.
 +
|-valign="top"
 +
|''Pitch''
 +
|
 +
* Know the octave
 +
* Know the note
 +
|
 +
|
 +
| There are only a handful of notes (12) and humans can only hear ten octaves.,
 +
These two components may be represented [[flyweight]] or [[Enum idiom]]
 +
 +
|-valign="top"
 +
|''Scale''
 +
|
 +
* Know root note
 +
* Know if a note is valid for this scale
 +
|
 +
|
 +
|There are only a handful of scale types.
 +
 +
|-valign="top"
 +
|''Note''
 +
|
 +
* Draw self
 +
* know pitch
 +
* know start time
 +
* know stop time
 +
* Know validity (coloured different in interface)
 +
 +
|
 +
|''Pitch''
 +
|The word note is used in ''Pitch'' making it a bit ambiguous so a new term must be found for in ''Pitch''
 +
 +
|-valign="top"
 +
|''Chord''
 +
|
 +
* Know correct scale
 +
* Know root note ''Contained in scale? Maybe scales should be root independent.''
 +
* know notes in chord. ''This is for played chords not written chords. Does this suggest a new class?''
 +
|
 +
|"Scale'',the note component of ''Pitch''(maybe ''Tone''?)
 +
|Only using 7th, Major7th, Minor7th, Half diminished and Diminished chords this implementation
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|-valign="top"
 +
 +
|}
 +
Further Problems:
 +
 +
* What should be done about isomorphic chords, scales, notes

Revision as of 06:22, 17 September 2008

I like to play guitar and like any musician I would like to play it much better. My music theory is reasonably good so last year I did a jazz course and picked up a bit of experience playing on stage. I'm not so good at improvisation yet and so I have decided to create a tool that will help me improve . It seems like a good idea for an OO project and so here it is.

Domain Design 1

Scenarios-- Chord Chart Practice.

  • The user loads a chord chart for the song they want to practice.
  • The user presses the start button. After a short pause the program will count in two full bars then an indicator will start to scroll along the chart to mark progress in time with the tempo.
  • The user plays notes on the instrument. These notes and their duration are recorded on the chord chart . Notes are coloured one colour for correct and another for incorrect.
  • The chart is repeated X (default 3) times or until the user presses the start button a second time.


Chord charts can be of the form ABA, ABAC, ABB, etc. with repeats.

The first obvoius change is that Bar needs to be abstract with concrete classes for the first, last and intervening bars as well as a bar for the start of a repeated section and the end of a repeated section.

Chords can be of the form: Major, (Major7, Major6, Major6-9, MAJOR7#11), Dominant7, (Dominant9 Dominant13), Sus(b7), minor (minor7, minor9, minor11, minor13), Diminant#5/#9, Dominant#5/b9, Half-diminished, Diminished, augmented Major7, augmented7 and minor major7 to name a few. Not sure how to represent these yet. Maybe an enum, maybe a class hierarchy.

To implement the timing for the indicator to move across the chart a Metronome class must be introduced that will be watched by the Chart class. The Metronome class will have the Tempo and the TimeSignature to work out the Beat from. The Observer pattern might solve this timing problem.

Initially the chart will just be a simple text file but eventually the files will be in MusicXML and maybe other formats will be useful. The Strategy pattern would leave the program in a state that is easily extended in this direction.


Class responsibilities

Class Name Class Responsabilities Super Class Collaborations Notes


Instrument
  • Produce notes from input.
Chart Is the note passed to the chart for insertion when it it begins creation or after the end has been detected?
Main
  • Initialise all components and create program structure.
Chart, Instrument
Metronome
  • Know the elapsed time,
  • Click for each beat.
Chart, Instrument Watches system clock.

The metronome is polled by Instrument when notes are created and observed by Chart so the chart is notified for each beat. Maybe a good candidate for a separate thread.

Tempo
  • know the speed of the tempo,
  • Draw self
Bar
  • Draw Self
  • Add notes
  • Know how many beats to hold
  • Know type of beat
  • Know the next bar
  • Draw progress marker
Note Abstract class.
Pitch
  • Know the octave
  • Know the note
There are only a handful of notes (12) and humans can only hear ten octaves.,

These two components may be represented flyweight or Enum idiom

Scale
  • Know root note
  • Know if a note is valid for this scale
There are only a handful of scale types.
Note
  • Draw self
  • know pitch
  • know start time
  • know stop time
  • Know validity (coloured different in interface)
Pitch The word note is used in Pitch making it a bit ambiguous so a new term must be found for in Pitch
Chord
  • Know correct scale
  • Know root note Contained in scale? Maybe scales should be root independent.
  • know notes in chord. This is for played chords not written chords. Does this suggest a new class?
"Scale,the note component of Pitch(maybe Tone?) Only using 7th, Major7th, Minor7th, Half diminished and Diminished chords this implementation

Further Problems:

  • What should be done about isomorphic chords, scales, notes
Personal tools