WEBVTT

00:00:00.000 --> 00:00:02.495 align:middle line:90%
[SQUEAKING]

00:00:02.495 --> 00:00:04.491 align:middle line:90%
[RUSTLING]

00:00:04.491 --> 00:00:07.485 align:middle line:90%
[CLICKING]

00:00:07.485 --> 00:00:10.125 align:middle line:90%


00:00:10.125 --> 00:00:11.630 align:middle line:84%
PROFESSOR: Hello,
everybody, I want

00:00:11.630 --> 00:00:15.020 align:middle line:84%
to explain a little bit on
how we can visualize music

00:00:15.020 --> 00:00:19.160 align:middle line:84%
using music21 or other
tools, and how important it

00:00:19.160 --> 00:00:23.370 align:middle line:84%
is to be able to see what is
happening in a piece of music.

00:00:23.370 --> 00:00:26.030 align:middle line:84%
Rather than going through a
Jupyter Notebook, the User's

00:00:26.030 --> 00:00:29.060 align:middle line:84%
Guide to Music21
chapter 22, which

00:00:29.060 --> 00:00:33.350 align:middle line:84%
there's a link pasted into
the page that this is on,

00:00:33.350 --> 00:00:36.350 align:middle line:84%
has a good introduction
to some of the things

00:00:36.350 --> 00:00:40.370 align:middle line:84%
that you can do with
graphing and plotting.

00:00:40.370 --> 00:00:43.910 align:middle line:84%
We can go ahead and start
by importing everything

00:00:43.910 --> 00:00:44.940 align:middle line:90%
from music21.

00:00:44.940 --> 00:00:46.770 align:middle line:90%
We really only need the corpus.

00:00:46.770 --> 00:00:51.230 align:middle line:84%
And there's one piece by the
Italian 19th century opera

00:00:51.230 --> 00:00:55.650 align:middle line:84%
composer Giuseppe Verdi
from his opera Rigoletto,

00:00:55.650 --> 00:01:00.440 align:middle line:84%
called La donna è mobile, which
we can load in using this corpus

00:01:00.440 --> 00:01:04.370 align:middle line:84%
parse function and store
it's variable verdi.

00:01:04.370 --> 00:01:06.250 align:middle line:84%
Let's just look at
the first 10 measures,

00:01:06.250 --> 00:01:10.660 align:middle line:84%
and we can show it (SINGING)
bum, bum, bum, bum, ba, dum,

00:01:10.660 --> 00:01:12.710 align:middle line:90%
bum, bum, bum, ba, bum dum.

00:01:12.710 --> 00:01:15.380 align:middle line:84%
You probably may have
heard this before.

00:01:15.380 --> 00:01:17.900 align:middle line:84%
So this is a little
piano-score version.

00:01:17.900 --> 00:01:21.580 align:middle line:84%
And so let's just
get the vocal part.

00:01:21.580 --> 00:01:26.300 align:middle line:84%
And if we go ahead and
call on this excerpt--

00:01:26.300 --> 00:01:28.490 align:middle line:84%
oh, by the way, I don't
know if we fully explained,

00:01:28.490 --> 00:01:32.450 align:middle line:84%
you can extract a measure
range with these two numbers.

00:01:32.450 --> 00:01:35.540 align:middle line:84%
This is inclusive,
unlike Python,

00:01:35.540 --> 00:01:38.480 align:middle line:84%
and so this will include
measure 1 and measure 10.

00:01:38.480 --> 00:01:40.480 align:middle line:84%
And these are the
numbers according to how

00:01:40.480 --> 00:01:41.960 align:middle line:90%
a musician would think of them.

00:01:41.960 --> 00:01:43.700 align:middle line:90%
We can go ahead and plot them.

00:01:43.700 --> 00:01:46.720 align:middle line:84%
And by default, it creates
something we usually

00:01:46.720 --> 00:01:49.390 align:middle line:84%
call a piano roll because
it kind of looks like how

00:01:49.390 --> 00:01:53.380 align:middle line:84%
if you're going to punch
the rolls outside of things

00:01:53.380 --> 00:01:54.640 align:middle line:90%
like this.

00:01:54.640 --> 00:01:57.940 align:middle line:84%
You can go ahead if
you know matplotlib,

