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.
August 19th, 2010 at 9:21 pm
I have interest in Indian Raga using Sitar.
May I request you to assist me in the following please.
1. Is it possible to compose Indian Raga using computer software such as cgMusic which sounds like Sitar?
2. Can I use cgMusic on Windows Operating System?
Thanks
August 20th, 2010 at 3:30 am
Hi Deb,
I’m not an expert on Indian Raga, but it should be technically possible, but it would require developing specialized scripts. So it can’t be done out of the box. For the other question - yes, cgMusic works on Windows.
September 19th, 2010 at 6:52 pm
This is simply amazing, even with Midi format, some of the songs I got out of it are just awesome as they are, so plan on pulling them apart in my editing programs and seeing what can be done with the tracks.
October 8th, 2010 at 1:00 pm
I must rank myself in line with all the other great compliments. I have tried out a lot of automated composing programs, this is really the best. So it is really a shame that you have no time to develope it further. So, no chance for any new structures or arrangements ? Any way for a (non programmer) to write/develope some structures/arrangements ?
Thanks again for the great tool !
December 1st, 2010 at 10:15 am
SoundHelix is another cool tool for generatic algorithmic/random music (Java-based).
January 1st, 2011 at 12:15 pm
Hello, happy new year and thank you for this great tool. It would be very nice to have more styles to choose from, Ambient, House, alternative music styles with facettes of New Wave, Gothic e.g., but this is absolutely great in what it does in a second or two. Regards, Uwe
January 4th, 2011 at 8:26 am
Dude! Thanks soooo much!
This is the first software I came across which actually does a good job when it comes to algorithmic / generative composing.
I`ve been searching for years for something like this. This will be a valuable asset in my song making process. It gave me new inspiration. You could easily charge money for this.
Ideas for future versions:
• Midi input (auto accompaniment to fed melody lines)
• Generative Rhythm
• Micro tonality
• Pitch bending from one pitch to the next
• Wave to midi converter (including pitch trace on / off)
• Classical forms selection (fugue, sonatas ..etcetera
What have you used to write it? Is it open source?
Again thanks man. It rocks
Remco
January 4th, 2011 at 8:32 am
oh …. one more thing.
How about porting this into a realtime VST
Would that even be feasible?
Another idea: Groove patterns. Mail me if it sounds too cryptic
January 4th, 2011 at 10:24 am
@Remco Thanks for the ideas and for the kind words about cgMusic. I’m glad that you like the results. Unfortunately I don’t have the time to develop the software any more
January 6th, 2011 at 11:53 am
i can’t runn cgMusic on my windows xp sp3. there’s a MSVCP71.dll error. I’d very much like to try your programm.
what should i do?
January 9th, 2011 at 9:54 am
@David This shouldn’t normally happen. Maybe you could try installing the VC runtime libraries from MS: http://www.microsoft.com/downloads/en/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
I hope it resolves your problem.
January 14th, 2011 at 5:32 am
Great software! Please open source it!
January 22nd, 2011 at 1:51 pm
Hello Maciek,
First, excellent job!
I have a question and even if few people already asked it I didn’t found an answer. So forgive me if I am asking something what you answered many times before.
Here it is: Is it possible to use music from cgMusic in commercial indie app?
Antonin
January 22nd, 2011 at 5:28 pm
Hi Antonin. Unfortunately the music created in cgMusic cannot be used commercially.
January 23rd, 2011 at 5:04 am
Hi,
well, you made me sad but I must respect this. I am wondering if here is a chance to contact you.
mr.engeor@gmail.com
Antonin
January 31st, 2011 at 11:40 am
Hello Maciek,
Thank you for making your excellent program available. Do users of CGMusic have permission to post the musical output from this program to the internet when it is published in this manner non-commercially?
Thanks,
Clyde
January 31st, 2011 at 5:57 pm
Hi Clyde. Yes, you can post music from cgMusic on the internet non-comercially as long as it is clearly stated that the music was generated by cgMusic.
January 31st, 2011 at 7:22 pm
Thanks Maciek for your prompt and clear response.
February 8th, 2011 at 5:19 pm
Have a look at this: http://www.soundhelix.com/applet/SoundHelix-applet.jnlp
(needs sound and a browser with Java 6 plugin)
February 10th, 2011 at 6:02 am
I have created a (almost complete) reimplementation of cgMusic in Java. The scripts have been ported to Java.
What are your thoughts about that?
The main reason for doing this was to become better at generative music programming. I will not release the source if you don’t want that to happen although it would be great if you approved
Thanks for teaching me a lot about musical structure, rythms and styles!
February 10th, 2011 at 12:24 pm
Hi Per, this sounds very interesting
I’m glad that cgMusic inspired you to learn so much about generative music programming. I don’t have anything against you publishing what you created, just please make sure to include a note that it’s based on cgMusic. Best regards!
February 12th, 2011 at 4:39 am
Ok thanks!
A preliminary version of the source is available here:
http://www.springworldgames.com/jcgmusic/jcgmusic.zip
It might be fun to look at for you since you can see all my stupid implementation guesses
February 14th, 2011 at 6:41 am
Per, looks like you did a lot of work there. I’ll take a closer look at it when I find some time. Best regards!
February 16th, 2011 at 6:31 am
I am trying to take your abstractions of structure, sentences, phrases etc. and plug it into my reactive generative music module. The plan is to create a module for interactive applications like games. Unfortunately, I can’t reuse much of the reimplemented cgMusic code since my method of music generation is different.
Here is a very early demo of the reactive music module plugged into a game:
http://www.youtube.com/watch?v=YbDMyVVIJD0
The music is really bad in that demo but the idea/vision is pretty clear. With better structure, style and “rendering” etc, this can be really cool, thanks to cgMusic!
March 20th, 2011 at 4:49 pm
Check out SoundHelix at http://www.soundhelix.com
Generates cool tunes algorithmically…
May 4th, 2011 at 3:51 am
Congratulations for your revolutionnary software !
I’ve never seen a procedural music software as great as this one.
I have made a remix and an arrangement from one song generated by CGMusic, I used FL Studio + Omnisphere :
http://www.youtube.com/watch?v=bA2QWA52mQ8
It’s even better than some studio music, thank you so much !
June 22nd, 2011 at 5:48 am
Hi,
I discovered your programme through a piece in Computer Shopper issue 282 August 2011.
The MIDI file from any promising result goes to PG Music’s Band in a Box, which I find very useful. If only CG and PG could get together that would be something else. They should head-hunt you.
Best Wishes for a brilliant career,
Philip Fowler
August 2nd, 2011 at 8:05 am
This is damn impressive, I’m blown away!!!
October 12th, 2011 at 2:32 am
Simply AMAZING! You have done incredible work with this engine. This is definitely one of the best random music composers out there. Keep up the fantastic work =D
September 23rd, 2012 at 3:54 pm
Awesome software! What is the license? Please open source!
December 8th, 2012 at 6:12 am
Hi,
this is so nice that you have defined everything with editable scripts.
I added the harmony modules with an “more advanced” chords set and I am really happy with the results.
This is a great tool and framework to have fun with music theory
December 8th, 2012 at 6:45 am
Sorry to spam you like this,
a Question about “AddHarmonic” how do I add out of scale notes to chords ?
up.AddHarmonic(CreateTime(0,0), 1, “123567″); In key of c would result as “C major 6/9″ .
How could I add the d (2) one octave higher, resulting a different sounding inversion ?
So what if I wanted to add C# note to that chord what would the notation be ?
cheers.
December 8th, 2012 at 9:47 am
Hi psavolai. Frankly speaking it’s hard for me to remember such details, it’s been many years since I did cgMusic scripts. But if I recall correctly, the chords in the harmonic part could only contain steps from the selected mode, so I’m afraid it’s not possible to create complex harmonies on this level. But the render algorithms (the ones that write actual notes to the tracks) are free to change the notes as they please and do all kinds of inversions.
January 28th, 2013 at 7:52 am
Hi, First of all, great job with the software. I don’t know much about casual games, so I was wondering if casual games submitted to fgl.com are consider commercial. I’ve been doing lots of tutorials and finally I’ve started to create my own game. I’m planing to place it on fgl.com to see if I can sell a licence. Would it be possible to use songs created with this software in my project?.
Thanks and regards
January 28th, 2013 at 2:58 pm
Hi Ryan, I don’t see any problems with you using the songs in your software project as long as you include a statment that the music was generated by cgMusic and link to this page.
January 28th, 2013 at 6:14 pm
Wow thanks. You made my day. Then I’m going to keep working on my project and as soon as I finish it I’ll send you a link, so you can tell me if the statement is visible enough and you still allow me to use the music. Thanks a lot.
April 17th, 2013 at 9:08 pm
Thanks a lot for sharing your software! I was searching for an example of expert system to quote in a college lecture on management of information technology.
Well, for me you sound like a genius!
Thanks again!