Most of the codes are ready to be uploaded via Arduino IDE. Pin number for the buzzer is 10.
The classic guides on Arduino melody like this guide on Arduino.cc and notes on Play Arduino Piezo Music Codes not required to know. You may look at them for the circuit. The codes work with ESP32 as well.
You can play the tunes on Wokwi Arduino simulator. For example, @matititam created this intance of Jingle Bells with the above code : https://wokwi.com/arduino/projects/309974695864697409