Automatically Generate Hymns Using Variational Attention Models

  • Han K. Cao
  • Duyen T. Ly
  • Duy M. Nguyen
  • Binh T. NguyenEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11555)


Building an intelligent system for automatically composing music like human beings has been actively investigated during the last decade. In this work, we propose a new approach for automatically creating hymns by training a variational attention model from a large collection of religious songs. We compare our method with two other techniques by using Seq2Seq and attention models and measure the corresponding performance by BLEU-N scores, the entropy, and the edit distance. Experimental results show that the proposed method can achieve a promising performance that is able to give an additional contribution to the current study of music formulation. Finally, we publish our dataset online for further research related to the problem.


Seq2Seq Variational attention model Music generation 



CKH and BTN would like to thank The National Foundation for Science and Technology Development (NAFOSTED), University of Science, and Inspectorio Research Lab in Viet Nam for supporting two authors throughout this paper.


  1. 1.
    Bahdanau, D., Cho, K., Bengio, Y.: Neural machine translation by jointly learning to align and translate. CoRR abs/1409.0473, September 2014. arXiv e-prints
  2. 2.
    Bahuleyan, H., Mou, L., Vechtomova, O., Poupart, P.: Variational attention for sequence-to-sequence models. CoRR abs/1712.08207 (2017)Google Scholar
  3. 3.
    Brunner, G., Wattenhofer, R., Wiesendanger, J.: JamBot: music theory aware chord based generation of polyphonic with LSTMs. CoRR (2017)Google Scholar
  4. 4.
    Choi, K., Fazekas, G., Sandler, M.B.: Text-based LSTM networks for automatic music composition. CoRR (2016)Google Scholar
  5. 5.
    Coffman, D.: Measuring musical originality using information theory. Psychol. Music 20(2), 154–161 (1992). Scholar
  6. 6.
    Eck, D., Schmidhuber, J.: A first look at music composition using LSTM recurrent neural networks. Technical report no. IDSIA-07-02. IDSIA/USI-SUPSI, Instituto Dalle Molle di studi sull’ intelligenza artificiale, Manno, Switzerland (2002).
  7. 7.
    Gregor, K., Danihelka, I., Wierstra, D.: DRAW: a recurrent neural network for image generation. CoRR (2015)Google Scholar
  8. 8.
    Hiller, L.A., Isaacson, L.M.: Experimental Music; Composition with an Electronic Computer. Greenwood Publishing Group Inc., Westport (1979). ISBN: 0313221588.
  9. 9.
    Hochreiter, S., Bengio, Y., Frasconi, P., Schmidhuber, J.: Gradient flow in recurrent nets: the difficulty of learning long-term dependencies (2001)Google Scholar
  10. 10.
    Hochreiter, S., Schmidhuber, J.: Long short-term memory. Neural Comput. 9(8), 1735–1780 (1997)Google Scholar
  11. 11.
    Jordan, M.I.: Artificial neural networks. In: Jordan, M.I. (ed.) Attractor Dynamics and Parallelism in a Connectionist Sequential Machine, pp. 112–127. IEEE Press, Piscataway (1990)Google Scholar
  12. 12.
    Kingma, D.P., Ba, J.: Adam: a method for stochastic optimization. CoRR abs/1412.6980 (2014).
  13. 13.
    Luong, T., Pham, H., Manning, C.D.: Effective approaches to attention-based neural machine translation. In: Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1412–1421 (2015)Google Scholar
  14. 14.
    Mozer, M.C.: Neural network music composition by prediction: exploring the benefits of psychoacoustic constraints and multi-scale processing. Connect. Sci. 6, 247–280 (1994)Google Scholar
  15. 15.
    Navarro, G.: A guided tour to approximate string matching. ACM Comput. Surv. 33(1), 31–88 (2001). Scholar
  16. 16.
    Nguyen, B.: A public dataset for hymn generation (2019).
  17. 17.
    Lewis, J.P.: Algorithms for music composition by neural nets: improved CBR paradigms. In: Proceeding of the International Computer Music Conference (1989)Google Scholar
  18. 18.
    Papineni, K., Roukos, S., Ward, T., Zhu, W.J.: Bleu: a method for automatic evaluation of machine translation. In: Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, ACL 2002, pp. 311–318 (2002)Google Scholar
  19. 19.
    Pudaruth, S., Amourdon, S., Anseline, J.: Automated generation of song lyrics using CFGS. In: The Seventh International Conference on Contemporary Computing (IC3) (2014)Google Scholar
  20. 20.
    Schoenberg, A.: Theory of Harmony. University of California Press, California (1983)Google Scholar
  21. 21.
    Shi, D.: A study on neural network language modeling. CoRR abs/1708.07252 (2017).
  22. 22.
    Sturm, B.L., Santos, J.F., Ben-Tal, O., Korshunova, I.: Music transcription modelling and composition using deep learning. CoRR abs/1604.08723 (2016)Google Scholar
  23. 23.
    Sutskever, I., Martens, J., Hinton, G.: Generating text with recurrent neural networks. In: Proceedings of the 28th International Conference on International Conference on Machine Learning, pp. 1017–1024. Omnipress (2011)Google Scholar
  24. 24.
    Sutskever, I., Vinyals, O., Le, Q.V.: Sequence to sequence learning with neural networks. CoRR abs/1409.3215 (2014)Google Scholar
  25. 25.
    Tomczak, M.: BachBot. Master Thesis (2016)Google Scholar
  26. 26.
    Yi, L., Goldsmith, J.: Automatic generation of four-part harmony. In: Proceedings of the Fifth UAI Conference on Bayesian Modeling Applications Workshop, vol. 268 (2007)Google Scholar
  27. 27.
    Zeyer, A., Doetsch, P., Voigtlaender, P., Schluter, R., Ney, H.: A comprehensive study of deep bidirectional LSTM RNNS for acoustic modeling in speech recognition. In: ICASSP 2017, pp. 2462–2466 (2017)Google Scholar
  28. 28.
    Zhou, C., Neubig, G.: Morphological inflection generation with multi-space variational encoder-decoders. In: SIGMORPHON 2017, pp. 58–65 (2017)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Han K. Cao
    • 1
  • Duyen T. Ly
    • 1
  • Duy M. Nguyen
    • 1
  • Binh T. Nguyen
    • 1
    Email author
  1. 1.Inspectorio Research LabUniversity of ScienceHo Chi Minh CityVietnam

Personalised recommendations