JcgMusic - A Java port of cgMusic

I have created a Java reimplementation/port of the popular cgMusic program

An executable jar:
jcgmusic.jar

A preliminary version of the source is here:
jcgmusic.zip

Here are some example result:
ballad 1
ballad 2
dance 1
dance 2
latin 1
latin 2
march 1
march 2
piano classical 1
piano classical 2
piano disco 1
piano disco 2
boogie woogie 1
boogie woogie 2
punk rock 1
punk rock 2
swinging blues 1
swinging blues 2

There are obviously some bugs left, but a lot of the features from the original cgMusic seems to work very good.

There are also possibilities to add greater control of the musical parts in the GUI, just like in the original program.
I don’t really know if you are allowed to use the songs that come out from JcgMusic commercially since the original doesn’t allow this. I will gladly allow it if you don’t claim any exclusive rights or do something obviously evil!

Enjoy!

Interesting. Swinging blues is awesome. So, can it generate and play in real time? Can I modify the knobs while it is playing? Eg, maybe I could use it to play mellow music that slowly switches between a few genres so the player doesn’t get bored, then as the player nears death, I would speed up the music. Is this possible? What is the state of Java MIDI? I seem to remember not all JREs have it. Can it generate PCM? That would be ideal.

Added some more examples.

Wow, exactly what a one man army needs :wink:
But unfortunately the “math” package is missing, any chance to get the whole source or an executable Jar / Webstart?

cgMusic is a static music generator. I plan to improve my own reactive music generator with cgMusic constructs to make it adapt to changes. The main reason for doing the port was to learn how cgMusic works. You can however generate many different versions that share the same structure etc. and switch between them depending on input.

I think that when you use the Gervill MIDI synthesizer, it has the same probability of success as Java Sound.

PCM is possible and very simple to add with Gervill’s help.

Ahh, my tangled source mess…

I have updated the source again but it does not compile yet however. I will sort this out by moving the few methods I use into the jcgmusic Utils class.

There is now a executable jar-file available here:
http://www.springworldgames.com/jcgmusic/jcgmusic.jar

A compilable source will be there soon as well…

I’m invisible, that’s cool. :stuck_out_tongue:

No, you’re not :frowning:

Me no understand? I thought that I answered your questions above? I forgot to quote you though…
I might got all of this wrong though :), but in case I didn’t:

cgMusic generates static music but you can generate many different versions and switch between them depending on input. The API supports setting separate scripts/modules and seeds for harmony, inner structure, melody, rythm, scale, tempo etc. You might want to check out the original program since it has a GUI.

You can use MIDI in Java if you use Gervill (that uses Java Sound) with a soundbank of your choice. You can also use Gervill to generate PCM but if you go that road you might want to use a better MIDI-synth that can do VST or something similar.

Ah, I see, thanks. :slight_smile: I was hoping for a drop in solution to my specific needs.

I’m working on it :slight_smile:

My reactive music generator, will be reinforced with cgMusic constructs and will kick some serious $#%

That is really cool! It would be even cooler if we could speficy what key to play in, and which to switch between. Also the option to disallow weird* choords would be great.

*…and by that I mean choords (inclusive the melody - right hand on piano), that has notes which fall out of the scale. I knwo this sounds great sometimes, but I hear some pretty “interresting” ( ::)) choords sometimes :stuck_out_tongue:

A bit of improvement and this is really good! Very nice tool for 99% of the people in here (Cas and Marcus actually makes money :-*)

This is possible in the API. In my extremely simple GUI you can only specify a overall seed, arrangement and structure.

In the API and the original cgMusic you can specify separate generators for each part:

  • harmonic rythm + seed for that
  • melody generator + seed
  • rythm + seed
  • inner structure (phrases etc.)
  • scale
  • chorus/verse/no melody hints
  • tempo change

You can for example keep changing the harmonic rythm seed until you like it and keep everything else intact.

If you try the original cgMusic, you can see what it possible to do with the API. I really recommend it since my GUI sucks :slight_smile:

I have also heard this “interesting” harmony and the strange non-harmonic notes. This is probably a bug in my reimplementation of cgMusic or when the jazz-harmony generator is suddenly used which add 7th and 6th chords all over the place. If you combine that with a random diatonic harmonic rythm and a random scale, strange/sophisticated chords will be inevitable.
But you can have a lot more control over the music than my GUI suggests.

Source code that should compile without any extra jars or hacks:

Link

Thank you for updating the links!
What is the license of this project?

I don’t know about the ported parts. You have to ask the maker of cgMusic about this since a large part of jcgMusic consists of ported scripts that ship with that program.

The reimplementation (my guess of how cgMusic works internally) is MIT.