<p>Musical learning is important whether for entertainment or as a profession. However, learning music depends on practice; finding a musical piece on the player’s level is challenging. This paper proposes a novel method for automated difficulty-controlled piano music generation using a Generative Adversarial Network (GAN) approach. Two applications are studied (1) Generation of a random musical piece given the required difficulty and (2) Generation of a musical piece similar (melodic similarity) to an input musical piece in the required difficulty. We use a Generative Adversarial Network for music generation and an autoencoder for encoding the melody of the input musical piece. The model is evaluated using multiple metrics for musicality, similarity, and difficulty. The results prove the effectiveness of the proposed approach and encourage future research in the same area.</p>