How to use the buzzer of 51 single chip microcomputer to play some songs?

The frequency spectrum of sound ranges from tens to thousands of hertz. If the program can be used to control the "high" level or the low level of a port line of a single unit, a rectangular wave with a certain frequency can be generated on the port line, and the sound with a certain frequency can be generated by connecting a loudspeaker. If the duration of the "high" and "low" level is controlled by a delay program, the output frequency can be changed, thus the tone can be changed. To accurately play a piece of music, we must accurately control the rhythm of the music, that is, the duration of a note. The beat of notes can be controlled by timer T, and different timing times can be generated by sending in different initial values. For example, the rhythm of a song is 94 beats per minute, that is, one beat is .64 seconds. In fact, it is a problem of controlling the beat of a single chip microcomputer. If you want a specific program of 51, there are many online programs. If you can't find it, you can leave me a message and I will give it to you.