Author Topic: PMusic - Procedural Music Generator  (Read 18485 times)

0 Members and 1 Guest are viewing this topic.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
PMusic - Procedural Music Generator
« on: May 03, 2013, 03:34:39 am »
So a couple days ago, I randomly thought of how awesome procedurally generated music would be, and when I looked, there is a (in my opinion) surprisingly small amount of these kind of things. So I decided to write one for fun. Right now, it is very very random sounding and it doesn't really flow at all, but it can still be kind of cool sometimes still, especially when you keep in mind it's all randomly generated :P I just started this, so it is very early, and will probably change a lot in how it sounds, but this is a very early showcase of how awesome this can be. Right now it loads up with the seed 666 by default, but you can change that. Everything about the song is randomly determined based on the seed. The program is written in java, and attached below. So try it out, and maybe post some of your favorite seeds and stuff!
Note: Large seeds work better!

Now, for those interested, here is a quick overview of he current process:
1. First, it chooses a random tempo (50-170bpm) and a random root note.
2. Based on that root note, I have a formula which transforms the set of integer numbers into the notes on a major scale based on the root note
3. For each measure, it first chooses a root note for the chord for the measure (based on the aforementioned formula), and plays the triad based on that note and in the scale for the root note. Note that I took out it choosing the seventh (a diminished chord) for now because when randomly stuck in there, most of the time it just sounds odd.
4. There are 32 ticks, or steps, in a measure, and each tick is equivalent to a 32nd note at the chosen tempo. So it then figures out how to fill up those 32 ticks with random length note from the chosen triad, varied randomly by octave, choosing lengths between half notes and thirty-second notes.
5. There is also a simple static drum beat, just to keep the sometimes very weird off-beat things that can happen from getting too disorienting
And that's about it for the current version! I hope to start adding things that make the notes and measures more dependent on each other to really make everything start going together better, and also add some generic formulas for some additional melodic parts to the song. There's also quite a few bugs I know of, but for now, enjoy!

NOTE: CHECK LATER POSTS FOR THE NEWEST VERSION.
« Last Edit: May 04, 2013, 02:22:12 am by cooliojazz »
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: PMusic - Procedural Music Generator
« Reply #1 on: May 03, 2013, 05:05:30 am »
Pretty neat little idea. I'll try to check it out when I have some time. :)

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: PMusic - Procedural Music Generator
« Reply #2 on: May 03, 2013, 06:38:19 am »
Congratz, it's pretty cool :)
« Last Edit: May 03, 2013, 06:38:26 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: PMusic - Procedural Music Generator
« Reply #3 on: May 03, 2013, 04:18:36 pm »
Whoa, it actually sounds quite good for being 100% generated!

EDIT: Maybe it would sound a bit better if you would add some repeating patterns.
« Last Edit: May 03, 2013, 04:22:05 pm by ben_g »
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: PMusic - Procedural Music Generator
« Reply #4 on: May 03, 2013, 04:25:57 pm »
If you don't say it's randomly generated, you could even make people believe you made it yourself. congrats! :D

edit: Idont seem to be able to change the seed.edit2: nevermind the number was too big :P
Also, can you add an option to remove the drums?
« Last Edit: May 03, 2013, 04:30:23 pm by aeTIos »
I'm not a nerd but I pretend:

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: PMusic - Procedural Music Generator
« Reply #5 on: May 03, 2013, 04:29:30 pm »
Is this the start of Brave New World? O.O

I kid :P This sounds quite good. Doesn't seem random at all O_o

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: PMusic - Procedural Music Generator
« Reply #6 on: May 03, 2013, 04:33:44 pm »
Seems I have a problem with my installation of Java, so I can't listen right now... :/

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: PMusic - Procedural Music Generator
« Reply #7 on: May 03, 2013, 04:40:47 pm »
Thanks guys! I think it's pretty cool myself :P
ben_g: I think that might be cool too, but I'm not sure how I would do something like that inside the procedural generation itself. Since measures are repeatable (giving the same measure number and seed will give the exact same notes every time) though, it would be easy to add a feature like that in the interface part.
aeTIos: I could, and I was actually planning on having them change with the mood and stuff too; on my "To-do" list. I mostly made it have the drum track in the first place because with how random it is, sometimes with a ton off offbeat stuff, it got kind of disorienting. It's getting better now, though, and will probably to continue to do so as I develop the algorithm, I hope.
Juju: What's wrong with it?

Here's a new version: I added dynamics variation and changed the background chord to strings. I also changed the note generation (and the new dynamics variation) to Perlin noise instead of completely random, which seems to "flow" a bit better. I even added a bit more to the gui, such as a little label that tells you the current note and chord being played! Lastly, I disabled 32nd notes for now, as they mostly just sounded odd.
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: PMusic - Procedural Music Generator
« Reply #8 on: May 03, 2013, 04:59:36 pm »

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: PMusic - Procedural Music Generator
« Reply #9 on: May 03, 2013, 05:01:25 pm »
Juju: What's wrong with it?
Code: [Select]
[julien@haruhi ~]$ java -jar Downloads/PMusic.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: no pulse-java in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at org.classpath.icedtea.pulseaudio.SecurityWrapper.loadNativeLibrary(SecurityWrapper.java:27)
at org.classpath.icedtea.pulseaudio.EventLoop.<clinit>(EventLoop.java:97)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:654)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:75)
at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1077)
at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1036)
at com.up.pmus.MidiPlayer.<init>(MidiPlayer.java:24)
at com.up.pmus.Main.<clinit>(Main.java:31)

Something with Pulseaudio, I guess. Something's wrong with Arch Linux's Java package. I'll check it out.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: PMusic - Procedural Music Generator
« Reply #10 on: May 03, 2013, 05:05:52 pm »
Scipi: Nice one! What seed is that?
Juju: Huh, yeah, that looks like an internal jre error.  :-\
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: PMusic - Procedural Music Generator
« Reply #11 on: May 03, 2013, 05:15:24 pm »
It was 666 :P

I can record other cool seeds as well.

This one is 117 :P

https://dl.dropboxusercontent.com/u/10573921/PMusic_2.mp3

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: PMusic - Procedural Music Generator
« Reply #12 on: May 03, 2013, 05:18:39 pm »
Juju: Huh, yeah, that looks like an internal jre error.  :-\
Apparently for some reason the headless version got installed during a system upgrade instead of the non-headless one...

Quoting the package descriptions:
Code: [Select]
[julien@haruhi ~]$ sudo pacman -Ss jre
extra/jre7-openjdk 7.u21_2.3.9-1
    Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - Full Java runtime environment - needed for
    executing Java GUI and Webstart programs
extra/jre7-openjdk-headless 7.u21_2.3.9-1 [installé: 7.u17_2.3.8-1]
    Free Java environment based on OpenJDK 7.0 with IcedTea7 replacing binary plugs - Minimal Java runtime - needed for executing
    non GUI Java programs

EDIT: Actually the jre package in the AUR was outdated. As simple as that. Brb fixing it.
« Last Edit: May 03, 2013, 05:24:31 pm by Juju »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: PMusic - Procedural Music Generator
« Reply #13 on: May 03, 2013, 06:42:28 pm »
This sounds even better than before!

I like seed 1234567890. After a while, it gets really good.

When the project is finished, could you release some information abouth how to do this? It sounds very interesting to do.
« Last Edit: May 03, 2013, 06:43:59 pm by ben_g »
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: PMusic - Procedural Music Generator
« Reply #14 on: May 03, 2013, 07:19:36 pm »
Yay got it to work. So yeah it sounds pretty good. Seed 0 throws a divide by 0 error after one measure though.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.