module base_window_mod
  implicit none

contains

  !----------------------------------------------
  ! Hamming window, left half
  !----------------------------------------------
  subroutine hammiwin1d(win, n)
    real, dimension(:) :: win
    integer            :: n
    integer            :: i
    real               :: PI

    PI = 3.14159265359
    if (n == 1) then
       win(1) = 1.
    else 
       do i=1, n
          win(i) = 0.54 + 0.46*cos(PI*(i-1)/(n-1)-PI)
       end do
    end if
    return
  end subroutine

end module
