In actual practice, this process is far more complex, as you have to look for many different waveforms:
The picture above illustrates an earthquake sending waveforms through the earth. The SKS wave is a shear wave that refracts into the liquid outer core, turns into a compressional wave (since shear waves cannot propagate through liquid), and then is converted again to a shear wave as it enters the mantle and goes to the surface. A trained seismologist looks at the readings from seismometers to tease out specific waves, which we know the properties of, to determine properties of the planet's interior. The speeds of these waves are highly dependent on the assumed densities and other rock properties of the crust, mantle, and core.