EVR.Account.Form.Forms.Login_Form = function(forms)
{
   EVR.Account.Form.call(this, forms.element, "Login");
   this.forms = forms;
   this.initialize();
   this.add_inputs();
}
EVR.Account.Form.Forms.Login_Form.prototype = new EVR.Account.Form;
EVR.Account.Form.Forms.Login_Form.prototype.add_inputs = function()
{
   this.add_input("name", "username");
   this.add_input("pass", "password", "password");
}
EVR.Account.Form.Forms.Login_Form.prototype.respond = function()
{
   var response = this.submit();
   if (response == "")
   {
      this.clear_errors();
      this.forms.account.evr.log_in();
   }
   else
   {
      var current = this;
      window.setTimeout(
	 function()
	 {
	    current.clear_errors();
	    current.handle_error(response)
	    current.display_errors();
	 }, FORM_RESULTS_DELAY);
   }
}
EVR.Account.Form.Forms.Login_Form.prototype.submit = function()
{
   var script = SOURCE_PATH + "account/submit_login_request.php";
   var query = this.build_query();
   return new EVR.Requester(script, query, true).execute();
}
EVR.Account.Form.Forms.Login_Form.prototype.handle_error = function(error)
{
   var erroneous = "";
   if (error == "username not found (note: usernames are case-sensitive)")
   {
      erroneous = "name";
   }
   else if (error == "password doesn't match username")
   {
      erroneous = "pass";
   }
   if (erroneous != "")
   {
      this.add_error(error, erroneous);
   }
   else
   {
      alert(error);
   }
}
EVR.Account.Form.Forms.Registration_Form = function(forms)
{
   EVR.Account.Form.call(this, forms.element, "Register");
   this.forms = forms;
   this.initialize();
   this.add_inputs();
}
EVR.Account.Form.Forms.Registration_Form.prototype = new EVR.Account.Form;
EVR.Account.Form.Forms.Registration_Form.prototype.add_inputs = function()
{
   this.add_input("user", "username");
   this.add_input("pass", "password", "password");
   this.add_input("repeat", "confirm password", "password");
   this.add_input("email", "email address");
}
EVR.Account.Form.Forms.Registration_Form.prototype.respond = function()
{
   var response = this.submit();
   if (response[0] == "")
   {
      this.clear_errors();
      this.forms.account.evr.log_in();
   }
   else
   {
      var current = this;
      window.setTimeout(
	 function()
	 {
	    current.clear_errors();
	    current.add_errors(response);
	    current.display_errors();
	 }, FORM_RESULTS_DELAY);
   }
}
EVR.Account.Form.Forms.Registration_Form.prototype.submit = function()
{
   var script = SOURCE_PATH + "account/submit_registration_request.php";
   var query = this.build_query();
   return new EVR.Requester(script, query, true).execute().split("\n");
}
EVR.Account.Form.Forms.Registration_Form.prototype.add_errors = function(errors)
{
   var error, erroneous, found, display_response = false;
   for (var ii = 0; ii < errors.length; ii++)
   {
      error = errors[ii];
      erroneous = [];
      found = false;
      switch (error)
      {
         case "username taken":
         case "username too short":
         case "username too long":
         case "username contains invalid characters":
	    erroneous.push("user");
	    found = true;
      }
      switch (error)
      {
         case "submitted passwords don't match":
         case "password too short":
         case "password too long":
	    erroneous.push("pass");
	    erroneous.push("repeat");
	    found = true;
      }
      switch (error)
      {
         case "invalid email address format":
	    erroneous.push("email");
	    found = true;
      }
      if (!found)
      {
	 display_response = true;
      }
      else
      {
	 this.add_error(error, erroneous);
      }
   }
   if (display_response)
   {
      alert(errors);
   }
}
EVR.Account.Form.Forms.Forgot_Password_Form = function(forms)
{
   EVR.Account.Form.call(this, forms.element, "Reset Password");
   this.forms = forms;
   this.initialize();
   this.add_inputs();
}
EVR.Account.Form.Forms.Forgot_Password_Form.prototype = new EVR.Account.Form;
EVR.Account.Form.Forms.Forgot_Password_Form.prototype.add_inputs = function()
{
   this.add_input("name", "username");
   this.add_input("email", "email address");
}
EVR.Account.Form.Forms.Forgot_Password_Form.prototype.respond = function()
{
   var response = this.submit();
   if (response == "")
   {
      this.clear_errors();
      this.forms.account.evr.unload_account();
   }
   else
   {
      var current = this;
      window.setTimeout(
	 function()
	 {
	    current.clear_errors();
	    current.handle_errors(response);
	    current.display_errors();
	 }, FORM_RESULTS_DELAY);
   }
}
EVR.Account.Form.Forms.Forgot_Password_Form.prototype.submit = function()
{
   var script = SOURCE_PATH + "account/submit_reset_password_request.php";
   var query = this.build_query();
   return new EVR.Requester(script, query, true).execute();
}
EVR.Account.Form.Forms.Forgot_Password_Form.prototype.handle_errors =
   function(error)
{
   switch (error)
   {
      case "submitted address doesn't match account address":
      case "mail delivery failed":
         this.add_error(error, "email");
         break;
      case "username not found":
         this.add_error(error, "name");
         break;
      default:
         alert(error);
   }
}
18.117.154.134
18.117.154.134
18.117.154.134
 
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.