Piano as a popular keyboard instrument is not only a solo instrument but also an important accompaniment instrument. This study explores a multi-level accompaniment effect generation method based on temporal data modeling in piano art instruction. The time-frequency transformation of piano audio by constant Q-transform and short-time Fourier transform realizes the timing data modeling, and builds the accompaniment generation model based on the codec structure to solve the problem of generating the accompaniment tracks based on the main melody and maintaining the melodic harmony among the accompaniment tracks. The study adopts the Lookback mechanism to encode the main melody information, and at the same time utilizes the attention mechanism to realize the coordinated representation of inter-track information. The experimental results show that compared with the MuseGAN and MMM models, the model in this paper achieves a coverage of 0.917 on the note length distribution, which is about 20.0% higher than that of MuseGAN, and a coverage of 0.945 on the pitch distribution, which is about 127.2% higher than that of MMM; In the inter-track distance index, the TD value of piano and guitar is reduced to 0.632, which is much lower than that of MMM’s 1.387. The study proves that the model can effectively improve the inter-track harmony while maintaining the quality within the tracks, which is of great significance for the theoretical research and practical application of piano accompaniment.