# LPMG (Lemon's Procedural Music Generator)

17 replies to this topic

### #1 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 18 April 2012 - 08:08 PM

Lemon's Procedural Music Generator, or LPMG as I've now dubbed it , is a music composition program that makes music from a mathematical algorithm. I have always loved fractal music & procedurally generated music so I decided to make my own generator. Check it out =)

Q: What is Algorithmic Music Composition?
A:Algorithmic music composition is the process of making music from an algorithm or process. This has been around for ages, from Pythagora's music theories, to Mozart's Musical Dice game, to advanced procedures & programs like cgMusic, or Lexikon-Sonate, & SoundHelix.

Q: How does this process work?
A: Lets say you have this algorithm:
```count = count + 1;
//Play note w/ piano key count
```
Every time a beat is counted this algorithm would play the next note up every time a beat is counted. Although this is a fairly simple algorithm it is still technically an algorithmic composition.
Here's another one that's a little bit more advanced:
```note[0] = 0;
note[1] = 2;
note[2] = 4;
count = irandom_range(45,85)
for (i=0; i<=2; i+=1)
{
if round(note[i]/count)=note[i]/count
{
//Play note[i]
}
}
```
This example will only play certain notes on a scale. This is a random choice, though, and the procedure is likely to never return the same results twice.

Here's a final example:
```//
note[0] = 0;
note[1] = 2;
note[2] = 4;
note[3] = 5;
note[4] = 7;
//
step = 5
count += step*count;
while count > 12
{
count -= 12
}
for (i=0; i<=4; i+=1)
{
if note[i] = count
{
//Play note[i]
}
}
```
This is will check if the note falls on the scale, and play if it does. This will always return the same result. By changing some variables (in this case step) you can change the outcome.

For more on Algorithmic/Procedural Music Composition/Generation check out this: Algorithmic Composition on Wikipedia

Change log:
v.1.2-B: New features: Pause, Randomize all tracks, Randomize all seeds, Vary all seeds, Randomize track, Randomize track seeds, Vary track seeds. New Save & load functions. Updated visuals. Fixed a few small UI issues, fixed a program breaking error regarding Delete Track.
V.1.1: Added save & load, Record (buggy), Single track pause, 5 new algorithms, ability to switch between algorithms
v.1: Initial release

YoYo Games Sandbox

v.1.1
v.1.0

Tell me what you think =)

Edited by Lemon Pie, 21 April 2012 - 11:13 PM.

• 6

### #2 junhalestone

junhalestone

GMC Member

• GMC Member
• 457 posts
• Version:GM8.1

Posted 18 April 2012 - 08:21 PM

Looks awesome!
I was working on one, but yours looks far, far better so I suppose I'll drop mine now
• 0

> PlanIt (WIP restarting June 12th. Need feedback and suggestions if you have them).
- Feedback (GMC)
- Game News + Comments (GameJolt)

### #3 JAk HAk

JAk HAk

sepius fidelis

• New Member
• 713 posts
• Version:GM:HTML5

Posted 18 April 2012 - 08:33 PM

Nice work. Although, I found listening to the music it produced to be very tense. Which is to say that the music never had any sort of release. Anyway, I'm hoping you keep at it and continue to improve upon it.
• 0

### #4 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 18 April 2012 - 08:35 PM

Looks awesome!
I was working on one, but yours looks far, far better so I suppose I'll drop mine now

Don't do that! Or if your going to please let me see your algorithm for generating music =) If it's good I'd add it in with my algorithms and give you credit for it :3
• 4

GMC Member

• GMC Member
• 393 posts

Posted 18 April 2012 - 08:59 PM

• 0

Please try "Huze" for Android. Final Beta.
FREE! Game Maker Compass and Grid PDF

### #6 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 18 April 2012 - 09:28 PM

• 1

### #7 junhalestone

junhalestone

GMC Member

• GMC Member
• 457 posts
• Version:GM8.1

Posted 18 April 2012 - 09:43 PM

Yeah - don't worry, yours is a LOT better than mine. I didn't use the DLL and it only had 16 notes, 1 instrument, the melodies created were fairly poor, etc :0

This is really good - nice work!
• 0

> PlanIt (WIP restarting June 12th. Need feedback and suggestions if you have them).
- Feedback (GMC)
- Game News + Comments (GameJolt)

### #8 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 18 April 2012 - 11:34 PM

Nice work. Although, I found listening to the music it produced to be very tense. Which is to say that the music never had any sort of release. Anyway, I'm hoping you keep at it and continue to improve upon it.

That has to do with the DLL. AFAIK there is no way to add release easily & on the fly.

Yeah - don't worry, yours is a LOT better than mine. I didn't use the DLL and it only had 16 notes, 1 instrument, the melodies created were fairly poor, etc :0

This is really good - nice work!

Not bad for like 3 days, eh? Haha
Anyways I still would like your algorithm if you don't mind =3 I plan to add alot of algorithms for the user to choose from & you'd get credit if I use it of course =)