00:01:57.940 --> 00:02:00.460 align:middle line:84%
or another plotting software,
and create these things

00:02:00.460 --> 00:02:02.390 align:middle line:84%
on your own, but there's
a couple of things

00:02:02.390 --> 00:02:06.660 align:middle line:84%
that music21 will take care
of for you if I Zoom in.

00:02:06.660 --> 00:02:09.530 align:middle line:90%
Oh, there it goes, oops.

00:02:09.530 --> 00:02:11.320 align:middle line:90%
And some of them--

00:02:11.320 --> 00:02:13.850 align:middle line:90%


00:02:13.850 --> 00:02:15.860 align:middle line:84%
But there are some
things that music21

00:02:15.860 --> 00:02:18.330 align:middle line:90%
will take care of for you.

00:02:18.330 --> 00:02:23.000 align:middle line:84%
For instance, the pitch
will have octave marks

00:02:23.000 --> 00:02:26.190 align:middle line:84%
just on the C's or
wherever something is.

00:02:26.190 --> 00:02:28.700 align:middle line:84%
It will have correct
flat signs or sharp signs

00:02:28.700 --> 00:02:31.500 align:middle line:84%
and choose the right accidental
for what's happening here.

00:02:31.500 --> 00:02:35.810 align:middle line:84%
And things will be plotted by
measure, even if the measures

00:02:35.810 --> 00:02:38.490 align:middle line:90%
are difficult to deal with.

00:02:38.490 --> 00:02:42.920 align:middle line:84%
For instance, here's
the little example

00:02:42.920 --> 00:02:47.330 align:middle line:84%
where we use some pretty
weird accidentals.

00:02:47.330 --> 00:02:51.810 align:middle line:84%
The only C, really, is a
D double flat, or so on.

00:02:51.810 --> 00:02:53.880 align:middle line:84%
And it will put out--
you can barely see it,

00:02:53.880 --> 00:02:55.327 align:middle line:84%
but it will put
double flat there.

00:02:55.327 --> 00:02:57.660 align:middle line:84%
And if your measures are
different lengths, it'll do it.

00:02:57.660 --> 00:03:00.500 align:middle line:84%
So it's probably a decent
thing to go ahead and call

00:03:00.500 --> 00:03:05.590 align:middle line:84%
the music21 plot if you
want to visualize something.

00:03:05.590 --> 00:03:07.910 align:middle line:90%
We can load on another piece.

00:03:07.910 --> 00:03:14.560 align:middle line:84%
This is Arnold Schoenberg, late
19th and early 20th-century

00:03:14.560 --> 00:03:19.240 align:middle line:84%
composer from Austria, who is
considered one of the creators

00:03:19.240 --> 00:03:21.080 align:middle line:90%
of atonal music.

00:03:21.080 --> 00:03:23.360 align:middle line:84%
And we'll load his
piano piece, Opus 19,

00:03:23.360 --> 00:03:25.160 align:middle line:90%
and we'll load movement two.

00:03:25.160 --> 00:03:28.030 align:middle line:84%
This is just another way of
loading a specific movement

00:03:28.030 --> 00:03:29.210 align:middle line:90%
for a piece.

00:03:29.210 --> 00:03:32.780 align:middle line:84%
And we'll excerpt measures
1 through 4 and show them.

00:03:32.780 --> 00:03:34.790 align:middle line:84%
There's a couple
little problems here,

00:03:34.790 --> 00:03:39.970 align:middle line:84%
but you can see this piece, a
lot of (SINGING) bum, bum, bum,

00:03:39.970 --> 00:03:42.080 align:middle line:90%
bum, bum, bums in it.

00:03:42.080 --> 00:03:45.410 align:middle line:84%
And what we can do is,
in the plot command,

00:03:45.410 --> 00:03:47.330 align:middle line:90%
we can give it other things.

00:03:47.330 --> 00:03:49.040 align:middle line:84%
So we're going to
do a scatter plot.

00:03:49.040 --> 00:03:51.820 align:middle line:84%
We're going to map
quarter length to pitch,

00:03:51.820 --> 00:03:53.390 align:middle line:90%
and we'll give it a title.

00:03:53.390 --> 00:03:59.260 align:middle line:84%
See the G and the B,
and if we zoom in here,

00:03:59.260 --> 00:04:04.140 align:middle line:84%
we can really see, oh, yeah,
we're doing a scatter plot,

