The source sets the frequency
When sound passes from one material into another, its speed may change because the materials transmit vibrations differently. The frequency stays the same: the vibrating source still supplies the same number of oscillations each second. Particles in each material oscillate locally while the disturbance travels onwards. A change of material does not create a new source with a different frequency.