State two factors on which the speed of a wave travelling in a medium depends.