EVR.include("level/map/Display.js");
EVR.Level.Map = function(level)
{
   EVR.Graphic.call(
      this, level.road, null, null, ALIGN_TOP_RIGHT, level.road.container);
   this.level = level;
   this.register = level.register;
   this.height = this.level.register.get_dimensions(true)[1];
   this.build();
   this.append();
   this.display = new EVR.Level.Map.Display(this, this.level);
}
EVR.Level.Map.prototype = new EVR.Graphic;
EVR.Level.Map.prototype.build = function()
{
   var level = this.level;
   var register = this.register;
   this.set_color(level.background);
   this.css.borderTop = register.css.borderTop;
}
EVR.Level.Map.prototype.shape = function()
{
   EVR.Graphic.prototype.shape.call(this);
   var dimensions = this.register.get_dimensions();
   var width = this.container.get_dimensions()[0] - dimensions[0];
   this.set_dimensions(width, dimensions[1]);
}
EVR.Level.Map.prototype.place = function(x, y)
{
   EVR.Graphic.prototype.place.call(this);
   var y = this.register.get_coordinates()[1];
   this.set_coordinates([null, y]);
}
EVR.Level.Map.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   !!this.display && this.display.draw();
}
EVR.Level.Map.prototype.advance_player = function(ii)
{
   this.display.advance_player(ii);
}
EVR.Level.Map.prototype.advance_ghost = function(ii)
{
   this.display.advance_ghost(ii);
}
EVR.Level.Map.prototype.get_player_position = function()
{
   return this.display.get_player_position();
}
EVR.Level.Map.prototype.hide_ghost_indicator = function()
{
   this.display.hide_ghost_indicator();
}
EVR.Level.Map.prototype.toString = function()
{
   return "[object EVR.Level.Map]";
}
EVR.Level.Map.Indicator = function(display, opacity)
{
   this.display = display;
   this.cells = display.row.cells;
   this.border_width = INDICATOR_BORDER_WIDTH;
   this.current = -1;
   this.opacity = opacity;
   this.attached = false;
   this.build_outer();
   this.build_inner();
   this.draw();
}
EVR.Level.Map.Indicator.prototype.build_outer = function()
{
   var element = document.createElement("div");
   var cell = this.cells[0];
   var css = element.style;
   css.width = "100%";
   css.background = INDICATOR_BORDER_COLOR;
   css.position = "relative";
   css.opacity = this.opacity;
   css.fontSize = "0px";
   this.element = element;
}
EVR.Level.Map.Indicator.prototype.build_inner = function()
{
   var element = document.createElement("div");
   var css = element.style;
   css.background = INDICATOR_COLOR;
   css.position = "relative";
   css.width = "100%";
   css.top = this.border_width;
   css.fontSize = "0px";
   this.element.appendChild(element);
   this.inner = element;
}
EVR.Level.Map.Indicator.prototype.draw = function(height)
{
   if (height == null)
   {
      height = this.cells[0].clientHeight;
   }
   height -= 2;
   this.element.style.height = height;
   this.inner.style.height = height - this.border_width * 2;
}
EVR.Level.Map.Indicator.prototype.advance = function(ii)
{
   this.current = ii;
   this.append();
}
EVR.Level.Map.Indicator.prototype.append = function()
{
   this.cells[this.current].appendChild(this.element);
   this.attached = true;
}
EVR.Level.Map.Indicator.prototype.remove = function()
{
   if (this.attached)
   {
      this.cells[this.current].removeChild(this.element);
      this.attached = false;
   }
}
EVR.Level.Map.Indicator.prototype.get_position = function()
{
   return this.current;
}
EVR.Level.Map.Indicator.prototype.toString = function()
{
   return "[object EVR.Level.Map.Indicator]";
}
EVR.Level.Records = function(level)
{
   EVR.Table.call(this, level.road, "1%", "100%");
   this.level = level;
   this.history = level.history;
   this.colors = RECORDS_COLORS;
   this.sizes = RECORDS_FONT_SIZES;
   this.lengths = RECORDS_TIER_LENGTHS;
   this.element.style.textAlign = "center";
   this.texts = [];
   this.new_entry_added = false;
   this.set_times();
   this.display();
   this.append();
}
EVR.Level.Records.prototype = new EVR.Table;
EVR.Level.Records.prototype.set_times = function()
{
   this.times = this.history.get_times().sort(this.compare_times);
}
EVR.Level.Records.prototype.compare_times = function(x, y)
{
   if (x.get() < y.get())
   {
      return -1;
   }
   if (x.get() > y.get())
   {
      return 1;
   }
   return 0;
}
EVR.Level.Records.prototype.display = function()
{
   this.insert_rows();
   var times = this.times;
   this.display_first_tier(times.slice(0, 1)[0]);
   this.display_second_tier(times.slice(1, 3));
   this.display_third_tier(times.slice(3));
}
EVR.Level.Records.prototype.insert_rows = function()
{
   var count = this.lengths[2];
   for (var ii = 0; ii < count; ii++)
   {
      var row = this.insert_row();
      if (ii != count - 1)
      {
	 row.style.height = 100 / count + "%";
      }
   }
}
EVR.Level.Records.prototype.display_first_tier = function(time)
{
   var row = this.get_rows()[0];
   var cell = this.insert_cell(row);
   this.fill_cell(cell, time, 0, this.lengths[2]);
}
EVR.Level.Records.prototype.fill_cell = function(cell, time, index, span)
{
   if (!!span)
   {
      cell.rowSpan = span;
   }
   if (!!!time)
   {
      time = RECORDS_BLANK_TIME_TEXT;
   }
   var color = this.determine_font_color(time);
   var font = RECORDS_FONT_FAMILY;
   var size = this.determine_size(index);
   var string = time.toString(RECORDS_PRECISION);
   var container = this.level.container;
   var text = new EVR.Text(cell, string, font, color, size, container);
   this.style_cell(cell, index);
   this.texts.push(text);
}
EVR.Level.Records.prototype.determine_font_color = function(time)
{
   var newest = this.history.get_newest().time;
   if (time instanceof EVR.Time)
   {
      if (!this.new_entry_added && newest.get() == time.get())
      {
	 this.new_entry_added = true;
	 return RECORDS_NEW_FONT_COLOR;
      }
   }
   return RECORDS_FONT_COLOR;
}
EVR.Level.Records.prototype.determine_size = function(index)
{
   var sizes = this.sizes;
   if (index < 1)
   {
      return sizes[0];
   }
   if (index < 3)
   {
      return sizes[1];
   }
   return sizes[2];
}
EVR.Level.Records.prototype.style_cell = function(cell, index)
{
   var style = cell.style;
   style.background = this.determine_background_color(index);
   style.letterSpacing = RECORDS_LETTER_SPACING;
   style.padding = "0 " + RECORDS_PADDING;
   style.verticalAlign = "middle";
   style.fontWeight = RECORDS_FONT_WEIGHT;
   cell.noWrap = true;
}
EVR.Level.Records.prototype.determine_background_color = function(index)
{
   var colors = this.colors;
   if (index < 3)
   {
      return colors[index];
   }
   return colors[3];
}
EVR.Level.Records.prototype.display_second_tier = function(times)
{
   var span, cell, row, row_count = this.lengths[2];
   for (var ii = 0; ii < this.lengths[1]; ii++)
   {
      span = row_count / 2;
      row = this.get_rows()[ii * span];
      cell = this.insert_cell(row);
      this.fill_cell(cell, times[ii], ii + 1, span);
   }
}
EVR.Level.Records.prototype.display_third_tier = function(times)
{
   var cell, row;
   for (var ii = 0; ii < this.lengths[2]; ii++)
   {
      row = this.get_rows()[ii];
      cell = this.insert_cell(row);
      this.fill_cell(cell, times[ii], ii + 3);
   }
}
EVR.Level.Records.prototype.draw = function()
{
   var texts = this.texts;
   for (var ii = 0; ii < texts.length; ii++)
   {
      texts[ii].set_font_size();
   }
}
EVR.Level.Records.prototype.toString = function()
{
   return "[object EVR.Level.Records]";
}
3.143.239.234
3.143.239.234
3.143.239.234
 
