Music in Prolog

music_eng.pl (31,1 KB) (SWI-Prolog 64 bit release 8.0.3)

This work, which was made during various years in my spare time, is an attempt to represent musical concepts by numbers. Trusting in the semantic power of number to describe harmonic facts and concepts like consonance/dissonance, it uses frequency ratios, instead of steps of semitones of equal temperament. The power of recursion in Prolog, then, allows the program to re-tune a given score in Just intonation, to generate automatic harmonizations of a song giving in input the list of chord names, and also to produce music ex-novo. The program works in time lapsed and produce as output a MIDI file, a standard code to represent musical scores. The approach is deterministic: same input -> same output, and no random procedures at all.
This program enables to listen how Just Intonation (that uses the theoretical values of notes, not approximated values like Equal Temperament) sounds, using the MIDI feature “polyphonic pich bend” and to describe harmonic facts and rules as math functions. It can also re-tune songs in some ancient systems like mesotonic temperament in his various forms, or use our equal temperament.

I’d like to attach some songs made by this program, but the robot says that .mp3 and .mid files are not allowed. If someone is interested, I can send them via mail.

The midi files are automatic harmonizations of chords of some famous songs (You can hear them with Windows Media Player or similar, and you can see the score by using a music editor like Finale or others).
The mp3 files are music pieces generated by this program or by previous versions of this program.
No change was made to the output in the midi files, in mp3 files my only intervention was on instruments choice and mixing. All these songs are in Just Intonation.

You can find the theoretical basis of this work in my book “Il sistema Senario”, unfortunately avaiable in italian only, useful also to jazz musicians, for a systematic study about relationship between choirds and scales, at the link:https://www.lulu.com/en/en/shop/luca-perotti/il-sistema-senario-gli-armonici-senari-come-fondamento-razionale-dellarmonia/ebook/product-1mkggneg.html?page=1&pageSize=4

lucaperotti60@gmail.com

6 Likes

:slight_smile: Note that we could probably use e.g. MIDIjs to make your program generate music in the browser directly from SWISH … That allows anyone to work with it online!

1 Like