TamTam:Source Code Overview

From OLPC
Revision as of 20:54, 2 August 2006 by Wood (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

TamTam Source Code Overview

  • TamTam is being implemented in Python using PyGTK.
  • The source repository can be found here
  • Past, present and future development tasks can be found here [Coming soon...]
  • At the highest level, TamTam is divided into two components: Framework and GUI. Framework is TamTam's underlying engine, while GUI is the Graphical User Interface to this engine. A description of these components follows.

Framework

This component handles everything from music generation to Csound communication. It knows nothing about the GUI, so no GTK imports here! Framework consists of three subcomponents: Core, CSound and Generation.

Core

Core is the foundation the rest of the Framework sits on. It consists of three classes: Event, EventPlayer and TrackPlayer.

  • Event is an abstract base class for elements that can be "played" at a specific point in time. Subclasses must implement the play() method. Currently, Event has one subclass: Framework.CSound.CSoundNote. In the future, we envision a fuller class hierarchy here, with subclasses that play Csound synthesis notes, audio files, etc.
  • EventPlayer handles the timing involved in playing a collection of Events.
  • TrackPlayer is a subclass of EventPlayer. It handles grouping Events into "Tracks", and uses the inherited functionality of EventPlayer to play the Tracks' notes.

Generation

  • [Coming soon...]

CSound

CSound encapsulates everything that is required to play sounds using Csound. It consists of three classes: CSoundNote, CSoundClient and CSoundServer, in addition to other files [coming soon...]

  • CSoundNote is a subclass of Framework.Core.Event. It contains information about the note it represents such as pitch, duration, etc. CSoundNote's play() method generates a Csound message and sends it to CSoundClient for playback.
  • CSoundClient maintains a connection with CSoundServer, and acts as a proxy thereto. CSoundNotes send messages to CSoundClient, which forwards them to CSoundServer.
  • CSoundServer listens for messages from clients, and sends them to Csound.
    • Many thanks to Simon Schampijer for this component!
    • TamTam currently launches its own instance of CSoundServer. Eventually, however, this will be handled by the system.

GUI

GUI is separated into two subcomponents: Core and Generation.

Core

Core contains graphical elements that display information encapsulated by the classes in Framework.Core. Some elements allow users to modify this information as well. Descriptions of these elements follow.

  • MainWindow is a gtk.Window subclass, this is TamTam's main window.
  • TrackView is used to display and edit the contents of a track. TrackView maintains a collection of NoteViews.
  • NoteView is used to display and edit a note (currently a Framework.CSound.CSoundNote).
  • BackgroundView displays the background of the TrackViews, including the border, which acts as a selection indicator.
  • PositionIndicator is used to display and edit the current playback position.

Several TrackViews, a BackgroundView and a PositionIndicator are contained in a gtk.Fixed container maintained by MainWindow.

Generation

Generation contains graphical elements that are specific to the Framework.Generation component. Currently, it consists of the GenerationParametersWindow class. GUI.Generation will evolve alongside Framework.Generation.

  • GenerationParametersWindow is a gtk.Window subclass that allows the user to specify parameters for algorithmic generation.