00:04:04.140 --> 00:04:06.920 align:middle line:84%
and we're making it darker
the more times things appear.

00:04:06.920 --> 00:04:10.190 align:middle line:84%
And we can see the
quarter length log 2.

00:04:10.190 --> 00:04:13.200 align:middle line:84%
So they're equally spaced
between 16th notes,

00:04:13.200 --> 00:04:17.465 align:middle line:84%
eighth notes, quarter, and half
note and see the various pitches

00:04:17.465 --> 00:04:17.965 align:middle line:90%
here.

00:04:17.965 --> 00:04:21.740 align:middle line:90%


00:04:21.740 --> 00:04:26.150 align:middle line:84%
The other thing we can do is
we can do a histogram of pitch

00:04:26.150 --> 00:04:27.840 align:middle line:90%
of octaves.

00:04:27.840 --> 00:04:30.830 align:middle line:84%
And we'll hide little
ticks for anything

00:04:30.830 --> 00:04:35.220 align:middle line:84%
that doesn't appear and put
the number of pitches here.

00:04:35.220 --> 00:04:41.540 align:middle line:84%
And we can really see
these two, the G and the B,

00:04:41.540 --> 00:04:43.410 align:middle line:90%
showing up a lot.

00:04:43.410 --> 00:04:46.490 align:middle line:84%
Or we can just restrict it
to specific pitch classes

00:04:46.490 --> 00:04:48.470 align:middle line:84%
and see the pitch
classes of G and B

00:04:48.470 --> 00:04:54.380 align:middle line:84%
without the octaves still
dominate on this piece.

00:04:54.380 --> 00:04:58.040 align:middle line:84%
You don't really need to
install matplotlib anymore

00:04:58.040 --> 00:05:01.020 align:middle line:84%
because it's now
included with music21,

00:05:01.020 --> 00:05:07.660 align:middle line:84%
but you will want, if you're
using Jupyter Notebooks,

00:05:07.660 --> 00:05:10.280 align:middle line:84%
to put this magic
command at the beginning.

00:05:10.280 --> 00:05:15.070 align:middle line:84%
And that will allow you to
view everything in line.

00:05:15.070 --> 00:05:17.800 align:middle line:84%
You can go ahead and
see what kinds of things

00:05:17.800 --> 00:05:21.610 align:middle line:90%
are there, horizontal bars.

00:05:21.610 --> 00:05:24.640 align:middle line:84%
We can plot, measure
number and quarter length

00:05:24.640 --> 00:05:28.570 align:middle line:90%
against the pitch, and so on.

00:05:28.570 --> 00:05:32.230 align:middle line:84%
Various pitch histogram,
scatter plots,

00:05:32.230 --> 00:05:37.840 align:middle line:84%
counts of how often various
pitch and note lengths appear.

00:05:37.840 --> 00:05:39.740 align:middle line:84%
We'll say how this
happens later,

00:05:39.740 --> 00:05:42.760 align:middle line:84%
but we can look at what
the range of the piece

00:05:42.760 --> 00:05:47.620 align:middle line:84%
is, How far apart it is in
various places, or what the keys

00:05:47.620 --> 00:05:51.430 align:middle line:84%
that are being detected in
various parts of the piece using

00:05:51.430 --> 00:05:55.300 align:middle line:84%
Carol Krumhansl-Schmuckler's
key analyses.

00:05:55.300 --> 00:05:58.490 align:middle line:84%
We can look at when
various parts are playing,

00:05:58.490 --> 00:06:02.150 align:middle line:84%
and I believe this
is how loud they are.

00:06:02.150 --> 00:06:06.320 align:middle line:84%
Some silly 3D graphs which
can be kind of helpful,

00:06:06.320 --> 00:06:09.570 align:middle line:90%
maybe but maybe not.

00:06:09.570 --> 00:06:13.310 align:middle line:84%
And it can also plot
against dynamics,

00:06:13.310 --> 00:06:17.480 align:middle line:84%
and you'll notice that it says
mezzo forte, forte, forte piano,

00:06:17.480 --> 00:06:19.250 align:middle line:90%
sforzando, fortissimo.

00:06:19.250 --> 00:06:24.750 align:middle line:84%
So that there's built-in
places for various dynamics.

