SoundLib
 
Overview
Tunes
Isdraw
Asdraw
 
Samples
 
Sources
Downloads
Javadocs
 
JavaLib
Home

Sound Library Overview

The Sound Library

The tunes library complements the isdraw and asdraw packages by allowing the programmer to play a tune (or several tunes) in response to either a tick event or a key event. Our goal is to show students how a completely different kind of information can be represented as data and how musical sequences can be composed into tunes. The isdraw and isdraw libraries extend the functionality of the earlier idraw and adraw libraries.

Each Tune is defined by the instrument that plays the tune and the chord -- a collection of notes. Notes is defined by its pitch and (optionally) its duration. The interface SoundConstants contains the names for all MIDI instruments, for the 15 instruments in the current MIDI program and mnemonics for the pitches in the middle of the piano keyboard range. The World comes with two buckets for carrying the tunes: tickTunes and keyTunes.

On each tick, the programmer adds to the tickTunes bucket the tunes that should start playing at this time. The library then starts playing these tunes, using the timer for measuring the duration of the notes.

A separate keyTunes bucket is used to play the desired tunes in response to the key press. The tune plays until the key is released.

At the end of the game (when either the endOfTime or the endOfWorld method is invoked) the final tunes in the tickTune bucket are played for a short time and then both buckets are emptied (the notes they have played are silenced and the bucket contents is cleared).


Mouse actions

In the Sound Library we added the handling of mouse actions. We expect that the mouse clicked action will be used quite often. We have not experimetned with other mouse actions: entered, dragged, pressed, released, exited. We welcome comments on this functionality and examples of the use of these events.


last updated on Wed Oct 27 17:27:07 EDT 2010generated with DrRacket