September 13, 2013

from array import array
from time import sleep

import pygame
from pygame.mixer import Sound, get_init, pre_init

class Note(Sound):

    def __init__(self, frequency, volume=.1):
        self.frequency = frequency
        Sound.__init__(self, self.build_samples())
        self.set_volume(volume)

    def build_samples(self):
        period = int(round(get_init()[0] / self.frequency))
        samples = array("h", [0] * period)
        amplitude = 2 ** (abs(get_init()[1]) - 1) - 1
        for time in xrange(period):
            if time < period / 2:
                samples[time] = amplitude
            else:
                samples[time] = -amplitude
        return samples

if __name__ == "__main__":
    pre_init(44100, -16, 1, 1024)
    pygame.init()
    Note(440).play(-1)
    sleep(5)

This program generates and plays a 440 Hz tone for 5 seconds. It can be extended to generate the spectrum of notes with a frequency table or the frequency formula. Because the rewards in Send are idealized ocean waves, they can also be represented as tones. Each level has a tone in its goal and a tone based on where the player's disc lands. Both play at the end of a level, sounding harmonic for a close shot and discordant for a near miss. The game can dynamically create these tones using the program as a basis.

I'm also building an algorithmically generated song: Silk Routes (Scissored). Here is an example of how it sounds so far.