00:06:24.750 --> 00:06:29.670 align:middle line:84%
You can see what kinds of Atlas
qualities there are, and so on.

00:06:29.670 --> 00:06:32.570 align:middle line:84%
So what we can do is we
can look at how various

00:06:32.570 --> 00:06:36.710 align:middle line:84%
composers, such as Robert
Schumann, a mid-19th century

00:06:36.710 --> 00:06:41.030 align:middle line:84%
composer, how he uses his
pitches in a particular string

00:06:41.030 --> 00:06:47.180 align:middle line:84%
quartet versus how Chopin
uses his in one mazurka.

00:06:47.180 --> 00:06:49.350 align:middle line:84%
Then always important
to go back-- sorry,

00:06:49.350 --> 00:06:52.850 align:middle line:84%
this is all distorted for
the video ==and look at how

00:06:52.850 --> 00:06:54.163 align:middle line:90%
the piece actually works.

00:06:54.163 --> 00:06:56.780 align:middle line:90%


00:06:56.780 --> 00:07:00.730 align:middle line:84%
In chapter 44, of the music21
User's Guide, completely

00:07:00.730 --> 00:07:03.580 align:middle line:84%
optional, it'll tell
you a little bit more

00:07:03.580 --> 00:07:07.730 align:middle line:84%
on how you can customize
plots with their title,

00:07:07.730 --> 00:07:14.410 align:middle line:84%
change the size of the figures,
change colors, and go ahead

00:07:14.410 --> 00:07:20.710 align:middle line:84%
and make other plots
highlight particular data,

00:07:20.710 --> 00:07:26.520 align:middle line:84%
and remove data, substitute
other things in there.

00:07:26.520 --> 00:07:29.680 align:middle line:90%


00:07:29.680 --> 00:07:33.980 align:middle line:84%
Not too much else, this is
pretty advanced things going on.

00:07:33.980 --> 00:07:38.777 align:middle line:84%
But we can look at offset
versus cardinality.

00:07:38.777 --> 00:07:41.110 align:middle line:84%
Well, you know what cardinality
is now, how many pitches

00:07:41.110 --> 00:07:43.300 align:middle line:90%
are sounding at once.

00:07:43.300 --> 00:07:48.640 align:middle line:84%
Notice this little nice pickup
measures at the beginning.

00:07:48.640 --> 00:07:54.610 align:middle line:84%
And maybe you want to plot
how a frequency in Hertz

00:07:54.610 --> 00:07:58.960 align:middle line:84%
goes against pitches but
show white and black keys

00:07:58.960 --> 00:08:03.590 align:middle line:84%
or in this case, red and
black keys over time.

00:08:03.590 --> 00:08:08.510 align:middle line:84%
And you can use this to make
some various other graphs that

00:08:08.510 --> 00:08:10.280 align:middle line:90%
might not come from data.

00:08:10.280 --> 00:08:12.920 align:middle line:84%
These are all kind of
interesting things.

00:08:12.920 --> 00:08:18.200 align:middle line:84%
Smoothing out how Bach's motion
works in a particular chorale.

00:08:18.200 --> 00:08:21.180 align:middle line:84%
There's a lot still to
be done with plotting,

00:08:21.180 --> 00:08:23.730 align:middle line:84%
but this is a
great way to start.

00:08:23.730 --> 00:08:28.710 align:middle line:84%
I'm also going to put in a link
to Edward Tufte's, or Tufte,

00:08:28.710 --> 00:08:31.580 align:middle line:84%
I'm not exactly sure, Visual
Display of Quantitative

00:08:31.580 --> 00:08:36.169 align:middle line:84%
Information, which is a book
that has absolutely shaped how

00:08:36.169 --> 00:08:40.110 align:middle line:84%
I think of what a good
ways of creating graphs,

00:08:40.110 --> 00:08:43.760 align:middle line:84%
why we want to create
graphs, and how do we

00:08:43.760 --> 00:08:46.730 align:middle line:84%
make the data stand out
and still be beautiful.

00:08:46.730 --> 00:08:50.000 align:middle line:84%
Thanks a lot for
listening and hope

00:08:50.000 --> 00:08:53.530 align:middle line:84%
to see some beautiful
graphs in the future.

00:08:53.530 --> 00:09:02.000 align:middle line:90%