This page of the Resident Evil Village guide explains how to solve the piano puzzle in the Opera Hall of Dimitrescu Castle. This is not a very complicated puzzle, although it still requires you to play the melody correctly on the piano.
The piano shown in the image above is located in the Opera Hall, which you will gain access to shortly after you obtain Dimitrescu's Key and unlock the Courtyard's north door. Ethan must interact with the piano and play the correct melody on it.
The correct order of key presses is shown in the image above. This puzzle is fortunately much simpler than it might seem. If you make a mistake and press the wrong key, you don't have to start playing the whole tune from the beginning.
Observe the dots that appear on the notes, which are a huge help as far as the correctness of the key selection is concerned.
Playing the tune correctly will unlock a locker where you will find the Iron Insignia Key, which is useful in many places in the game.