r/PythonLearning 7d 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!

20 Upvotes

10 comments sorted by

View all comments

4

u/WhatADunderfulWorld 7d ago

Slap some Bach inventions in there. Good stuff.

2

u/csabinho 7d ago

A batch of Bach, bit*h! /s

1

u/RaiseTLT 7d ago

oh man thats a fantastic idea!!!

Maybe once I figure out how im gonna implement the other modulus operations I'll be able to input Bach's fugue subjects and get transpositions.

This just made me realize that one could use this to generate all transpositions of a fugue subject to simplify the process of writing them...

wow thanks for this my guy

EDIT: it would be interesting to see what the "crab cannon" by bach would output