With the development of technology, automated music composition has received widespread attention in music creation. This article mainly focuses on the generation of chords in automated music composition. First, relevant music knowledge was briefly introduced, and then the composition of the Transformer model was explained. A two-layer bidirectional Transformer method was designed to generate chords for the main melody and chorus separately, followed by the establishment of chord coloring and sound production models. Ten music professionals and 40 ordinary college students compared the coherence, pleasantness, and innovation of the chords generated by Hidden Markov Model (HMM), Long Short-Term Memory (LSTM), and the method proposed in this paper. The results showed that the chord generated by the method proposed in this paper achieved higher scores in the evaluation. Overall, the scores given by the music professionals and ordinary college students were 3.64 and 3.91, respectively, which were higher than those of the HMM and LSTM methods. The experimental results prove the superiority of the chord generation method proposed in this paper. The method can be applied to automated music composition.Povzetek: Raziskava se osredotoča na avtomatizirano ustvarjanje glasbe, zlasti generacijo akordov, in predstavi izboljšano metodo z uporabo dvoslojnega dvosmernega pretvornega modela. V primerjavi z metodami HMM in LSTM je nov pristop pokazal višje rezultate v ocenah koherence, prijetnosti in inovativnosti, kar potrjuje njegovo učinkovitost in uporabnost v avtomatizirani glasbeni kompoziciji.