EVR.Field.Landscape.Ground = function(container)
{
   EVR.Field.Landscape.call(this, container);
   this.set_color(GROUND_COLOR);
   this.set_z(GROUND_Z_INDEX);
   this.set_proportions(GROUND_WIDTH_RATIO, GROUND_HEIGHT_RATIO);
   this.append();
}
EVR.Field.Landscape.Ground.prototype = new EVR.Field.Landscape;
EVR.Field.Landscape.Ground.prototype.toString = function()
{
   return "[object EVR.Field.Landscape.Ground]";
}
EVR.include("field/landscape/Ground.js");
EVR.include("field/landscape/Cloud.js");
EVR.include("field/landscape/Tree.js");
EVR.Field.Landscape = function(container, ratio_type)
{
   EVR.Graphic.call(this, container, ratio_type, null, ALIGN_BOTTOM_LEFT);
}
EVR.Field.Landscape.prototype = new EVR.Graphic;
EVR.Field.Landscape.prototype.set_opacity = function(min, max)
{
   var opacity = Math.get_random_number(min, max);
   EVR.Graphic.prototype.set_opacity.call(this, opacity);
}
EVR.Field.Landscape.prototype.toString = function()
{
   return "[object EVR.Field.Landscape]";
}
EVR.Field.Landscape.Cloud = function(container)
{
   EVR.Field.Landscape.call(this, container, RATIO_WIDTH);
   this.dimensions = [0, 0];
   this.set_color(CLOUD_COLOR);
   this.set_opacity(CLOUD_MIN_OPACITY, CLOUD_MAX_OPACITY);
   this.set_proportions();
   this.place(Math.random(), -this.calculate_offset());
   this.set_z(CLOUD_Z_INDEX);
   this.append();
}
EVR.Field.Landscape.Cloud.prototype = new EVR.Field.Landscape;
EVR.Field.Landscape.Cloud.prototype.set_proportions = function()
{
   var width = Math.get_random_number(CLOUD_MIN_WIDTH, CLOUD_MAX_WIDTH);
   var height = CLOUD_HEIGHT;
   EVR.Field.Landscape.prototype.set_proportions.call(this, width, height);
}
EVR.Field.Landscape.Cloud.prototype.calculate_offset = function(height)
{
   var height = this.get_dimensions(true)[1];
   var deviance = Math.random() * CLOUD_BOUNDARY_WIDTH;
   var screen_position = CLOUD_POSITION_OFFSET;
   var offset = deviance + screen_position - height / 2;
   return offset;
}
EVR.Field.Landscape.Cloud.prototype.get_dimensions = function(ratio)
{
   if (ratio == true)
   {
      return EVR.Graphic.prototype.get_dimensions.call(this, true);
   }
   else
   {
      return this.dimensions;
   }
}
EVR.Field.Landscape.Cloud.prototype.update_dimensions = function()
{
   this.dimensions = EVR.Graphic.prototype.get_dimensions.call(this);
}
EVR.Field.Landscape.Cloud.prototype.shape = function()
{
   EVR.Graphic.prototype.shape.call(this);
   this.update_dimensions();
}
EVR.Field.Landscape.Cloud.prototype.toString = function()
{
   return "[object EVR.Field.Landscape.Cloud]";
}
EVR.Field.Landscape.Tree = function(container, ground)
{
   EVR.Field.Landscape.call(this, container, RATIO_HEIGHT);
   this.ground = ground;
   this.dimensions = [0, 0];
   this.set_color(TREE_COLOR);
   this.set_opacity(TREE_MIN_OPACITY, TREE_MAX_OPACITY);
   this.set_proportions();
   this.place(Math.random());
   this.set_z(TREE_Z_INDEX);
   this.append();
}
EVR.Field.Landscape.Tree.prototype = new EVR.Field.Landscape;
EVR.Field.Landscape.Tree.prototype.set_proportions = function()
{
   var width = TREE_WIDTH;
   var height = Math.get_random_number(TREE_MIN_HEIGHT, TREE_MAX_HEIGHT);
   EVR.Graphic.prototype.set_proportions.call(this, width, height);
}
EVR.Field.Landscape.Tree.prototype.place = function(x)
{
   var offset = this.ground.get_dimensions(true)[1];
   EVR.Graphic.prototype.place.call(this, x, -offset);
}
EVR.Field.Landscape.Tree.prototype.get_dimensions = function(ratio)
{
   if (ratio == true)
   {
      return EVR.Graphic.prototype.get_dimensions.call(this, true);
   }
   else
   {
      return this.dimensions;
   }
}
EVR.Field.Landscape.Tree.prototype.update_dimensions = function()
{
   this.dimensions = EVR.Graphic.prototype.get_dimensions.call(this);
}
EVR.Field.Landscape.Tree.prototype.shape = function()
{
   EVR.Graphic.prototype.shape.call(this);
   this.update_dimensions();
}
EVR.Field.Landscape.Tree.prototype.toString = function()
{
   return "[object EVR.Field.Landscape.Tree]";
}
EVR.Album.Page = function(file, container)
{
   this.path = ALBUM_PATH + file;
   this.container = container;
   this.set_element();
}
EVR.Album.Page.prototype.set_element = function()
{
   var element = document.createElement("img");
   var style = element.style;
   style.width = "100%";
   style.height = "100%";
   style.position = "absolute";
   style.top = 0;
   style.left = 0;
   this.element = element;
}
EVR.Album.Page.prototype.show = function()
{
   this.element.src = this.path;
   this.container.appendChild(this.element);
}
EVR.Album.Page.prototype.hide = function()
{
   this.container.removeChild(this.element);
}
EVR.Album.Page.prototype.toString = function()
{
   return "[object EVR.Album.Page]";
}
EVR.Album.Menu = function(album)
{
   this.album = album;
   this.container = album.element;
   this.set_element();
   this.visible = false;
}
EVR.Album.Menu.prototype.set_element = function()
{
   var element = document.createElement("div");
   var style = element.style;
   style.background = ALBUM_MENU_BACKGROUND;
   style.color = ALBUM_MENU_FONT_COLOR;
   style.fontFamily = ALBUM_MENU_FONT;
   style.position = "absolute";
   style.zIndex = 5;
   style.top = 0;
   style.left = 0;
   style.width = "100%";
   style.textAlign = "center";
   style.opacity = ALBUM_MENU_OPACITY;
   style.padding = ALBUM_MENU_PADDING;
   style.fontSize = ALBUM_MENU_FONT_SIZE;
   style.fontWeight = ALBUM_MENU_FONT_WEIGHT;
   style.letterSpacing = ALBUM_MENU_LETTER_SPACING;
   this.element = element;
}
EVR.Album.Menu.prototype.update = function()
{
   var album = this.album;
   var index = album.index + 1;
   var total = album.count();
   var options = this.get_options();
   var text = options + " (" + index + "/" + total + ")";
   this.element.innerHTML = text;
}
EVR.Album.Menu.prototype.get_options = function()
{
   var text = ALBUM_MENU;
   if (this.album.grid_available())
   {
      text += ALBUM_MENU_BEAMS_OPTION;
   }
   return text;
}
EVR.Album.Menu.prototype.toggle = function()
{
   if (!this.visible)
   {
      this.show();
   }
   else
   {
      this.hide();
   }
}
EVR.Album.Menu.prototype.show = function()
{
   this.container.appendChild(this.element);
   this.visible = true;
}
EVR.Album.Menu.prototype.hide = function()
{
   this.container.removeChild(this.element);
   this.visible = false;
}
EVR.Album.Menu.prototype.toString = function()
{
   return "[object EVR.Album.Menu]";
}
216.73.216.142
216.73.216.142
216.73.216.142
 
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.