Questions tagged [music21]

A toolkit for computer-aided musicology

A python library developed at MIT for helping answer questions about music files. Full documentation here

157 questions
21
votes
3 answers

Install by default, "optional" dependencies in Python (setuptools)

Is there a way to specify optional dependencies for a Python package that should be installed by default from pip but for which an install should not be considered a failure if they cannot be installed? I know that I can specify install_requires so…
11
votes
1 answer

How to install package in anaconda?

I want to add music package to anaconda interpreter. I'm using ubuntu 14.04 64bit. I downloaded music21-1.9.3.tar.gz from anaconda cloud. I unpacked it to anaconda3/pkgs ext installer.py music21 PKG-INFO …
Július Marko
  • 1,196
  • 5
  • 15
  • 37
10
votes
3 answers

How to save output in music21 as a MIDI file?

How do I save audio output in Python using the music21 module? I have read the entire [user's guide](http://music21.readthedocs.org/en/latest/usersGuide/index.html] of said module, but I couldn't find any information about saving output as an audio…
Err403
  • 123
  • 3
  • 10
10
votes
3 answers

Creating images of notes in music21

I get an error when running: from music21 import * n1 = note.Note('C4', quarterLength=1) n2 = note.Note('A4', quarterLength=1) s = stream.Stream() s.append(n1) s.append(n2) s.show('lily.svg') Traceback (most recent call last): File…
Christian
  • 25,249
  • 40
  • 134
  • 225
9
votes
1 answer

Music21 Getting All notes with Durations

Im trying to get all notes with their durations(measures). from music21 import * allBach = corpus.search('bach') x = allBach[0] p = x.parse() partStream = p.parts.stream() for n in p.pitches: print "Pitch: " + str(n) print…
Nerzid
  • 457
  • 5
  • 15
8
votes
1 answer

music21: read MIDI file's BPM and instrument info and write it back to file

I'm trying to implement a code that reads MIDI file and writes it back. I have the following code to parse the duration,pitch,and position. import music21 from music21 import * piece=converter.parse('input.mid') all_parts=[] for part in…
ytrewq
  • 3,670
  • 9
  • 42
  • 71
6
votes
5 answers

Display of music21, musicXML PNG objects using iPython Notebook/Enthought Canopy

I am experimenting with the music21 library, in preparation for a Machine Learning project that involves genre classification and categorization. I and following some tutorials available here. I am using MuseScore as my MusicXML program, and I am…
Luis Miguel
  • 5,057
  • 8
  • 42
  • 75
6
votes
2 answers

How can I produce real-time audio output from music made with Music21?

How can I produce real-time audio output from music made with Music21. Failing that, how can i produce ANY audio output from music made with Music21 via open-source software? Thanks for the help.
5
votes
2 answers

Saving image files from Music21

I've downloaded a bunch of .krn files, and I'd like to convert them into images - either pngs or jpgs - using music21. I've tried this: When I do this: from music21 import * op = krnfile s = converter.parse(op) s.show() I see a great image file…
Alex S
  • 4,726
  • 7
  • 39
  • 67
5
votes
1 answer

Iterating over all notes in Music21

I am trying to get a table of information like the following for each note: Pitch - Octave - AbsoluteStart - Duration - Tied - MeterOfMeasure - Quarterlength For each of the notes in a stream (which can contain voices etc.). Is there an easy way to…
dorien
  • 5,265
  • 10
  • 57
  • 116
5
votes
1 answer

Music21: Get all Notes per Instrument from a MIDI File

I am parsing a MIDI file as instructed here. My code looks like this: from music21 import converter,instrument # or import * file = converter.parse('sample.mid') components = [] for element in file.recurse(): components.append(element) The…
sri
  • 744
  • 7
  • 20
5
votes
1 answer

Playing drum sounds in Python Music21 library

It's been a couple of weeks since I started reading the book "Making music with computers: creative programming in Python" and now i'm stucked while trying to play drum sounds with this library. I'm using Mit's music21 library, as the one proposed…
Julian
  • 51
  • 1
  • 4
5
votes
1 answer

Generating pdf & midi from musicxml

I've been trying to load a MusicXML file, edit it (removing several parts), and create a PDF sheet document + midi/mp3, all of this using Python. I've first looked at music21, that would load my MusicXML file right, but as far as I could find, would…
Joachim Jablon
  • 880
  • 8
  • 15
4
votes
1 answer

How to convert music file in ABC notation to midi or mp3 in Python

I have abc notation file and I want to convert it to midi or mp3 format. I did find music21 (docs) library to that says it can convert abc to midi but I could not figure out how. I also found a website mandolintab that can convert the file below to…
stha
  • 41
  • 1
  • 3
4
votes
1 answer

music21: displaying lyrics on rests

I want to write lyrics on music21 on both notes and rests (to show different metrical levels). I need both objects having a similar layout, but notes' lyrics position is different that rests'. Even more, some environments like lilypond don't even…
VR_1312
  • 151
  • 1
  • 13
1
2 3
10 11