If you knew the magnitude of the Doppler shift, the siren's true pitch, and the speed of sound in air, you could work out the velocity of the truck relative to you, as these differences and the velocity are related. If a light source moves toward us at a very high rate of speed, the light waves which arrive at Earth from that source will be squeezed and their frequency raised, just like sound waves. In this case, the light looks bluer than it really is. If a light source moves away from us at a very high rate of speed, the light waves will be stretched out and their frequency lowered. As with sound, if you know the speed of light, the magnitude of the red shift or blue shift, and the true frequency of light, you can work out the speed.
Atoms provide such a reference because of their tendency to absorb light at particular frequencies.
If you shine a light bulb through a prism, you get out a spectrum which is made up of continuous bands of light. If you then stick a gaseous cloud of a particular atom in between the bulb and the prism, you will find that your rainbow has dark bands in it, like the top one shown below. If the light source is moving toward or away from your prism, you will find that these dark bands shift position in the spectrum. By measuring the amount that these lines have shifted, and knowing where they should occur from laboratory measurements, you can estimate the speed of the light source, be it a galaxy or distant star. Testing the Expanding Universe hypothesis We now know how to measure distances to far-off galaxies, and also how to measure their velocities relative to us.