r/PythonLearning • u/RaiseTLT • 3d ago
Showcase MUSIC THEORY AND PYTHON
Enable HLS to view with audio, or disable this notification
Hey everyone I just want to show off something cool and theory related I wrote on my free time over the past many months as I learnt how to program in python (my first programing language).
This is serial 12-tone matrix generator. It takes your input as numbers from 0-11 which represents your tone row. Currently it needs to be pre-transposed to 0 before inputting, otherwise the matrix wont generate in the correct order. BUT the math will still give you correct transpositions, just not in the correct order.
I like to write music using serial techniques, and I wrote this to facilitate the process of writing out the 12-tone matrix, which I find particularly tedious.
I wrote this entirely without the help of AI, I used books and youtube videos to learn how to do this.
My main source is "Python Crash Course" by Eric Matthes. I also used a book called Python Tricks, which helped me understand loops and how python handles loops at a deeper level. The many youtube videos that helped me with this I don't really remember anymore.
I'm not showing my code here because I want to keep it under lock and key since this took me so long to write, and I don't want anyone stealing my logic since I'm planning on implementing a ful GUI and more features in the future.
Please enjoy the short demo. :)
p.s. if you have any suggestion for features that would be cool in something like this feel free to share. Currently I have plans to add an input filter where the input does not need to be pre-transposed.
I'm also going to eventually incorporate the ability to generate modulus 2-12 matrices.
I'm also using numpy to handle the math on the input.
Super proud I finally pulled this off!
2
2
u/csabinho 2d ago
That's absolutely awesome. Would you mind putting the source code on GitHub, or at least PasteBin?
2
u/RaiseTLT 2d ago
Once my project is complete I will most likely put it on GitHub, but for now I'm keeping it under lock and key. Unfortunately, I don't have a time line for the completion since I'm doing this very much on the side!
2
u/ThrowawayALAT 2d ago
What is your ultimate goal with this, make your own version of Suno or something and for what type of music?
This is the musical equivalent of doing long division for fun.
2
u/RaiseTLT 2d ago
I’m a composer, I use serial techniques to compose music. Look up 12-tone serialism, and composers like Schoenberg, Boulez, stockhausen. I mix serial a-tonalism with tonal harmony to create interesting sounding classical guitar music. Previously everytime I wanted to use the 12-tone process I would need to write out those matrices by hand and do the math for every row. Then transcribe the note names into a seperate matrix for ease of use.
But with this script the process is automated(saving me lots of time I can poor back into composing), which from what I understand, Python is very good at automating things.I’ll never input my music into something like suno willingly.
My goal with learning programming is to build tools that will assist the human composer, rather than tools that will replace them.
0
u/ThrowawayALAT 2d ago
Hmm, got it. Just because it's a noble quest, doesn't mean others will follow. The reality is that there is room for both approaches, but for you, the true enjoyment comes from the process of building it yourself.
4
u/WhatADunderfulWorld 3d ago
Slap some Bach inventions in there. Good stuff.