anchor.diff:  (defparameter +wave+ (babel:string-to-octets "WAVE"))
   (defconstant +header-size+ (* 8 44))
   
  -(declaim (inline integer-to-array))
  -(defun integer-to-array (val array &optional (size 8))
  +(defun integer-to-array (val array)
  +  (declare (optimize (speed 3))
  +	   (type (unsigned-byte 32) val)
  +	   (type (simple-array (unsigned-byte 8)) array))
     (loop for i below (length array)
  -	for pos from 0 by size do
  +	for pos from 0 by 8 do
   	(setf (aref array i)
  -	      (ldb (byte size pos) val)))
  +	      (ldb (byte 8 pos) val)))
     array)
   
   (defun mixchannels (out buffers)
  
positive.code: 			(write-byte 0 out-stream)
  
  			(write-sequence (integer-to-array
  					 (streaminfo-channels streaminfo)
  					 buf2) out-stream)
  			
  			(write-sequence (integer-to-array
  					 (streaminfo-samplerate streaminfo)
  					 buf4) out-stream)
  
  			(write-sequence (integer-to-array
  					 (ash
  					  (* (streaminfo-samplerate streaminfo)
  					     (streaminfo-channels streaminfo)
  					     (streaminfo-bitspersample streaminfo)) -3)
  					 buf4) out-stream)
  
  			(write-sequence (integer-to-array
  					 (ash
  					  (* (streaminfo-channels streaminfo)
  					     (streaminfo-bitspersample streaminfo)) -3)
  					 buf2) out-stream)
  
  			(write-sequence (integer-to-array
  					 (streaminfo-bitspersample streaminfo)
  					 buf2) out-stream)
  
  			;; Subchunk 2
  			(write-sequence +wav-subchunk2-id+ out-stream)
  
negative.code: 
  ;; Works only for 8 or 16 bps
  (defun flac2wav (flac-name wav-name)
    "Decodes flac to wav. Works only for 8 or 16 bps,
     fixed block size and if total samples in stream is known"
    (multiple-value-bind (blocks stream)
        (flac:open-flac flac-name)
      (let* ((streaminfo (first blocks))
  	   (buf2 (make-array 2 :element-type '(unsigned-byte 8)))
  	   (buf4 (make-array 4 :element-type '(unsigned-byte 8)))
  
  	   (minblocksize (streaminfo-minblocksize streaminfo))
  	   (maxblocksize (streaminfo-maxblocksize streaminfo))
  	   (totalsamples (streaminfo-totalsamples streaminfo))
  	   (blocksize minblocksize)
  
  	   (bps (streaminfo-bitspersample streaminfo))
  	   (channels (streaminfo-channels streaminfo))
  	   (samplerate (streaminfo-samplerate streaminfo)))
        
        (if (= 0 totalsamples)
  	  (error "Number of total samples is unknown"))
        (if (/= minblocksize maxblocksize)
  	  (error "Block size must be fixed"))
  
        (if (not (or (= 8 bps)
  		   (= 16 bps)))
  	  (error "Bps must be 16 or 8"))
        
        (with-open-file (out-stream wav-name
  				  :direction :output
  				  :if-exists :supersede
  