anchor.diff:  
   ;; 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))))
  +    (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 (streaminfo-totalsamples streaminfo))
  +      (if (= 0 totalsamples)
   	  (error "Number of total samples is unknown"))
  -      (if (/= (streaminfo-minblocksize streaminfo)
  -	      (streaminfo-maxblocksize streaminfo))
  +      (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
  
positive.code:       (with-open-file (out-stream wav-name
  				  :direction :output
  				  :if-exists :append
  				  :element-type (list 'signed-byte (streaminfo-bitspersample streaminfo)))
  		      (file-position out-stream
  				     (/ (ash 44 3) (streaminfo-bitspersample streaminfo)))
  
  		      (let ((buf (make-array (* (streaminfo-minblocksize streaminfo)
  						(streaminfo-channels streaminfo))
  					     :element-type '(signed-byte 32))))
  
  			(loop for i below (streaminfo-totalsamples streaminfo)
  			      by (streaminfo-minblocksize streaminfo) do
  			      (write-sequence (mixchannels buf (frame-decode (frame-reader stream streaminfo)))
  					      out-stream)))))
      (close stream)))
  
negative.code: (defparameter +wave+ (babel:string-to-octets "WAVE"))
  (defconstant +header-size+ (* 8 44))
  
  (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 8 do
  	(setf (aref array i)
  	      (ldb (byte 8 pos) val)))
    array)
  
  (defun mixchannels (out buffers)
  