May 19
cgMusic - Can computers create music?
The short answer is - yes they can. The long one is – yes, they can and in fact they do it better than most people. I’m not talking about computers performing music (like a MIDI Player or a Toyota robot playing violin). I’m talking about computer software that is composing music - making up melodies and writing scores for some instruments. The only thing which gives us, people an edge at composing music is that a real person can tell which one composition sounds better than others. A computer can create hundreds of songs in a second but it will never be able to tell which one it likes the most. But let’s get back to the beginning…
Apart from being a programmer and a designer I’m also a kind of an occasional music composer. I have created the entire music soundtrack for Magic Match and many tracks for Saqqarah and some other games, but in most cases I create music for fun. I plan to post my compositions on this blog in the future as well as to write about my experiences concerning making of music for games, but now I’d like to write about a piece of software called cgMusic, which I’ve developed as a part of my master thesis.
The goal of the cgMusic project was quite ambitious as I was supposed to create a computer program that would be able to create music with a certain level of quality that most of the existing music generating software lacked. Apart from that, I decided that I would not limit myself to mimicking any particular kind of music and rather make the software universal in such a way that it would be able to create music of any genre. So, did I manage to do it? You can judge for yourself.
You can download the program here (0,5 MB), install it and give it a try. At start you can either load any of the preset projects or create a new project by selecting two master algorithms that will create a random song for you. Later you can tweak all the internal parameters to your liking, change the songs arrangement and so on. If you have any questions about using the program, feel free to post them as comments to this article. If you don’t want to download the application here a some compositions created by cgMusic, that I was particularly impressed with. They are in midi format and should play properly on any General Midi compatible device.
The internal workings of cgMusic are quite complex. Basically cgMusic is an expert system distributed among many independent modules, where every single module knows how to create one aspect of music. An example would be an algorithm that creates a certain set of possible rhythms, melodies, harmonies, song structures or hole arrangements. The program can easily be extended by adding new modules on the fly and this is how supporting new styles is possible. Each module can be controlled independently so when you decide on a certain melody and structure you can listen to “your” song in any of the available arrangements. For the purpose of my master thesis I created a sample set of plugin modules that show the very basic abilities of the application. It was a nice surprise for me to see that even with very simple algorithms the program is able to create complex music.
If you think that music generated by cgMusic sounds crappy this probably because midi music generally sounds crappy. But there is no problem in rendering cgMusic generated compositions using some fancy synthesizers or samplers. Below are a couple of examples in mp3 format that show what kind of effects can be obtained with the usage of proper music rendering tools.
There are many potential uses for computer generated music, ranging from real human composer assistance, music production tools, dynamic music for computer games, etc. The main reason behind slow development of advanced new music generating algorithms is that relatively few music composers have the IT based skills and the necessary knowledge to translate their music composition skills into mathematically defined algorithms.


