TamTam:Source Code Overview

From OLPC
Revision as of 22:09, 11 January 2007 by Xavi (talk | contribs) (re-categorization)
Jump to navigation Jump to search

Introduction

  • 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

Generation is the main musical feature of TamTam. It's a collection of algorithms that generate and vary rythm patterns, polyphony and melodies. The goal is to build the algorithms in a manner that we can generate a lot of musical styles with few parameters. X-class noise generators and other processes like Markov chains, random walks and weighted probability choices are used to expand the range of possibilities offered by the algorithms. The users will be abble to apply generation and variation algorithms on a small section or on an entire piece.

Generation as a main class (Generator) which uses others classes like Drunk, Markov and some home made functions stored in the file Utils.

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.

  • 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.

The others files consist of csound orchestras that are loaded into csound at the openning of TamTam. These orchestras play soundfiles or synthesized sounds. Soundfiles can be played with or without crossfaded loops, the latter allowing long durations even with short samples. Synthesis instruments like frequency modulation (FM), some economical physical models and substractive synthesis will be implemented, with an interface for control parameters. TamTam will also make it possible for users to build their own instruments. Orchestra files receive playback messages with arguments to control pitch, amplitude, duration, panning, reverb send, and other effects independently for each notes.

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.