Grammatical Music Composition with Dissimilarity Driven Hill Climbing

  • Róisín LoughranEmail author
  • James McDermott
  • Michael O’Neill
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9596)


An algorithmic compositional system that uses hill climbing to create short melodies is presented. A context free grammar maps each section of the resultant individual to a musical segment resulting in a series of MIDI notes described by pitch and duration. The dissimilarity between each pair of segments is measured using a metric based on the pitch contour of the segments. Using a GUI, the user decides how many segments to include and how they are to be distanced from each other. The system performs a hill-climbing search using several mutation operators to create a population of segments the desired distances from each other. A number of melodies composed by the system are presented that demonstrate the algorithm’s ability to match the desired targets and the versatility created by the inclusion of the designed grammar.


Algorithmic composition Hill-climbing Grammar 



This work is part of the App’Ed (Applications of Evolutionary Design) project funded by Science Foundation Ireland under grant 13/IA/1850.


  1. 1.
    Biles, J.A.: Straight-ahead jazz with GenJam: a quick demonstration. In: MUME 2013 Workshop (2013)Google Scholar
  2. 2.
    Brabazon, A., O’Neill, M., McGarraghy, S.: Grammatical evolution. In: Brabazon, A., O’Neill, M., McGarraghy, S. (eds.) Natural Computing Algorithms, pp. 357–373. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  3. 3.
    Chen, A.L., Chang, M., Chen, J., Hsu, J.L., Hsu, C.H., Hua, S.: Query by music segments: an efficient approach for song retrieval. In: ICME 2000, vol. 2, pp. 873–876. IEEE (2000)Google Scholar
  4. 4.
    Dahlstedt, P.: Autonomous evolution of complete piano pieces and performances. In: Proceedings of Music AL Workshop. Citeseer (2007)Google Scholar
  5. 5.
    Donnelly, P., Sheppard, J.: Evolving four-part harmony using genetic algorithms. In: Di Chio, C., et al. (eds.) EvoApplications 2011, Part II. LNCS, vol. 6625, pp. 273–282. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  6. 6.
    Fernández, J.D., Vico, F.: AI methods in algorithmic composition: a comprehensive survey. J. Artif. Intell. Res. 48, 513–582 (2013)MathSciNetzbMATHGoogle Scholar
  7. 7.
    Hargreaves, D.J.: The effects of repetition on liking for music. J. Res. Music Educ. 32(1), 35–47 (1984)CrossRefGoogle Scholar
  8. 8.
    Hu, N., Dannenberg, R.B., Lewis, A.L.: A probabilistic model of melodic similarity. In: International Computer Music Conference (ICMC), Goteborg, Sweden. International Computer Music Society (2002)Google Scholar
  9. 9.
    Lemström, K., Ukkonen, E.: Including interval encoding into edit distance based music comparison and retrieval. In: Proceedings of the AISB, pp. 53–60 (2000)Google Scholar
  10. 10.
    Logan, B., Salomon, A.: A music similarity function based on signal analysis. In: ICME, Tokyo, Japan, p. 190. IEEE (2001)Google Scholar
  11. 11.
    Loughran, R., McDermott, J., O’Neill, M.: Grammatical evolution with Zipf’s law based fitness for melodic composition. In: Sound and Music Computing, Maynooth (2015)Google Scholar
  12. 12.
    Loughran, R., McDermott, J., O’Neill, M.: Tonality driven piano compositions with grammatical evolution. In: CEC, pp. 2168–2175. IEEE (2015)Google Scholar
  13. 13.
    Middleton, R.: ‘Play It Again Sam’: some notes on the productivity of repetition in popular music. Popular Music 3, 235–270 (1983)CrossRefGoogle Scholar
  14. 14.
    Mladenović, N., Hansen, P.: Variable neighborhood search. Comput. Oper. Res. 24(11), 1097–1100 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Ockelford, A.: Repetition in Music: Theoretical and Metatheoretical Perspectives. Ashgate, Aldershot (2005)Google Scholar
  16. 16.
    Reddin, J., McDermott, J., O’Neill, M.: Elevated pitch: automated grammatical evolution of short compositions. In: Giacobini, M., et al. (eds.) EvoWorkshops 2009. LNCS, vol. 5484, pp. 579–584. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  17. 17.
    Shao, J., McDermott, J., O’Neill, M., Brabazon, A.: Jive: a generative, interactive, virtual, evolutionary music system. In: Di Chio, C., et al. (eds.) EvoApplications 2010, Part II. LNCS, vol. 6025, pp. 341–350. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  18. 18.
    Slaney, M., Weinberger, K., White, W.: Learning a metric for music similarity. In: International Symposium on Music Information Retrieval (ISMIR) (2008)Google Scholar
  19. 19.
    Thywissen, K.: GeNotator: an environment for exploring the application of evolutionary techniques in computer-assisted composition. Organ. Sound 4(2), 127–133 (1999)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Róisín Loughran
    • 1
    Email author
  • James McDermott
    • 1
  • Michael O’Neill
    • 1
  1. 1.Natural Computing Research and Applications GroupUniversity College DublinDublinIreland

Personalised recommendations