Wellesley College1, Computer Science, Wellesley, MA 02481 Simon's Rock College of Bard2, Computer Science, Great Barrington, MA 01230 DePauw University3, Computer Science, Greencastle, IN 46135
The Scales Project aims to implement multimedia libraries for the beginning functional programmer in a learning environment. Previous work on this project involved the development of FUNNIE, an IDE for a subset of Haskell with some graphical support. Scales strives to expand the graphics and animation libraries of FUNNIE and evolve an audio abstraction over low level Java utilities. These libraries have the potential to be incorporated into FUNNIE or further developed into a unique IDE using Scala, our language of implementation. Scala is a multi-paradigm language that is both object-oriented and has many functional capabilities. As Scala compiles to Java byte code, each program can import and use any Java library or class. This compatibility with Java allows introductory level computer science students, familiar with object oriented languages, to have a smoother introduction to functional programming. We chose a tree-like data structure to construct the core Scales library. The node types include: animation, note, sampled clip, parallel group, and sequential group. Each node, or Step, has a duration value and is realized by a StepActor. Steps are immutable and static objects that can be shared within the tree, and each contains an act method that specifies its behavior. The StepActor will dynamically schedule each node in a priority queue to determine the correct timing and behavior of a composition. For example, parallel nodes initialize all child nodes at the same time, while sequential nodes initialize each child node in order as the previous node finishes. A tree structure allows us to apply changes to multiple steps at once. We can easily change the tempo of multiple notes in sequence, or the frames per second of several animations running in parallel. Audio library classes support both MIDI and sampled audio playback. The Note primitive maintains values for the pitch and duration in beats, while the context provides defaults for the volume, instrument, channel, and relative middle C. We provide various style sheet methods for overriding these values that allow the user to customize individual notes or entire audio passages. Users may also incorporate WAVE file playback into their audio, graphic, or animated compositions. A program can play a WAVE in its entirety, in a loop, or for a finite time period. Both notes and sampled audio can be combined in any way with each other and the other primitive nodes to create interesting and imaginative visual and audible applications. Within the graphics library, the primitive shapes are wrapper classes of their Java Swing counterparts. In addition to basic shapes, we support text and images. We wrote a graphics panel class for these shapes. The coordinates within the panel are scaled to a 100 x 100 unit window to facilitate accurate representation when the window is resized by maintaining the original proportions. Similarly, an animation node takes a function from 0 to 1 and returns a graphic. This ensures treatment of every frame as a percentage of the whole animation rather than a point in time. A change in the duration will yield the same animation but change the speed at which it is played. Static graphics are displayed with a simple animation Step without the time factor. We also use layers with transparency to run multiple animations in parallel. Scala allowed us to create real-time media using music and animation for our Scales libraries. Future work with Scales includes adding features to synthesize graphics and audio via a function from position to color for graphics, and time to amplitude for audio. We also hope to incorporate the project into the classroom environment, both through FUNNIE and its utilization in a multimedia computation course.
This work was supported by National Science Foundation Grant Number IIS-0552370
[Abstract (DOC)]