This week we will be:
On a mac:
Go into your terminal application and type:
which python
We've been using Python 3 this semester (and you should probably avoid Python 2 at this point, unless absolutely necessary).
To see which version you're computer is currently using, type in:
python --version
Switching your python version can be a bit difficult.
Because of all of these version issues, I like to use pyenv
.
This process is fairly painless.
One way to update is with homebrew:
brew install python
Then find out where it's installed:
ls -l /usr/local/bin/python*
Then change the link like this:
ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
and then see if it's changed your version:
python --version
I think this is how it's done in Windows:
Installing music21 on a Mac:
##installing music21
sudo pip3 install music21
Configuring music21 from python:
import music21
music21.configure.run()
Configuring from the command line:
python3 -m music21.configure
On Windows, it's discussed a bit here: https://web.mit.edu/music21/doc/installing/installWindows.html
#@title Setting up music21 in the background. { form-width: "30%" }
# !pip install --upgrade music21
!add-apt-repository ppa:mscore-ubuntu/mscore-stable -y
!apt-get update
!apt-get install musescore
!apt-get install xvfb
import os
os.putenv('DISPALY', ':99.0')
!start-stop-daemon --start --pidfile /var/run/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
from music21 import *
us = environment.UserSettings()
us['musescoreDirectPNGPath'] = '/usr/bin/mscore'
us['directoryScratch'] = '/tmp'
!sh -e /etc/init.d/x11-common start
lamb1 = corpus.parse('palestrina/agnus_I_01', forceSource=True)
justTheNotes = lamb1.recurse().notes
searchList = [note.Note(type='whole'), note.Note(type='whole'), note.Note(type='whole')]
search.rhythmicSearch(justTheNotes,
searchList)
secondEntry = justTheNotes[107]
secondEntry
secondEntry.getContextByClass('Part')
secondEntry.beat
lamb2 = lamb1.stripTies(retainContainers=True)
justTheNotes = lamb2.recurse().notes
search.rhythmicSearch(justTheNotes,
searchList)