The sound wave is really a pressure wave, with standing waves of the form
p=cos kx or sin kx. The boundary condition at the x=0 end of an open pipe is that p=0,
giving sin kx. At the x=0 end of a closed pipe, the BC is dp/dx=0 (or p is a maximum),
gilving cos kx.