Edit: Here's a test of the record function! Wewt!
It runs flawlessly in Windows Media Player, however it reads as "Corrupted" in Anvil Studio, and in TunaFish does not import correctly. I believe this has to do with the way the DLL records notes with it's most basic function. I'mma try with the more advanced functions and see if that solves the problem.

Edited by Lemon Pie, 19 April 2012 - 07:25 AM.

• 1

### #9 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 19 April 2012 - 06:21 PM

Updated to v.1.1
Record (buggy, but its there)
Save and Load (w/ Custom File Extension)
Single Track Pause/Mute
More algorithms
Changing of algorithms

And some songs I made if you download from MediaFire :D (my personal favorite is called This Feeling)

Com'on peeps! Post your tracks or screen shots of them!
• 1

### #10 junhalestone

junhalestone

GMC Member

• GMC Member
• 457 posts
• Version:GM8.1

Posted 19 April 2012 - 06:23 PM

Cool - I might PM you my algorithm then. But seriously it's something I'm not too proud of
• 0

> PlanIt (WIP restarting June 12th. Need feedback and suggestions if you have them).
- Feedback (GMC)
- Game News + Comments (GameJolt)

### #11 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 19 April 2012 - 06:40 PM

Cool - I might PM you my algorithm then. But seriously it's something I'm not too proud of

Haha its all cool. Before I got the idea from MusiNum to parse the output numbers through a binary converter my algorithm sucked a big one and was slow as hell (it was probably worse & slower than yours TBH)
See as long as yours can output a number then I can use it. If it out puts a large number then thats even more awesome cause I can parse it through binary like a boss and be even more likely to get a note playing.

...
Oh yea something I may have forgot to add into the help file: After starting a record you have to press 'Enter' to end it.
• 1

### #12 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 21 April 2012 - 11:07 PM

Updated to version 1.2-B
New features: Randomize all tracks, Randomize all seeds, Vary all seeds, Randomize track, Randomize track seeds, Vary track seeds. New Save & load functions. Updated visuals
Bugs/fixes: Fixed a few small UI issues, fixed a few program breaking errors regarding Delete Track.

This version is not backwards compatible w/ v.1.1 and you cannot load the songs from 1.1 into 1.2b. However if you download from MediaFire there is a converter that will take your old .lpmg files and convert them into .lsf
• 0

### #13 junhalestone

junhalestone

GMC Member

• GMC Member
• 457 posts
• Version:GM8.1

Posted 25 April 2012 - 09:58 PM

The new visuals look awesome!
• 0

> PlanIt (WIP restarting June 12th. Need feedback and suggestions if you have them).
- Feedback (GMC)
- Game News + Comments (GameJolt)

### #14 Lemon Pie

Lemon Pie

GMC Member

• GMC Member
• 196 posts
• Version:GM:Studio

Posted 26 April 2012 - 07:00 AM

The new visuals look awesome!

Thanks =) Although the background was done to simply make it look nicer, adding the opaque-ness to the track-windows was done out of practicality, so that you could see tracks underneath of others.

Well since I'm at it...
An Update: I am trying to get the record function to work properly, however I cannot seem to figure out the problem that causes the MIDI headers to corrupt. :-/ If anyone has experience using Midi Notes' record MIDI record functions I would gladly appreciate some help.
• 0

### #15 hippyman

hippyman

Dirty Stinky Hippy

• GMC Member
• 837 posts
• Version:GM:Studio

Posted 04 July 2014 - 09:26 AM

Dude I'm going to check the crap out of this. I'm just drooling while I read the op!

EDIT: Not exactly what I thought it was but still really cool! Great job!

-Hippyman

Edited by hippyman, 04 July 2014 - 09:34 AM.

• 0

HM Audio Soundcloud: https://soundcloud.com/hm-audio

### #16 Repix

Repix

Goodbye!

• GMC:Member
• 816 posts
• Version:GM:Studio

Posted 04 July 2014 - 02:49 PM

Looking real good Lemon Pie.

+1

Take the pistol, aim the front towards yourself, pull the trigger, why? because it's not a prank gun no longer.

### #17 Yal

Yal

Even though the GMC may be gone, our love will prevail eternally

• Global Moderators
• 11774 posts
• Version:GM:Studio

Posted 04 July 2014 - 06:12 PM

Important thing that's missing from the OP: what formats does it export to? WAV/MIDI/custom only? Can you load your own samples to use as instruments?

• 0

- The above is my personal opinion and in no way representative of Yoyogames or the GMC, except when explicitly stated -

Open this spoiler for my games:

Spoiler

Some useful game engines, music and other resources at affordable prices:

My collection of game resources at itch.io

New user? Can't draw but want to look unique? You can request a new avatar in this thread!

### #18 Lukan Spellweaver

Lukan Spellweaver

Gay Wizard Freak & mcmonkey's plaything

• GMC Member
• 3704 posts
• Version:GM:Studio

Posted 10 July 2014 - 03:09 PM

That was horribly rude and not constructive.
Considering this was made in 2012 in GameMaker, with a dll, I think this is fairly good.
Proc music is very intriguing, and the fact that Lemon Pie took the time to make this tool for other devs shows how commited they are to this.

I like the music it produces, and think it is a cool idea.

Also, your post breaks forum rules.
• 0