A mechanical or thermal treatment of a material can change, among other things, the average grains size. It depends on temperature, holding time, cooling condition or rolling stress. The average grain size, as well as its influence on the propagation velocity and attenuation coefficient of ultrasonic waves, also affects the wave frequency propagating through the material. Grain size is an indicator of material fatigue. It can therefore be used in monitoring or fatigue damage prevention. In this paper, we study the effect of various heat treatments hence different steel average grain sizes on the ultrasonic wave frequency after crossing the material. We have performed the same experimental study on aluminum samples. The different grain sizes are obtained by rolling. The frequency shift measurement of longitudinal waves is achieved by immersion with two probes of different frequencies 2.25 and 5 MHz. The experimental results are shown as curves giving the frequencies depending on the grain size. Heat treatments on steel and aluminum rolling performed on the samples have yielded a grain sizes gradient. Our results are consistent with the theory because of the important path in the sample and in this case the down shift frequency is paramount. They show a direct relationship between the frequency shift and the average grain size. It is therefore possible to trace quantitatively to an average grains size from the frequency of an ultrasonic wave that has passed through this material and hence its thermal or mechanical fatigue state.