1 00:00:12,024 --> 00:00:17,840 >> Hello. Welcome back to Curlyboi Theatre,  everyone. I hope you all had a lovely lunch   2 00:00:17,840 --> 00:00:27,040 or time zone appropriate break. We have  an exciting afternoon of more fun talks   3 00:00:28,880 --> 00:00:46,320 ahead of us. So, first up, we have Tsz Tsz Kiu  Pang sorry. Being a musician, Pang has composition   4 00:00:48,720 --> 00:01:01,360 in his work. His most recent endeavor is  using the open software, Abjad, to create   5 00:01:01,360 --> 00:01:15,680 complexly notated musically. He is working to  maintain software for interesting musicians.  6 00:01:18,640 --> 00:01:27,760 TSZ KIU PANG: Thanks, Betsy. Hi. Sorry. Yeah, so,   7 00:01:27,760 --> 00:01:32,640 today I'm going to talk about how to compose  algorithmic music with Python and Abjad.   8 00:01:35,200 --> 00:01:41,280 I would like to acknowledge the traditional  owner of the land which I'm currently on,   9 00:01:42,080 --> 00:01:47,280 so the [Indiscernible] people and also the  [Indiscernible] of the [Indiscernible] nation.   10 00:01:48,480 --> 00:01:53,760 I would like to acknowledge that they  are the traditional owners of the land,   11 00:01:53,760 --> 00:01:59,600 which I'm on and I acknowledge the  elders, past, present and emerging.  12 00:02:04,160 --> 00:02:10,640 Yeah. Cool. Sorry. Sorry. Who am I? I'm Tsz.  And I have [Indiscernible] in my first name.   13 00:02:10,640 --> 00:02:18,880 So, I work as a DSP software engineer and when  I'm not working, I usually compose music and   14 00:02:18,880 --> 00:02:26,080 I perform music sometimes, as well. These are  my socials if you want to look for me online.  15 00:02:26,720 --> 00:02:33,600 All right. So, in today's talk, I would first, you  know, give some sort of background information to   16 00:02:33,600 --> 00:02:44,000 algorithmic composition, just a couple examples  and then we'll look into LilyPond, which is a   17 00:02:44,880 --> 00:02:50,960 music engraving software, then we'll be looking  at Abjad just a little bit more in detail,   18 00:02:52,000 --> 00:02:58,240 including how to extend Abjad, as well.  Then, I will talk about how to structure   19 00:02:58,960 --> 00:03:04,640 your composition as a Python package, at least  like the way that I do it, the way that I have   20 00:03:04,640 --> 00:03:11,200 been doing it. And, yeah, that's it. All right. Cool. So, the best way   21 00:03:11,200 --> 00:03:16,960 to introduce algorithmic composition  is to give a couple of examples. So,   22 00:03:16,960 --> 00:03:24,880 algorithmic composition is actually a thing that  has been there for a pretty long time, you know,   23 00:03:24,880 --> 00:03:32,240 much longer than computer was here. So, even  in time, back in the 18th century, I think,   24 00:03:33,040 --> 00:03:39,440 there was a pretty famous dice game.  So, the dice game go like this...so,   25 00:03:41,120 --> 00:03:47,200 you can probably see the figures on the slide.  So, the top picture, like we have kind of a magic   26 00:03:47,200 --> 00:04:00,320 square looking squares and music that Mozart has  composed. So, the performer or another composer,   27 00:04:00,320 --> 00:04:06,000 the procedure would be is something like this.  They would have to roll two dice and use the   28 00:04:06,000 --> 00:04:15,200 sum to look up a measure number. So, think of  measure number as an index to a Python list.  29 00:04:15,200 --> 00:04:20,320 So, basically, you know, using the sum to look  up a measure number and then they would repeat   30 00:04:20,320 --> 00:04:29,360 the process for however many times it's required  and finally concatenating a new piece of music.   31 00:04:30,240 --> 00:04:40,160 So, the general idea is kind of like to scramble  the music by, you know, random chance. So,   32 00:04:40,160 --> 00:04:46,320 you can see how, like, you know, there is a system  and different procedure to this composition or   33 00:04:46,320 --> 00:04:52,160 to this dice game. And it is very much doable by  computer, but obviously, like, people didn't do it   34 00:04:52,160 --> 00:04:59,760 by computer. I imagine I don't really know, but I  imagine they were doing it by paper and pen. So,   35 00:05:00,400 --> 00:05:12,080 yeah. So that was one example. In the early 20th  century, we have serialism, which is, you know,   36 00:05:12,080 --> 00:05:18,320 a new school of floats in music composition  and one of the really prominent techniques,   37 00:05:18,320 --> 00:05:23,520 in serialism, is the [Indiscernible] technique  and I'm really simplifying things here.  38 00:05:23,520 --> 00:05:31,520 So, we have a turn row. So, this is kind of,  like, the basic idea of the technique, which is   39 00:05:31,520 --> 00:05:37,440 based on a turn row, which is a series of nine  repetitive pitches. Apologies for those who do   40 00:05:37,440 --> 00:05:46,640 not read music. You can see the 12 different notes  on the slide there. So, they are nonrepetitive in   41 00:05:47,200 --> 00:05:52,800 a series and the composer can apply operations  on a turn row to generate music materials   42 00:05:53,440 --> 00:06:03,920 and transposition, inflection and retrograde.  And the composers would apply these operation,   43 00:06:03,920 --> 00:06:10,240 any of these operations to generate  music materials for their composition.  44 00:06:11,840 --> 00:06:18,720 So, we're looking to transposition first, we have  the original turn row. I am labeling each page by   45 00:06:18,720 --> 00:06:25,440 a unique page class number, which is ranging  from zero to 11 because we're dealing with   46 00:06:25,440 --> 00:06:33,680 [Indiscernible] technique. In western classical  music, in western music, in general, it is very   47 00:06:33,680 --> 00:06:44,320 much based on, you know, [Indiscernible]  like in an octave, zero to 11. So, yeah.  48 00:06:45,600 --> 00:06:53,200 With transposition, we're pretty much  preserving the row and moving it up or down   49 00:06:55,600 --> 00:07:05,440 and moving the turn row up by a turn, so, by a  little bit up. And, the operation that we apply   50 00:07:06,640 --> 00:07:13,840 to the original turn row can actually be done by  just one line of Python code, so you can like,   51 00:07:13,840 --> 00:07:22,160 you know, on my scene here, we have pitch,  plus two, 4 pitch in original turn row. So,   52 00:07:22,160 --> 00:07:28,480 that's, you know, that's the Python code that  we have to perform to transpose. Pretty simple.   53 00:07:29,040 --> 00:07:35,600 It is very much doable by a computer. Of course,  a lot of composer have been doing it by hand,   54 00:07:35,600 --> 00:07:40,720 which is fine, as well. But, you know, I just  would like to point out, well, you know, there are   55 00:07:40,720 --> 00:07:48,320 actually a lot of techniques in music composition  that can be done by a computer algorithmically.  56 00:07:49,600 --> 00:07:55,440 All right. So, next up, we have  inversion. We're presenting a contour,   57 00:07:56,400 --> 00:08:02,640 but we are flipping it upside down.  So, again, this is very much doable   58 00:08:02,640 --> 00:08:06,400 by just one line of Python code, you know,  just a list comprehension kind of thing.   59 00:08:07,680 --> 00:08:17,600 And we have five speech, 5 is a magic number in  here. Of course, if you want to, you know, change   60 00:08:17,600 --> 00:08:24,000 5 into 6 or 7, like, that is perfectly fine,  as well. It will just be, you know, transposed,   61 00:08:24,000 --> 00:08:31,440 like, up or down. So, like, moving up or down. And  then we the inverted turn row below. So, you know,   62 00:08:31,440 --> 00:08:38,560 that's how we generate the inverted turn row. Next up, we have retrograde. So at this time,   63 00:08:38,560 --> 00:08:45,200 we're preserving a contour. So instead of having  it upside down, this time, we're having it,   64 00:08:45,200 --> 00:08:52,160 you know, so we're flipping it sideways and  again, just one line of Python code and we are   65 00:08:52,160 --> 00:08:59,360 using the reversed method in Python to reverse the  lists and the rest, you know, plus two is just to   66 00:09:00,480 --> 00:09:06,480 move it up by a whole tone, basically.  Then we have the reverse turn row. So,   67 00:09:07,680 --> 00:09:11,120 you can see, like, all these  techniques, although they were invented,   68 00:09:11,120 --> 00:09:16,960 like, in the early 20th century, but a  lot of those, like, can actually been   69 00:09:16,960 --> 00:09:21,840 done by computer. Like, you know, using  today's technology, especially in Python.  70 00:09:22,960 --> 00:09:29,920 All right. So, yeah. As I've mentioned, those  were just a couple of examples of algorithmic   71 00:09:29,920 --> 00:09:36,800 composition. There are a lot of other techniques,  as well, so, there are some software which there   72 00:09:36,800 --> 00:09:44,080 are also some software which help composes  to compose music. With notation software,   73 00:09:46,400 --> 00:09:58,240 we have, you know, Sibelius. They're rely good at  doing their job, which is to notate music. We have   74 00:10:00,080 --> 00:10:14,400 OpenMusic and Bach. They can use the music to  generate music material kind of algorithmically,   75 00:10:16,160 --> 00:10:22,480 but to notate the actual music, like the composer  would often have to resort to using other   76 00:10:23,200 --> 00:10:27,280 softwares and kind of similarity  for notation software, as well,   77 00:10:28,000 --> 00:10:32,960 a lot of the software doesn't actually  provide algorithmically composition capability   78 00:10:33,520 --> 00:10:39,920 to the composer so they would have to resort to  using, you know, other software or composing by   79 00:10:39,920 --> 00:10:46,640 hand first to get the idea of what they want  in their [Indiscernible] and use the software.  80 00:10:47,760 --> 00:10:52,800 So, you know, that's why Abjad kind  of becomes really handy, because it   81 00:10:52,800 --> 00:10:58,160 kind of bridges the gap between the notation  software and the composition software. So,   82 00:10:58,880 --> 00:11:05,680 pretty much like everything can be done within  Abjad. So, both composition and notation.   83 00:11:05,680 --> 00:11:13,520 So, to get a better understanding of where  Abjad sits in this kind of software landscape,   84 00:11:13,520 --> 00:11:21,040 we would have to look at LilyPond first.  So, LilyPond is a music engraving program.   85 00:11:21,040 --> 00:11:26,160 So, it is not in terms of the interface,  it's not too different from Lapec.   86 00:11:28,960 --> 00:11:36,240 The architecture is obviously very different.  Here's a block diagram. So, it takes a plain text   87 00:11:36,960 --> 00:11:56,160 file, a .ly file as the input and it  can format files. So, like, you know,   88 00:11:56,160 --> 00:12:05,040 the ly file looks like this. You can see, c4  and then we have four notes here. That's kind of   89 00:12:05,760 --> 00:12:11,360 the idea of LilyPond. So, just taking  plain text, generating music notation.  90 00:12:12,960 --> 00:12:19,280 All right. So, I thought I would, you  know, give you a really brief look at, like   91 00:12:19,280 --> 00:12:26,480 of what a LilyPond file would look like. So, this  is an example from the LilyPond documentation.   92 00:12:27,360 --> 00:12:37,600 So, again, like, we have notes here. It notes  there, just kind of like a circle, like, you know,   93 00:12:38,160 --> 00:12:47,440 [Indiscernible] and, you know, those are musical  notes. And, yeah, so it corresponds. We have d4,   94 00:12:48,320 --> 00:12:54,080 ac and we can also see the number, which  indicates the duration of each note.   95 00:12:55,920 --> 00:13:02,800 Then, you can also see, like, there are features.  These vertical lines, which are, you know,   96 00:13:02,800 --> 00:13:10,400 corresponds to the line here and we also have some  key symmetries in here, as well. All those things   97 00:13:10,400 --> 00:13:16,960 you would have to specify in the LilyPond file and  it can generate all these features in the score.  98 00:13:18,400 --> 00:13:28,400 This is another example. You can see,  like, you know, even with this thing here,   99 00:13:28,400 --> 00:13:36,400 again, you can specify, in the LilyPond, and that  will generate yeah [Indiscernible] in the score.  100 00:13:37,520 --> 00:13:43,920 All right. And you can also do some, you know,  a little bit more complicated rhythmics in the   101 00:13:43,920 --> 00:13:53,280 music. You can use tuplet to group three notes  inside the space of two. Three divided by two   102 00:13:53,280 --> 00:13:58,640 and so on. This is just like couple of examples  of, like, what a LilyPond file would look like.  103 00:13:59,920 --> 00:14:05,760 All right. So, you know, those examples, they  are pretty simple. You know, they are not   104 00:14:05,760 --> 00:14:12,480 too many notes. Not too complicated rhythmic  stuff going on and the file relatively small,   105 00:14:12,480 --> 00:14:19,440 just a few lines. But you can probably imagine,  like, if I'm composing a really big piece, the   106 00:14:19,440 --> 00:14:27,520 file would be pretty large so this is kind of the  next slide. So, this file is just really large.   107 00:14:28,720 --> 00:14:33,200 You know, it's so many lines and apologies for the  font. It's just really small. I'm trying to fit   108 00:14:33,200 --> 00:14:41,040 in as much as possible on just one slide. And that  was only about one tenth of the file that was used   109 00:14:41,040 --> 00:14:48,560 to create this. So, this is my composition. And  this and this. So, like, not too much music here.   110 00:14:48,560 --> 00:14:55,280 I believe there are only 21 bars of music in  here. And, like, it takes a really large file   111 00:14:56,000 --> 00:15:04,400 a really large .ly file to generate all these.  So, like, if I'm kind of, like, engraving music,   112 00:15:04,400 --> 00:15:11,760 that's kind of fine. I know which note knows goes  where exactly and I know how to take those things.   113 00:15:11,760 --> 00:15:18,000 I have to do [Indiscernible] type the notes  into the .ly file and that'll compose for me.  114 00:15:21,680 --> 00:15:30,320 When it comes to composing, I often have to go  back and change things in my score and if I'm   115 00:15:30,320 --> 00:15:37,360 working with such a big file, a big, you know, .ly  file, and I would have to look for, okay, where do   116 00:15:37,360 --> 00:15:43,200 I want to change my score? Which note do I have  to change? It's just like, kind of complicated   117 00:15:43,200 --> 00:15:50,080 when I'm dealing with the music, note by note.  So, here is where Abjad comes in pretty handy.   118 00:15:51,760 --> 00:15:58,000 So, Abjad is a Python Package that helps compose  complex pieces of music notation in iterative   119 00:15:58,000 --> 00:16:06,160 and incremental ways and Abjad extends the Python  language. So, as a composer, I can use Abjad and   120 00:16:06,160 --> 00:16:13,920 utilize the power of the Python language and also  other Python packages to assist my composition,   121 00:16:13,920 --> 00:16:21,440 as well. And finally, Abjad wraps the LilyPond  notation software, which is demonstrated by   122 00:16:21,440 --> 00:16:30,240 this diagram here. So, we can create a table an  instance of Abjad voice, just a Python class,   123 00:16:30,960 --> 00:16:38,240 so, Abjad and voice and we have a music notation.  It looks like LilyPond code, but it's not really.   124 00:16:39,040 --> 00:16:46,160 And Abjad can understand that. It interprets that  and it can spit out LilyPond code when you call   125 00:16:48,560 --> 00:16:56,800 "Abjad.LilyPond." So you can call LilyPond to  compile the code for you and that will generate a   126 00:16:56,800 --> 00:17:06,800 music notation and even better, Abjad actually has  the capability to call LilyPond within itself, so,   127 00:17:07,840 --> 00:17:14,720 all you have to do is to create a table  an instance of Abjad.voice and that   128 00:17:14,720 --> 00:17:19,040 will call LilyPond instead  of Abjad and generate a PDF   129 00:17:19,040 --> 00:17:25,120 as the output. You don't have to look at the  LilyPond code at all. Bypassing the process.  130 00:17:26,880 --> 00:17:32,240 All right. So, to get, you know, a little  bit more taste of, like, how to use Abjad,   131 00:17:32,240 --> 00:17:38,560 I guess we'll start with a pretty simple example.  So, we'll start with just four notes. So,   132 00:17:38,560 --> 00:17:44,000 on my slides, here, we have of course, if we  want to use Abjad, we have to import Abjad.   133 00:17:44,000 --> 00:17:56,640 So, I have a list of pitches, from 0 to 11. I can  actually extend it to negative number and beyond   134 00:17:56,640 --> 00:18:02,160 11, as well, but I'm not going to go into  [Indiscernible]. So, what I'm doing here is to   135 00:18:02,160 --> 00:18:09,200 create a table an instance of Abjad.duration.  So, 1/16, that would be a 16th note.   136 00:18:10,320 --> 00:18:17,040 And for those of you who don't understand music,  that's fine, as well. So, 1/16th is just basically   137 00:18:18,640 --> 00:18:25,200 a musical note with a pretty short  duration so 1/16th of a bar, I think?   138 00:18:27,120 --> 00:18:32,640 Then we can use Abjad.leafmaker and provide  it with the pitches and the durations and   139 00:18:32,640 --> 00:18:40,800 that will generate the musical notes for us. So, the output of this piece of code kind of   140 00:18:40,800 --> 00:18:45,040 looks like this. You know, just, like, four  notes. So, you know, pretty simple, right?   141 00:18:45,680 --> 00:18:53,040 One almost suspects, well, why do I have to do  it in Abjad when I can just do it in LilyPond   142 00:18:53,040 --> 00:19:01,920 with probably fewer lines of code? But here's the  magic of Abjad. So, you can utilize the Python   143 00:19:01,920 --> 00:19:08,560 programming language, for example, I'm using some  list operation. Just like extending my pitches   144 00:19:08,560 --> 00:19:16,880 list by using a list comprehension kind of thing,  so I am extending my existing pitches using a full   145 00:19:16,880 --> 00:19:26,320 loop. This creates a list of [Indiscernible] 16th,  I think and then I'm doing exactly the same thing.   146 00:19:27,440 --> 00:19:41,760 Abjad.duration, 1/16 and using the leaf maker.  Leafs mean the musical notes sorry, the black   147 00:19:41,760 --> 00:19:49,680 dotted notes. So, the result kind of looks like  this. This is just me using a full loop in Python.   148 00:19:50,320 --> 00:19:57,440 So, yeah. You know, you can only see how I can  extend this technique even a little bit more.  149 00:19:58,960 --> 00:20:07,040 So, we can even retrograde the Melody by the  list. After extending the list, I'm extending   150 00:20:07,040 --> 00:20:17,920 the list and used reversed method. So, here I am  utilizing one of the techniques, but, you know,   151 00:20:17,920 --> 00:20:25,920 nothing stopped me from retrograding the Melody.  So, the result kind of looks like this. So, wow,   152 00:20:25,920 --> 00:20:30,960 like, we can really see the benefit of using  Abjad because, like, if I do it in LilyPond, like,   153 00:20:30,960 --> 00:20:35,920 it would probably take me, like, quite a while to  figure out, like, how to retrograde everything.  154 00:20:38,560 --> 00:20:47,840 And we can also play around a bit with rhythm.  So, specifying, like, 1/16th, I am using a list   155 00:20:47,840 --> 00:20:58,560 of three different durations, 2/16, 4/16. You  might ask, well, okay, what happens now? Because,   156 00:20:58,560 --> 00:21:03,440 like, the length of the duration of the list and  the length of the pitches list are different so   157 00:21:03,440 --> 00:21:13,680 I believe the pitches is of length 32, I think,  and durations is only of length 3. So, huh.   158 00:21:13,680 --> 00:21:20,720 [Indiscernible] not work but, you know, it will  actually still work. So, Abjad kind of you know,   159 00:21:20,720 --> 00:21:27,520 it will cycle through the list and Evan though  the two lists are of different length, Abjad   160 00:21:28,720 --> 00:21:32,640 will cycle through the list so the  result kind of looks like this.   161 00:21:33,840 --> 00:21:36,560 And now we are doing some, like,  complicated rhythmic stuff.  162 00:21:37,440 --> 00:21:43,680 And for those of you who reads music, you probably  noticed that, oh, there's something wrong with the   163 00:21:43,680 --> 00:21:54,880 music. If you don't read music, that's fine, as  well. In this bar line and so, like, there's quite   164 00:21:54,880 --> 00:22:00,720 a bit of space between this bar line and this  note over here. So, that's something wrong with   165 00:22:00,720 --> 00:22:08,160 the music because I am playing too much with  the rhythm so I would have to fix this problem   166 00:22:08,160 --> 00:22:16,640 and this is actually pretty easy to fix in Abjad. So, I can, you know, specify the meter apologies,   167 00:22:16,640 --> 00:22:22,480 it's musical time for those of you who  don't read music. But, yeah, in essence,   168 00:22:23,680 --> 00:22:28,400 I'm just, like, trying to demonstrate, all  right, there are, like, a lot of useful   169 00:22:28,400 --> 00:22:38,720 methods and classes in Abjad, here, I am  using Abjad. You can use, this is kind of   170 00:22:38,720 --> 00:22:50,000 like almost like really Pythonic kind of syntax. So, yeah. And then I'm just using the meter class,   171 00:22:50,000 --> 00:22:55,680 class method, rewrite meter and that will rewrite  the music for me, according to this meter.   172 00:22:55,680 --> 00:23:01,600 So what I'm trying to do is fix the duration  problem which occurred in the previous slides.   173 00:23:03,440 --> 00:23:11,360 So, yeah. Then we have fixed the duration problem  and we have a proper piece of notated music and,   174 00:23:11,360 --> 00:23:16,960 you know, I have been doing this, step by step,  and hopefully it's not too complicated but you   175 00:23:16,960 --> 00:23:23,840 can already see how Abjad provides a really  convenient interface for composer to compose   176 00:23:23,840 --> 00:23:33,760 music, step by step. I can also add other stuff  to the music as well. I'm going to add accents.   177 00:23:39,120 --> 00:23:51,760 I'm using a full loop. It provides some iterate  functions for us to iterate over the music. So,   178 00:23:52,960 --> 00:23:59,280 a lot of things are really object oriented.  I'm treating every note as an object.   179 00:24:00,080 --> 00:24:07,760 Here, I am iterating over the music and please do  not worry too much about the logical ties, it's   180 00:24:09,280 --> 00:24:15,280 more like an [Indiscernible] in there, but  essentially, I'm I am iterating over the   181 00:24:15,280 --> 00:24:22,960 music and adding accent for every three notes,  if you want, or every three [Indiscernible].   182 00:24:24,320 --> 00:24:30,480 All right. So, I'm using the attach function  to attach something to the music. So, you can   183 00:24:30,480 --> 00:24:38,720 probably see, like, I'm adding accent. By accent,  I mean this triangular looking thing to the music.   184 00:24:39,520 --> 00:24:46,160 This is really iterative. So, you know, I am doing  things, like, you know, step by step and I'm,   185 00:24:46,160 --> 00:24:51,520 like, complicating the music. You know,  just by a few lines of code every time.  186 00:24:53,360 --> 00:25:00,560 All right. So, as you can see, the core object  library provides many useful classes and methods,   187 00:25:01,680 --> 00:25:08,560 but they are not really enough to cover  algorithmic composition and techniques. So,   188 00:25:08,560 --> 00:25:14,800 current extension includes object, which is the  [Indiscernible] extension and the Abjad makers.   189 00:25:14,800 --> 00:25:20,960 So I'm not going to talk about it because I don't  know much about it. I'm going to talk about Nauert   190 00:25:20,960 --> 00:25:35,680 because I am using it. It is the extension. It  is based on [Indiscernible]. And it quantizes   191 00:25:35,680 --> 00:25:42,720 time based events into music notation. It looks  something like this. The composer would have to   192 00:25:42,720 --> 00:25:51,040 provide a list of duration and pitches and that  will be the input to the quantizer. It is very   193 00:25:51,040 --> 00:26:02,000 much configurable and generate music notation. So, to use the package, it would be something   194 00:26:02,000 --> 00:26:06,160 like this. So, pretty much similar to the  block diagram, which I've just shown. So   195 00:26:06,160 --> 00:26:15,040 creating a sequence, which is just a sequence  that the package can understand, by providing a   196 00:26:15,040 --> 00:26:23,840 list of durations and pitches and calling it with  the SD input and that will do something like this.   197 00:26:24,480 --> 00:26:32,880 You will be like, wow, and I really should have  mentioned the durations are in millisecond. So,   198 00:26:33,520 --> 00:26:38,720 yeah. One doesn't even have to understand that  much about music notation and they can, you know,   199 00:26:40,400 --> 00:26:42,720 write something that is as complicated as this.   200 00:26:44,480 --> 00:26:52,240 So, this is pretty useful, especially for,  you know, a top down approach for composition.  201 00:26:52,240 --> 00:26:59,040 All right. And of course, we can utilize other  Python package. So, as you can see, I'm using   202 00:26:59,040 --> 00:27:07,360 NumPy here. I'm defining a function using NumPy  to generate just a list of exponential distributed   203 00:27:08,720 --> 00:27:14,720 durations and using NumPy again to  select a you know, just a list of random   204 00:27:15,520 --> 00:27:20,240 pitches for me. And finally, using the  quantizer to quantize the events for us.  205 00:27:22,080 --> 00:27:28,480 Now we can create music in a rather abstract way.  By specifying the music duration or the total   206 00:27:28,480 --> 00:27:36,720 duration of that piece and the average duration  of each note, we've, you know, in seconds, then,   207 00:27:36,720 --> 00:27:43,360 you know, finally, providing with a pitch set so  just a list of pitches and we can have something   208 00:27:43,360 --> 00:27:50,160 like this and we can also increase the density  by decreasing the average duration of each note   209 00:27:51,840 --> 00:27:57,520 and now we have something like this, even more  complicated and now we are torturing the musician.   210 00:28:00,880 --> 00:28:07,040 By changing one number, we can have so  many different music generated for us. So,   211 00:28:08,320 --> 00:28:13,040 yeah. I've shown you, you know, how to use  the Abjad and how to use the extension,   212 00:28:13,040 --> 00:28:21,120 as well. But when it comes to composing  a really large piece, we can do it in,   213 00:28:21,120 --> 00:28:25,600 you know, in the Pythonic way, as well.  We can structure it as a Python package,   214 00:28:25,600 --> 00:28:36,560 which is something that is a lot of us are doing.  So you can see, like, we have README, just like a   215 00:28:37,440 --> 00:28:46,080 regular repository. As you can see, we have info  and set up the [Indiscernible] which indicates we   216 00:28:46,080 --> 00:28:53,200 can pypi and store this, if we want to. So, I'm going into the 47 40_directory.   217 00:29:01,840 --> 00:29:14,000 I can install them if I want to. The score will be  built in the builds directory and where I define,   218 00:29:15,200 --> 00:29:24,640 you know, each [Indiscernible] of my music and  finally, we can actually py test to see everything   219 00:29:24,640 --> 00:29:36,080 is working fine. This is my definition.py. So, you  can see, because I am treating this as a Python   220 00:29:36,080 --> 00:29:43,520 package, so I can actually import 47 from within  the directory, which is not part of the Python   221 00:29:43,520 --> 00:29:50,640 package, but because I'm installing other parts  of the 47, as a package, so I can import 47 here   222 00:29:51,680 --> 00:29:57,280 and I can use, you know, some of the modules  from within the [Indiscernible] directory.  223 00:30:03,200 --> 00:30:08,960 So, yeah, that was more, or less, about,  all I can talk about in a half an hour.   224 00:30:10,080 --> 00:30:18,800 If you want to learn more about Abjad, here is  the Abjad website and the quantizer documentation.   225 00:30:18,800 --> 00:30:25,840 There are also other music examples, as well,  in these few links. A lot of them, they have   226 00:30:25,840 --> 00:30:33,280 the link to the repository, as well. So, if you  want, you can have a look at their code. So,   227 00:30:33,280 --> 00:30:39,200 yeah. That's it. Thank you very  much for for your time and, yeah,   228 00:30:39,200 --> 00:30:49,360 I hope you will have a great day after this. >> Thank you so much Tsz, for that really,   229 00:30:49,360 --> 00:30:56,080 really lovely talk. I was saying, in the chat,  that I don't have a whole lot of music experience,   230 00:30:56,080 --> 00:31:00,720 but I was able to follow that, thanks to your  lovely explanations and it was really interesting.  231 00:31:02,640 --> 00:31:05,920 We don't have any time for  questions, unfortunately.   232 00:31:06,720 --> 00:31:12,080 Tsz, do you have some time to step  into the text chat to answer because   233 00:31:12,080 --> 00:31:17,520 there were a couple of questions entered in? TSZ KIU PANG: Yeah. Definitely. I will jump   234 00:31:17,520 --> 00:31:22,320 into the text chat, just in a moment. >> The Curlyboi Theatre chat,   235 00:31:22,320 --> 00:31:27,440 in Venueless, I will copy the questions  over there, everyone. Thank you so much,   236 00:31:27,440 --> 00:31:33,600 Tsz, for a lovely talk. I know there were a lot of  other music y and not music y people in the chat   237 00:31:33,600 --> 00:31:44,065 enjoying it, as well. So, thank you a lot. TSZ KIU PANG: Thank you very much, Betsy.