Commits

Adam Lindsay committed 7797720

Minimal documentation

Comments (0)

Files changed (2)

+remix.py
+========
+
+A stupid shell for the Echo Nest Remix API.
+
+I had SuperCollider one-liner envy, so I created this.
+
+
+Commands:
+  load: loads the filename
+  play: play the result of the last command, if it can be played (currently Mac only)
+  save: save the result of the last command, if it can be rendered
+  help: be minimally helpful
+  anything else: try to interpret it in the current environment
+
+Environment:
+  beats, bars, tatums, sections, segments: all from the currently loaded file
+  analysis: container from all the other analysis products in the file
+  
+  libraries:
+    import echonest.audio as audio
+    from echonest.selection import *
+    from echonest.sorting import *
+
+> ./remix.py ../music/BillieJean.mp3
+
+  beats.that(overlap_starts_of(segments.that(have_pitch_max(analysis.key['value']))))
+  play
+  save bj.mp3
+  ^D
 from echonest.sorting import *
 
 
-usage = '''
+USAGE = '''
 %prog [options] [filename]
+
+Optional filename pre-loads the file.
 '''
 
 
 def main(argv=None):
     if argv is None:
         argv = sys.argv
-    parser = OptionParser()
+    parser = OptionParser(usage=USAGE)
     parser.add_option("-q", "--quiet",
                       action="store_false", dest="verbose", default=True,
                       help="try to suppress messages")
 
 
 class Remix(cmd.Cmd):
-    """Simple command processor example."""
+    """Loop while keeping track of the last thing."""
     
     prompt = "(no file) > "
     currfile = None
         pid=subprocess.Popen(CMD, stderr=subprocess.PIPE).pid
         
     def do_load(self, path):
+        """loads the requested file (or directory)"""
         if os.path.isdir(path):
             self.cwd = os.path.abspath(path)
             os.chdir(self.cwd)
         return mp3 + wav + dirs
     
     def do_save(self, line):
+        """saves to the designated filename in the current directory"""
         if not line:
             print "missing filename"
             return