Version 13, last updated by uniquesnowflake8 at Apr 27 09:11 2009 UTC

Architecture

ArchitectureVersionThree

Here is a scattered doc of the augmented architecture I showed today. (It's a really rough draft, but the ideas are there.) -- Travis Apr. 21

Here is a diagram of how things fit together.

Front End

GUI

  • Contains many widgets, as described below.

Controller

  • Provides callbacks to update the interface. If the interface change affects the model, it communicates with the application.

FluidSynth

  • Given signals, produces audio output.

Core

Application

  • Loads static data: MusicianDirectory, InstrumentTree, and SoundFileMap.
  • Notifies the conductor when an instrument is added or updated.
  • Updates SongInfo when the user changes it.
  • Tells SongControl if playback has paused or unpaused.

SongControl

  • Keeps a tight loop of audio playback:
    • Tells Parser to parse the current StaffSubMeasure
    • Tells Conductor to fill the next StaffSubMeasure
    • Old = Current
    • Current = Next
    • NextStaffMeasure.SongInfo is set to SongInfo if this is the last StaffSubMeasure (this includes tempo, key, time signature)
    • Wait out the duration of Old, then repeat
  • Reads from Score, passes Score data on to Conductor and Parser for composition and output, respectively.
  • This module is responsible for a responsive feel by keeping the Conductor and Parser just barely separated.

Parser

  • Sends note signals to FluidSynth from a StaffSubMeasure note list.

Conductor

  • Adds, removes, and updates musicians in the Ensemble.
  • When given a StaffSubMeasure, assigns each Musician a SubMeasure to fill with notes, one at a time.

Conductor (edit)

  • Adds, removes, and updates Musicians
  • Tasks Musicians with generating music by SubMeasure

Model

Ensemble

  • List of Musicians.

Musician

  • Has List of Instruments.
  • Generates notes for a SubMeasure.
  • References InstrumentTree to learn "is-a" information about Instrument.

Musician (edit)

  • Delegates making of music to attached Instrument
  • Checks result for correctness
  • Capable of learning

Instrument

  • A simple (string?) identifier for a type of musical instrument that is a node in InstrumentTree.

Instrument (edit)

  • Generates notes for a SubMeasure.

SongInfo

  • Tempo
  • Key
  • Time Signature
  • Redundant, because SongControl updates each StaffMeasure with this info. Kept separate to decouple components.

Score

  • Contains StaffMeasures

Staff Measure

  • A vertical division of a score. Contains all the measures at a given time interval (what you see if you look down instead of across a score sheet).
  • Contains StaffSubMeasures
  • Contains SongInfo
  • Contains Instrument

StaffSubMeasure

  • Contains SubMeasures

SubMeasure

  • Contains Notes

Note

  • Velocity
  • Duration (quarter note, half note....)
  • Tone
  • Other characteristics....

Static Data

MusicianDirectory

  • Mainly used by the InstrumentSelector to filter Instruments
  • Loaded by the application on startup

InstrumentTree

  • Hierarchical classification of Instruments, to lookup the parents of a given Instrument.
  • Used by Musician to understand an unknown Instrument.
  • Loaded by the application on startup

SoundFileMap

  • Maps Instruments to their respective voice or sound file, i.e. SoundFont
  • Loaded by the application on startup



List of widgets

id parent callback description type
mainPanel -- -- The parent of all widgets panel
canvas mainPanel draw() Fills the mainPanel canvas
addInstrumentButton canvas onClick: revealInstrumentSelector() '+' image button
menuBar mainPanel -- -- menuBar
fileMenuLabel menuBar onClick: revealFileMenu()   label
editMenuLanel menuBar onClick: revealEditMenu()   label
fileMenu menuBar

'New': 'Are you sure?' && reset()

'Save': 

Exit: quit()

contains New/Save/Exit options menu
editMenu menuBar

'Undo': undo()

'Redo': redo()

contains Undo/Redo menu
instrumentSelectionPanel canvas -- contains Instrument Selector panel
instrumenSelectionButtonPanel instrumentSelectionPanel
 -- contains filter buttons  panel 
filterButton   instrumenSelectionButtonPanel  filterList(buttonValue) changes what is shown in instrument list  button 
instrumentSelectionList   instrumentSelectionPanel

 onDrag (listItem): draws Instrument widget under user's cursor

onRelease(listItem, position): add Instrument to canvas at position, add instrument to ensemble.

   listView
 instrumentWidgetPanel canvas   onDrag: updatePosition(position)  The movable instrument widget container. panel
 instrumentIcon  instrumentWidgetPanel  -- Image representing the instrument.  img 
 instrumentLabel instrumentWidgetPanel   -- The name of the instrument.  label 
 menuToggleButton instrumentWidgetPanel  showInstrumentOptions(id) Reveals the instrument-specific options in a separate display.   button
 advancedViewButton canvas  revealAdvancedOptions()  Turns on hidden key signature and time signature options.  button 
 advancedViewButtonPanel canvas  --  Contains key sig. and time sig. buttons  buttonPanel 
keySignatureButton advancedViewButtonPanel  revealKeySignatureSelector()   button 

timeSignatureButton

advancedViewButtonPanel   revealTimeSignatureSelector()   button
keySignatureSelector canvas updateKey(key, maj_min)   Contains choices for keys, sharps, and maj/min, as separate button panels which I am not enumerating at the moment. buttonPanel 
timeSignatureSelector canvas  updateTimeSignature(num, denom)  Contains two horizontal selectors with all supported options. Not enumerated at the moment.

 panel

 

trashCan     Drag here to delete an instrument. Shows a list of recently deleted.