Previous page: Daily Crap 2009-08-15
Next page: Daily Crap 2009-08-23


Daily Crap 2009-08-17

  1. This skeleton will probably be useful for future sketching synchronized to music:

    class Sketch < Processing::App
      load_library "opengl"
      import "processing.opengl"
      import "javax.media.opengl"
    
      load_library "minim"
      import "ddf.minim"
    
      def setup
        render_mode OPENGL
    
        @minim = Minim.new(self)
        @song = @minim.loadFile("song.wav")
        @song.play
    
        # other initialization
        $now = 0
      end
    
      def draw
        new_now = @song.position / 1000.0
        time_diff = new_now - $now
        $now = new_now
    
        # draw
      end
    
      def stop
        @song.close
        @minim.stop
      end
    end

Comments

Click here to view the comments on this post.