When a beam of light impings at some angle on the smooth flat surface of an optically dense medium, the wave "sees" a vast array of very closely spaced atoms that will somehow scatter it.
(At the wavelengths of light -- d=500nm -- the Earch's atmosphere at STP has about 106 molecules in such a d3-cube).
As the wavefront descends, it excites one scatterer after another, each of which reradiates a stream of photons that can be thought of as a hemispherical wavelet in the incident medium.
Because the wavelength is so much greater than the separation between the molecules, the wavelets advance together and add constructively in only one directions, and there is one well-defined reflected beam.
The wavelets bend as they cross the boundary, because of the speed change.
For similar reason, they form one well-defined refracted beam.

Ratio of index of refraction n2/n1 = v1/v2, where v1, v2 are speed of wave in media 1 and 2.

DOWNLOAD ejs xml source
then click to translate strings for selected locale.

Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop.

You can find another similar applet at  [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=16.0]Reflection and Refraction[/url]
For light (electromagnetic wave):

indices of refraction1.000291.3331.512.417

For sound wave :

materialAirwater vaporfresh watersea waterAluminum
speed of sound (m/s)331401149315135104