anchor.diff:  (defmethod stream-playback-start ((rec wav-stream-record))
     (call-next-method))
   
  +(define-constant +frame-duration-seconds+ 5)
  +(define-constant +chunk-granularity-scale+ 10) ;10 per second
  +
   (defmethod shared-initialize :after ((rec wav-stream-record) slots &key &allow-other-keys)
     (declare (ignorable slots))
  -  (setf  (buffer rec) (make-array (suggested-buffer-size rec) :element-type '(unsigned-byte 8))))
  +  (initialize-ring rec (/ +frame-duration-seconds+ +chunk-granularity-scale+)
  +		   :frame-size (/ (* (sample-rate rec) (block-align rec)) +chunk-granularity-scale+)))
   
   (defmethod read-audio-stream-header ((rec wav-stream-record) stream)
  -  (loop for chunk = (riff:read-riff-chunk stream)
  -     when (string-equal (riff:riff-chunk-id chunk) "fmt ") do
  -       (flexi-streams:with-input-from-sequence (is (riff:riff-chunk-data chunk))
  -	(setf (compression-code rec) (riff:read-u2 is)
  -	     (number-of-channels rec) (riff:read-u2 is)
  -	     (sample-rate rec) (riff:read-u4 is)
  -	     (average-bytes-per-second rec) (riff:read-u4 is)
  -	     (block-align rec) (riff:read-u2 is)
  -	     (significant-bits-per-sample rec) (riff:read-u2 is))
  -	(debug-log (format nil "Audio stream with sample rate ~D at ~D bits per sample" (sample-rate rec) (significant-bits-per-sample rec)))
  -       (unless (eql (compression-code rec) +pcmi-uncompressed+)
  -	 (setf (extra-format-bytes rec) (riff:read-u2 is)
  -	       (extra-bytes rec) (make-array (extra-format-bytes rec) :element-type (stream-element-type is)))
  -	 (read-sequence (extra-bytes rec) is)))
  -       (return)))
  +  (let ((chunk (riff:read-riff-chunk stream)))
  +    (flexi-streams:with-input-from-sequence (is (riff:riff-chunk-data chunk))
  +      (setf (compression-code rec) (riff:read-u2 is)
  +	    (number-of-channels rec) (riff:read-u2 is)
  +	    (sample-rate rec) (riff:read-u4 is)
  +	    (average-bytes-per-second rec) (riff:read-u4 is)
  +	    (block-align rec) (riff:read-u2 is)
  +	    (significant-bits-per-sample rec) (riff:read-u2 is))
  +      (debug-log (format nil "Audio stream with sample rate ~D at ~D bits per sample" (sample-rate rec) (significant-bits-per-sample rec)))
  +      (unless (eql (compression-code rec) +pcmi-uncompressed+)
  +	(setf (extra-format-bytes rec) (riff:read-u2 is)
  +	      (extra-bytes rec) (make-array (extra-format-bytes rec) :element-type (stream-element-type is)))
  +	(read-sequence (extra-bytes rec) is)))))
   
   (defmethod decode-media-stream ((rec wav-stream-record) fsize input-stream)
     (let* ((chunk (pop (wcursor rec)))
  
positive.code: 	   (fourcc (getf chunk :file-type)))
        (unless (string-equal id "riff")
  	(error 'unrecognized-file-format))
        (cond ((string-equal fourcc "wave") (read-wav-header wav stream))
  	    (t (error 'unsupported-wav-file-format))))
      (when (player-callback wav)
        (funcall (player-callback wav) wav))
      (loop for chunk = (riff:read-riff-chunk stream :chunk-data-reader (chunk-decoder wav))
         while (and chunk (not (finish wav))))
      (loop for rec in (stream-records wav) do 
  	 (setf (final rec) (car (wcursor rec)))
  	 (bt:release-lock (vacancy-lock (car (wcursor rec)))))))
  
  
negative.code: (defmethod read-wav-stream-info ((wav wav-container) stream)
    (loop for chunk = (riff:read-riff-chunk stream)
       with rec = (make-instance 'wav-stream-record :container wav)
       when (string-equal (riff:riff-chunk-id chunk) "fmt ") do
         (read-audio-stream-header rec stream)
         (return-from read-wav-stream-info rec))
    (error 'malformed-wav-file-format))
  
  (defmethod read-wav ((wav wav-container) stream)
    (setf (stream-records wav)
  	(read-wav-stream-info wav stream)))
  
  (defmethod find-pcm-stream-record ((wav wav-container))
    ;; only one stream in wav container
  