r/Python • It works on my machine • Oct 28 '24

Showcase Algorithmic Music Generation with Python

Hi, all. I've been building this Python program on the side when I find time from my full time job for the last month or so. It's nowhere near finished but I wanted to share what I'm building with you guys just to get some feedback. I will keep posting updates about this project as I itterate.

Finally this project got to a point where the output sounds pleasant to me so I wanted to see If I'm the only one or am I on the right track. There is still a lot that doesn't work with this project as I can't find a lot of time to work on it.

There are some example videos on the Github page. UI on the videos are from an older version, so if you decide to run it for yourself (Which I don't recommand. Its really not worth the hastle right now.) you're gonna see a different UI with correct keys on the animations as opposed to the ones on the videos.

What works:

It picks a starting note. Based on the starting note and the defined scale, It picks 4 chords. It picks a way of playing those chords in terms of their timings. It picks random notes in the correct scale to generate a melody. It adds a very very simple drum loop on top of all. It shows what is being played on the screen as it plays. if you press f on terminal, it allows you to play freely with your pc keyboard using fl studio key bindings.

What I'm working on:

  • UI with buttons for start, stop freeplay, output midi, record screen.
  • More instruments, especially bass.
  • More drum patterns.
  • More complex melody algorithm to create intro verse chorus.

Please let me know what other features whould you expect from a program like this. I'm open to any kind of feedback. Let me know what you think.

  • What My Project Does: It algorithmically generates music.
  • Target Audience: just a toy project.
  • Comparison: Compared to other music generation libraries this one doesn't use AI to generate the music so it gives you complete control over the output.

Github

27 Upvotes

12 comments sorted by

View all comments

Show parent comment

2

u/Atiriko It works on my machine Oct 28 '24

I'm glad you like it mate. I found this schema at music.stackexchange. Based on this schema the program picks 4 chords and plays them over and over again. The way it plays is randomly picked from here where I predefined some chord patters https://github.com/atiriko/Music/blob/main/chords.py . I don't know a lot about music theory. I'm trying to learn as I go. If you have some good advice on which chords would work well with others and how I can make some variations, that would be really appriciated.

1

u/JamzTyson Oct 28 '24

Chord progressions based around the chords I, IV, and V (and variations) form the basis of a lot of music. These chord progressions are so common in Western music that they have their own Wikipedia page.

I would be happy to chat with you about music theory and algorithmic music, though I've never used reddit's chat feature, and I am away from home right now.

1

u/Atiriko It works on my machine Oct 28 '24

I'm new to reddit so I haven't used the chat feature before but how hard could't it be. Drop me a message would love to chat. I skimmed through the wikipedia page and it looks very interesting. I'll read it in detail and try to incorprate it to the program.

1

u/TitaniumWhite420 Oct 28 '24

And like, idk I would also happily join that conversation :P

1

u/Atiriko It works on my machine Oct 29 '24

Maybe discord is the way to go