May 30th, 2008 at 3:29 am
Thank you for this wonderful software. I tried many different ones i.e. fracmus, fmusic 19, qfc, gingerbread, etc. This one is superior.
June 26th, 2008 at 11:21 am
Hoping you’ll make this in Mac format one day. In the meantime… looking for a PC… THANKS! Cat
June 26th, 2008 at 6:01 pm
Try ‘Modern Song Structure’ 11055 and ‘Simple Ballad Song Arrangement’ 11896!
This is one of the two best random music creators I’ve ever used. The other was AlgoMusic on the Amiga back in the ’90s.
July 15th, 2008 at 11:29 am
This is an awesome music application, best of its sort that I have come across. Well done and thank you. Now, I am hoping that you will extend it to include extra styles of music, including, perhaps, ones with less emphasis in a melody, such as trance (and similar) and ambient with slower movement of individual parts. But, wow, its good!
Regards
David Pletts
July 18th, 2008 at 3:50 pm
wow,
It’s a wonderful software. I play with it a lot of time, and my son (11 years old) started to write song for his school :D.
Your program is more interesting than that from soundtreck
Congratulations
Your my muse, now.
July 27th, 2008 at 6:24 am
First: Sorry for bad English….
Thanks for this wonderful piece of Software.
I tried a couple of algorythmic Composition Software,
“Music in the Numbers” - simple and really great, but no longer developed.
And other ones….and this seems really great.
I wish in the future you can implement change the midi-output i.e. to MIDI-Yoke,
so that is possible use this software on the fly together with Cubase (or similar programs)
Congratulations !
July 29th, 2008 at 2:01 pm
It’s not just clever, it’s sensational! I genuinely enjoy the music it creates.
You’ve done an outstanding job. I hope the University appreciated how your softwares’ capability dwarfs any other in the same arena.
Is each track it creates truely unique?
August 6th, 2008 at 6:51 am
Thanks for this excellent software..
Wondering if you plan any future development?
Thanks
August 6th, 2008 at 3:26 pm
Thanks for all the kind words about cgMusic.
Unfortunately I don’t plan to develop it any further at the moment as I hove a lot of work with our games.
Cheers!
September 5th, 2008 at 12:51 pm
Just downloaded this, and really want to experiment with it! Three questions though:
(1) when I try to right click on a tree element to access script options, nothing happens. Am I missing something here?
(2) are the help files available somewhere in English?
(3) where can I find out more about the scripting language? what is it written in?
(4) any possibility of a real-time midi-out implementation?
Thanks so much! Great stuff!
September 5th, 2008 at 2:54 pm
Jim, thanks for your interest in cgMusic. To answer your questions:
(1) Right clicking on a script in a tree view should give you a popup menu with “Edit This Script”, “Duplicate” and “Remove” options. The “edit this script” function requires the freeware CrimsonEditor to be installed(www.crimsoneditor.com). But in fact you can use anything to edit the files on disk like notepad.
(2) Sorry, no.
(3) The embedded scripting language used is angelscript. The syntax is very similar to c/c++. You can learn more about it at angetcode.com/angelscript.
(4) Actually when you hit the play button the application sends the events to the default MIDI device set in Windows, so you can redirect it wherever you want. But changing parameters during playback is not possible because it is necessary to recompute the whole song after each change.
September 5th, 2008 at 10:02 pm
Definitely an amazing program! It is most unfortunate that there is no documentation in english for the scripting language, since writing scripts is such an important part of the cgMusic creative process. Alas…
Also, I can certainly understand that you would be too busy to continue development of the program, but since you are giving it away for free, (Thanks!!), and don’t have the time, would you consider making it ‘open-source’ so others could continue to improve this wonderful gem? There are a number of similar programs out there, but they are all either proprietary (LOTS of $$), hard to use, or seriously out of date. cgMusic is a great, easy to use program that could become the ‘hub’ of a vibrant ‘open-source’ community! (And an easy way for Codeminion to generate more game traffic through a low cost, or no cost, ’sponsorship’.)
I know that I would be happy to invest a lot of my own time into an ‘open-source cgMusic’ project, (please feel free to email me), and I’m sure others around the world would too. We might even find someone who reads Polish to translate the scripting help for all of us poor, neglected english speakers!
September 7th, 2008 at 5:44 pm
Beautiful software! I’m working on a similar project with a large format multi-touch interface (see http://www.nuigroup.com). I would love to know more about the architecture of the program. Maybe even a UML diagram? That would be awesome.
Parker
September 12th, 2008 at 4:42 pm
Do you have English documentation for this program? When I installed, all I see is a couple of doc files that appear to be in Polish.
Thanks,
David
September 14th, 2008 at 12:57 am
Wonderful software, but how do I use mp3 rendering?
September 24th, 2008 at 5:26 am
I also think, that going open-source is a great idea. I also would be very happy to invest my time in contribution to this software.
October 8th, 2008 at 8:09 pm
Genius program, simple and very effective. Well done! I think open source is a great idea too, but I totally understand if you wouldn’t want to release such great code. It’s free, it’s fantastic, thanks again!
October 15th, 2008 at 5:18 pm
I tried cgmusic and this one is the best music done by algorithmic composition. I can say only: WOW!

I tried to output the midi file into ZynAddSubFX synthesizer and sounds great
I am an open source music programmer and I recomand you to make your program open source (eg: under GPL license). I think that many developers will make this program even better ( and will make music composers to worry :-)) ) .
Paul, the author of ZynAddSubFX, PaulStretch, and other open source software
October 20th, 2008 at 10:54 pm
awesome, reminds me of algomusic on my amiga days, thanks some genius have done such works on days like these. Would be nice to be able to kick in some self made samples, maybe it can and it is just me… anyway congratulations!
November 9th, 2008 at 2:44 am
cg is break my midi mind to open imagination - bravo - oh ups how file save transfer to midi base recording system like pro tools or abelton - ones again brovo
November 19th, 2008 at 6:19 pm
Hello,
I am a freeware game developer. I would be interested in using music generated by cgMusic in my games. The games would be distributed, but not commercially. Does this count as personal use? If not, can I get permission to use the music generated in my games? If you choose to reply, please reply to toilethumour#AT#merseymail#’DOT#com.
Thank you for reading,
James
November 19th, 2008 at 6:22 pm
I forgot to mention, you would of course be fully credited. Unfortunately, I am unable to pay for a licence, if one is needed, as I have no method of transferring money over the internet.
Thanks again,
James
November 30th, 2008 at 10:06 am
AWESOME!!
December 3rd, 2008 at 4:31 am
I came across this while doing some research into procedural/generated/computer music, very cool. Any chance of the (or some of the) source code being open source?
December 3rd, 2008 at 5:56 pm
Very impressive results! I’ve done some work with algorithmic composition myself. My web application (fractalcomposer.com) generates music using self-similarity.
December 9th, 2008 at 1:19 am
Nice results! Is your master thesis available somewhere online? I’d be really interested in reading it. Kudos for sharing this program.
December 15th, 2008 at 2:43 pm
This is the best music generation software I have ever used. You are authentically a genius - really!
December 26th, 2008 at 5:28 pm
I’m interested in this field of research. Can I download your master thesis anywhere?
January 3rd, 2009 at 6:25 am
you are the man , awesome program.
January 7th, 2009 at 5:13 am
Hi,
Would you be interested in sublicensing the system/idea ?
Regards,
jmc
January 25th, 2009 at 9:47 am
“A computer can create hundreds of songs in a second but it will never be able to tell which one it likes the most.”
So what if someone makes a program that can learn receiving input from human who can tell it what it has to “like”?
January 31st, 2009 at 7:23 pm
This is the best music generator software I’ve ever used. Period.
March 2nd, 2009 at 4:26 pm
Brilliant!
after only a few hours mucking about I’ve made several enjoyable songs that really seem like they’ve been composed by a human.
You may know of this already but there is a man who has developed software that can copy a musician’s style and then use it to elaborate upon a given musical theme. His name is David Cope.
Here is a link to some of the compositions produced and I think they are very good (particularly the Bach piece).
Thanks for the brilliant and interesting software!
March 2nd, 2009 at 4:27 pm
Sorry, forgot the link.
Here it is: http://arts.ucsc.edu/faculty/cope/mp3page.htm
March 10th, 2009 at 6:46 am
This seems like an interesting project, but it’s a shame you’ve only targeted Windows so far. Might I suggest opening the source on the port-resistant interface bits, if not the entire project?
I’m sure you’ve done a good enough job of writing portable code for the internal bits, and I know more than a few Linux users (myself included) who would love to tinker with this!
March 21st, 2009 at 2:52 pm
Do you know of any fancy synthesizers to use?
May 9th, 2009 at 12:23 am
Is is possible to you to send me the orchestral score of “hapsi_s90es.mp3″ and the choral score of “piano_gigastudio.mp3″?? (if available, please) or how to generate them exactly on the CgMusic software. I’m very interested on the quality of those pieces and I would like to analyse them in detail.
May 9th, 2009 at 4:50 am
Hi Ed. You can simply download the piano.mid and hapsi.mid attached in my post and use any program that can print midi files as music notation. The project files are also distributed with cgMusic so you can also load them yourself in the app and save to midi. Best regards.
May 29th, 2009 at 3:10 pm
Hello. Great piece of software. I’m wondering if there is any way possible to batch export multiple randomly generated pieces without having to change everything by hand each time. Any help is appreciated. Thank you again for such wonderful work!
May 30th, 2009 at 6:07 pm
Hi again, thanks for the reply, but I have problems running CgMusic, it says that MSVCP70.DLL is missing… (both in windows xp sp3 and windows 7 rc). Any suggestions?
May 30th, 2009 at 6:47 pm
I’m not really sure what the problem with MSVCP70.DLL is. As far as I remember cgMusic should not require it. But then again I might be mistaken as it was quite some time ago when I compiled the program. Anyway, you could try installing the Microsoft VC Runtime libraries. You can find it here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
I hope it helps.
June 13th, 2009 at 6:56 pm
Excellent quality of music generated. the expert system rules should be well formed given that it is possible to produce human like output from randomization.Would be nice to read the master’s thesis. is it available on the web?
June 14th, 2009 at 3:38 am
Thanks for the good words, sr. Unfortunately the thesis is only available in Polish language and only in the building. Unfortunately this is the current policy as they had problems in the past with people stealing and selling works to students of other schools.
September 3rd, 2009 at 12:35 am
[...] cgMusic A freely-available and unpublicized software, cgMusic is the gem of all algorithmic composition tools that I have found so far. Maciej Biedrzycki created this flexible architecture that uses a scripting engine and expert systems to generate coherent music. A very impressive demonstration of algorithmic composition. [...]
October 10th, 2009 at 9:53 am
Hello,
I have translated the documentation with the help of Google’s language tools and the result is surprisingly good.
Great program!
November 20th, 2009 at 11:42 pm
This is very interesting. I can create a random siong, export as a midi file, then import the midi file into guitar pro 5, and i have an instant guitar riff(mayby not the best, but how easy!) This software wold be great if t contained different scales (aeolian gypsy pentatonic) woud it be possible to add them into the program… if so, how woud I.( i have no programming knowledge, but im a quick learner) I would even consider paying for a program which would have the different scales. Please respond!
November 23rd, 2009 at 2:33 pm
This is one of the best music software ever created.
It would be wonderful if you could continue its development or, alternatively, open the source, even with a restrictive licence.
December 29th, 2009 at 9:46 pm
Is it possible to use the midis generated by this software commercially, or is it just for personal use? And if only for personal use, do you ever plan to release a program that can be used commercially?
January 6th, 2010 at 9:39 am
Hi! I met Philip Glass (well, I saw him in a restaurant once or twice) and other celebrity composers, but your software is the COOLEST among em all! Genius, thanks! It beats the best of Eno or Nyman anytime!
February 6th, 2010 at 12:16 am
A magnificient piece of software. Keep up the good work
February 12th, 2010 at 7:20 am
WOW! amazing peace of software. I am musician and know playing keyboard and music theory, chord etc. It is really helping for great ideas. Great job done.
March 11th, 2010 at 5:27 pm
This is OK but I still think people are much better at writing music.
April 14th, 2010 at 10:42 pm
Havign trouble getting the live play to make a sound although I can easily play any file exported to midi.
what are the requirements for live play (DX5 or 9 or something or winodws xp or win 98 or what?)
April 15th, 2010 at 3:17 am
The program uses standard system MIDI output, so it should work if MIDI is present and configured on the system (the default device is used). It was tested on xp and vista.