Skip to main content

My new musical instrument: Python

It's still very young, but here is the library I've been working on for generating music in (nothing but) Python. "" is an example of what you can do. The real purpose isn't to code your music out this way, it's intended as a backend for generating / manipulating music. My end goal is a tab-based editor that plays back with this, but I'm going to keep working on this backend and hope some brave snake wrestler comes along and has the itch to write a proper interface (and if that doesn't happen, I'll start on the interface when I feel satisfied with the backend).

The Timeline and Hit classes are just ideas right now. I'm not sure they'll stay in the form they are (I'm thinking a guitar-oriented timeline, holding fret/string/amplitude per hit, is more along the lines of what I need).

I'm also on the hunt for efficient numpy/scipy implemented effects and sound sources. I've been playing around some with generating Karplus-Strong pluck sounds and delay/chorus/flanger effects, but I'm not exactly satisfied with the sound and runtime efficiency of what I have.

Be sure to check out the "minor" scale version of this "major" progression.

Also be sure to let me know if you have any advice on optimizing (without jumping into the C just yet) or creating a better code interface / representation of these concepts.


shi said…
Interesting project! As for the theory library, there seems to be some overlap with my GPL PyChoReLib project (i.e. a project to recognize chords from note lists, admittedly a bit old and written when I was mostly a newbie in python :) )

If it interests you, I would recommend checking out the svn version - it comes with some tests that show some of its possibilities.
Wybiral said…
That does seem like an interesting project. I'll have to explore it in more depth with I get a chance. Chord and scale recognition would be interesting for some of the procedural music experiments I want to perform with this project.

How would you feel about incorporating your chord recognition into python-musical (or me using your method in python-musical)? I'd like it to not have to import a project that has a separate scale and chord representation, it should be integrated.
Prizm said…
EAV Pro Audio stock a wide range of PA Speakers and PA Systems, Mixing desk, Power amps, audio interfaces, Wireless microphones and wired microphones along with a massive range of home and professional recording equipment.

Popular posts from this blog

Procedural music with PyAudio and NumPy

Combining two of my favorite pastimes, programming and music... This is the hacky "reduced to it's basic components" version of a library I've been working on for generating music and dealing with music theory.

Tweaking the harmonics by changing the shape of the harmonic components and ratios can produce some interesting sounds. This one only uses sine waveforms, but a square / saw generator is trivial with numpy.

It takes a second to generate, so don't turn your volume up too loud in anticipation (it may be loud).

import math
import numpy
import pyaudio
import itertools
from scipy import interpolate
from operator import itemgetter

class Note:

NOTES = ['c','c#','d','d#','e','f','f#','g','g#','a','a#','b']

def __init__(self, note, octave=4):
self.octave = octave
if isinstance(note, int):
self.index = note
self.note = Note.NOTES[note]
elif isinstance(note, st…

Build a Feed Reader in Python (Parts 7-9)

Part 07 Adding Jinja2 templates to a flask web application.

 Part 08 Adding static files so we can serve some CSS to style our app.

Part 09 Adding a background task to continuously update the articles while the application is running.

Write a Feed Reader in Python

I just started a new video tutorial series. This time it'll cover the entire process of writing an RSS feed reader in Python from start to finish using the feedparser module, flask, and SQLAlchemy. Expect to see about 3-4 new videos a week until this thing is finished!
Click to watch