<?php
namespace file;

function get_directory_contents(
   $directory_path, $extension="", $excludes=NULL, $recursive=True,
   $only_directories=False)
{
   if (!is_dir($directory_path)) return array();

   $directory_path = rtrim($directory_path, "/");
   $excludes = (!is_array($excludes)) ? array($excludes) : $excludes;
   $directory = opendir($directory_path);
   $extension = format_extension($extension);
   $expression = "/^[^#.].*" . $extension . "$/";
   $files = array();
   
   while ($directory && ($entry = readdir($directory)) !== False)
   {
      if ($entry == "." || $entry == "..") continue;

      $path = $directory_path . "/" . $entry;
      if (preg_match($expression, $entry))
      {
         if (!$only_directories || is_dir($path))
         {
            $files[] = $path;
         }
      }
      
      if (is_dir($path) && $recursive)
      {
         if (!in_array($path, $excludes))
         {
            $files = array_merge(
               $files, get_directory_contents($path, $extension, $excludes));
         }
      }
   }
   sort($files);

   return $files;
}

function format_extension($extension)
{
   if ($extension != "" && $extension[0] != "\\")
   {
      $extension = "\." . $extension;
   }
   return $extension;
}
<?php
namespace file;

require_once "build_path.php";

function find_file($expression, $directory_paths, $recursive=True)
{
   if (!is_array($directory_paths))
   {
      $directory_paths = array($directory_paths);
   }
   $match = null;
   foreach ($directory_paths as $path)
   {
      if (is_dir($path))
      {
         $match = search_directory($expression, $path, $recursive);
      }
      if ($match) break;
   }
   return $match;
}

function search_directory($expression, $directory_path, $recursive=True)
{
   $match = null;
   $directory = opendir($directory_path);
   while ($current_file_name = readdir($directory))
   {
      if ($current_file_name[0] != '.')
      {
         $current_file_path = build_path($directory_path, $current_file_name);
         if (is_dir($current_file_path) && $recursive && !$match)
         {
            $match = search_directory($expression, $current_file_path);
         }
         if (fnmatch($expression, $current_file_name))
         {
            $match = $current_file_path;
         }
      }
   }
   return $match;
}
<?php
namespace unicode;

define("CHART_PATH", dirname(__FILE__) . "/chart");
define("DELIMITER", "/ +/");

function convert_to_html($content)
{
   if (is_file($content))
   {
      $content = file_get_contents($content);
   }
   $chart = parse_unicode_chart();
   $translation = translate_content($content, $chart);
   return $translation;
}

function translate_content($content, $chart)
{
   $translation = "";
   for ($ii = 0; $ii < strlen($content); $ii++)
   {
      $char = $content[$ii];
      print_r($chart);
      if (array_key_exists($char, $chart))
      {
         $decimal = hexdec($chart[$char]);
         $html_code = "&#" . $decimal;
         $translation .= $html_code;
      }
      else
      {
         $translation .= $char;
      }
   }
   return $translation;
}

function parse_unicode_chart()
{
   $records = file(CHART_PATH);
   foreach ($records as $record)
   {
      $record = rtrim($record);
      $fields = preg_split(DELIMITER, $record);
      $hex_codes[$fields[0]] = $fields[1];
   }
   return $hex_codes;
}
<?php
namespace matrix;

function translate_matrix_to_strings($matrix, $separator=" ")
{
   foreach ($matrix as $words)
   {
      $string = "";
      foreach ($words as $word)
      {
         $string .= $word . $separator;
      }
      $string = rtrim($string, $separator);
      $strings[] = $string;
   }
   return $strings;
}
<?php
namespace object;

function build_ancestry($object)
{
   $hierarchy = array(get_class($object));
   $current = $object;
   while ($parent_class_name = get_parent_class($current))
   {
      if ($parent_class_name == "Entity") break;
      $hierarchy[] = $parent_class_name;
      $current = $parent_class_name;
   }
   return $hierarchy;
}
<?php
namespace printf;

function print_br($message)
{
   echo $message . "<br/>";
}
<?php
namespace printf;

function p_print($string)
{
   echo("<p>$string</p>\n");
}
216.73.216.141
216.73.216.141
216.73.216.141
 
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.