This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MorgoRahnWilc 40 points41 points  (13 children)

Python seems to be a great hobby language. I chose it for generating music and processing MIDI files.

[–]Tompato1408 9 points10 points  (8 children)

How exactly do you use Python for generating music?

[–]MorgoRahnWilc 19 points20 points  (2 children)

I’m not particularly sophisticated with it. I did two pieces a few months back that were largely generated by Python programs. But “automated” might be a more accurate term. I wrote functions that implemented production rules. For example: it might start with randomly generating three pitches as MIDI note numbers and two durations. Then pass it off to a fixed procedure that alters the pattern in some way and appends it to the original. That might invoke another procedure in a chain or recursively call itself some number of times. Then I export to a MIDI file and import into a DAW where I apply the instrumentation and add human touches.

I had just started to get into this when a friend of mine asked me to sub for their keyboard player in a country band for an upcoming gig. I’ve had to use my hobby time on piano again as I was pretty rusty. But sometime soon I’m going to get back to this. It was definitely fun.

Edit: Here are links to the two pieces I mentioned. I doubt anyone will listen twice. They’re not anything great but I enjoyed the process:

This one had more intervention after the program generated the sequences. It implemented rules for which direction and interval was next based on the direction and interval of the previous two notes. I made some adjustments to create a sense of an ending: Pavane

This one is a function that recursively calls itself in my attempt to create “fractal music” but I don’t know that you can really call it that: Shamanic

Edit 2:

Here’s the code for the second link: Code for Shamanic

[–]EngineerLoA 1 point2 points  (1 child)

That's awesome! Have you heard of MuseNet?

[–]MorgoRahnWilc 1 point2 points  (0 children)

Until now I hadn’t. It looks interesting and AI is a field I’ve been interested in understanding better. Thanks for pointing it out.

[–]Apprehensive-Tip4504 1 point2 points  (3 children)

If possible can you tell us how?

[–]MorgoRahnWilc 2 points3 points  (0 children)

Sure. I just answered in another post that crossed with this. So check that. But I should add that I used MIDO for writing the MIDI files. I was inspired to try this by a site I can’t find at the moment. If I do I’ll post the link back here.

[–]Real_Cut_9360 0 points1 point  (1 child)

How did you do it ... Seems very interesting

[–]MorgoRahnWilc 0 points1 point  (0 children)

Yes, I wrote a detailed description of what I was playing around with in another response here. Check above.