Created
          April 27, 2015 22:44 
        
      - 
      
- 
        Save bwhitman/d8fb6897fb10d91731b0 to your computer and use it in GitHub Desktop. 
    Python aifc.py sampler metadata support
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 296d295 | |
| < self._loops = [] | |
| 328,329d326 | |
| < elif chunkname == 'INST': | |
| < self._readinst(chunk) | |
| 402,407d398 | |
| < def getinst(self): | |
| < if len(self._loops) == 0: | |
| < return None | |
| < return self._loops | |
| < | |
| < | |
| 519,552d509 | |
| < | |
| < def _readinst(self, chunk): | |
| < baseNote = struct.unpack('B',chunk.read(1))[0] | |
| < detune = struct.unpack('B',chunk.read(1))[0] | |
| < lowNote = struct.unpack('B',chunk.read(1))[0] | |
| < highNote = struct.unpack('B',chunk.read(1))[0] | |
| < lowVelocity = struct.unpack('B',chunk.read(1))[0] | |
| < highVelocity = struct.unpack('B',chunk.read(1))[0] | |
| < gain = _read_short(chunk) | |
| < # two loops | |
| < sustain_loop_playmode = _read_short(chunk) | |
| < sustain_marker_id_start = _read_short(chunk) | |
| < sustain_marker_id_end = _read_short(chunk) | |
| < release_loop_playmode = _read_short(chunk) | |
| < release_marker_id_start = _read_short(chunk) | |
| < release_marker_id_end = _read_short(chunk) | |
| < self._loops.append({ | |
| < "baseNote":baseNote, | |
| < "detune":detune, | |
| < "lowNote":lowNote, | |
| < "highNote":highNote, | |
| < "lowVelocity":lowVelocity, | |
| < "highVelocity":highVelocity, | |
| < "gain":gain, | |
| < "sustain_loop":{ | |
| < "playmode":sustain_loop_playmode, | |
| < "marker_id_start":sustain_marker_id_start, | |
| < "marker_id_end":sustain_marker_id_end}, | |
| < "release_loop":{ | |
| < "playmode":release_loop_playmode, | |
| < "marker_id_start":release_marker_id_start, | |
| < "marker_id_end":release_marker_id_end}, | |
| < }) | |
| < | |
| 1009,1010d965 | |
| < print "inst =", f.getinst() | |
| < print "mark =", f.getmarkers() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment