Commits

Adam Lindsay  committed 4c4acc9

doc tweaks and error checks

  • Participants
  • Parent commits 9aef6d7

Comments (0)

Files changed (2)

 
 Environment:
   beats, bars, tatums, sections, segments: all from the currently loaded file
+  _: the last-defined AudioRenderable
   analysis: container for all the other analysis products in the file
   
   libraries:
 > beats.that(overlap_starts_of(segments.that(have_pitch_max(analysis.key['value']))))
 > play
 > save bj.mp3
+> load ../music/aha.mp3
+> segments.that(have_pitch_max(analysis.key['value']))
+> play
+> beats.that(overlap_starts_of(_))
+> play
 > ^D
 
-$
+$ 
 '''
 
 
-class Usage(Exception):
-    def __init__(self, msg):
-        self.msg = msg
-
-
 def main(argv=None):
     if argv is None:
         argv = sys.argv
     def preloop(self):
         if self.args:
             self.do_load(self.args[0])
+        self.cwd  = os.getcwd()
     
     def postloop(self):
         print
     
-    def precmd(self, line):
-        # print line
-        self.cwd  = os.getcwd()
-        return line
-    
     def default(self, line):
         """execute a command"""
         self.execute(line)
             os.chdir(self.cwd)
         else:
             try:
-                a = audio.LocalAudioFile(path)
+                a = audio.LocalAudioFile(path, verbose=self.options.verbose)
                 self.env['afile'] = a
             except:
                 print "unable to load %s" % path
         if not line:
             print "missing filename"
             return
+        if not self.renderable:
+            print "nothing to save"
         self.renderable.encode(line)
         print "saved as " + os.path.abspath(os.path.join(os.getcwd(), line))