;;; -*- logo -*-
;; This is offered as part of the sound API.
;;
;; copyright University of Victoria, 2005

to evenwt :iarray
  local [ oarray start next ]

  make "start item 0 iarray
  
  make "i (count iarray) - 1
  repeat count iarray [
    make "next item i iarray
 
    if less? start next + .1 [
      if less? next - .1 start [
        make "oarray (array i+1 0)
        repeat i+1 [
	  setitem i oarray item i iarray
          make "i i-1
        ]
        output oarray
        stop
      ]

    ]
    make "i i-1
  ]
  
  ouput []
end
