 Thank you everyone, and thank you for the introduction. Hello everyone. My name is Bumi and here I'm gonna show I'm gonna show you how to enhance ongoing performances with Python First of all a little bit of an introduction for me I am from this country here in this little corner of the map that you never look at and This country is called Indonesia. I'm specifically from come from this city This little city called Bandung, Indonesia. It is the third largest city by population of Indonesia and it is the home of this little instrument. We call uncle. I'll show you later So yeah, I was born there and now I work as a software engineer for Henge, which is based in Tokyo, Japan So if anyone is interested in working working in Japan, you can go talk to me later I have been an unclean enthusiast for over 10 years I've been performing in several countries and also have been a conductor in several performances But here programming has interested me a lot more So before that since high school, I've been interested in programming and naturally I've been tinkering with software solutions to solve the problems that appear in unclean rehearsals and performances So here I'm going to show you How how I do it So first of all Has anyone here ever heard of the unclean? No. Oh one person. That's that's great. So This is that this is an unclean here. I brought an example So as you can see here The unclean is made is made all of back from bamboo from the frame and the two tubes This is also the frame in the bottom and Then how it produces sound is you just you just hold it in the middle And then you shake it from the bottom corner That produces a specific tune specific note musical note Which depends on the length of the tube of the unclean? so This small this smaller tube has the same pitch as the bigger tube But it differs by one octave. So it's only to make the sound stronger So if I hold this little tube here, it still plays the same note. So it's like this and then This is a smaller example. So as you can hear these two unclean produce different notes Okay, so as you can see we need bigger unclean to produce lower notes and we need smaller unclean to produce higher notes so You can imagine one unclean as representing one key of a piano. So This the bigger unclean represents the lower notes, which are on the left of the piano and the smaller unclean Produces higher notes, which are on the right of the piano and As you may know, of course, we cannot play a song a whole song with only one key of a piano So we need a lot of unclean of these unclean with various sizes to produce a song So this is an example of an unclean orchestra or unclean team, which is performing in a concert hall this is the unclean team of my high school and As you can see here, there are about more than 20 people here playing and each of them are holding about Four or five unclean each in their hand and each of those unclean also have different sizes from the Little from the bigger ones about this size to a smaller ones about this size So all of those unclean produce different notes and all of those notes come together to play a song And here I'm going to play for you a sample of the unclean Orchestra, okay, so can anyone guess what the title of the song is? You know, okay. Yeah, that's correct. It was the Star Wars main theme is played by the unclean So this also gives you a picture of how unclean can actually it can play any kinds of song You can imagine so not only traditional songs not only songs from my home country But also any kind of song that is now if you can hear it if you can play it on the piano or any other kind of Western instrument you can also play it on the unclean so Here we are faced With a problem So we have a lot of unclean with various sizes and a lot of people in a team So how do we distribute those unclean to those players? Well, of course the first thought that comes to mind is that we can just give them randomly, right? We don't need to think about how to distribute them specifically But in the course of my years of playing unclean We found that there are several problems that come with Distributing unclean randomly or really not caring about how we distribute the unclean. So I'm gonna introduce you to those things but first I need to introduce you to the unclean specific sheet music or musical score or whatever you call it so it's how you write the music onto paper or digital format So when you imagine a musical score the thing that comes to mind probably is some kind of this, right? So there are several shapes on several lines There there's this shape of the G clef and also the shape of these bars bar lines and stuff Well, this is a sort of new sheet music everyone knows but unclean does not use this kind of sheet music It uses different kind of sheet music which when I googled the the English translation It is called the cipher notation or in Indonesian we call it not uncle or when translated literally it means number notes so Sorry to disappoint you, but cipher notation has nothing to do with cryptography So cipher here means that we we encode the notes the pitches we hear into numbers So instead of shapes like the picture I showed you before we encode it into numbers like these so This is an example of unclean specific sheet music We read it like usual from left to right And then each column here you can see that these have like some kind of columns those columns represent one beat of the song and The bar lines here. They also represents the same thing as the Western sheet music which Represent bars so you can see here one bar in this sheet music consists of four beats so The notes here are represented by numbers like this if you know the door a me song you also know that These notes can also be pronounced though Ray me fossil asi and then back to do again But they don't necessarily mean C D E F and G in this format There is something called a relative notes These are relative notes and then they can shift so dough can can mean C And it also can mean D depending on the song that we are playing so for this example The dough is equal to F. We can see on the top left corner that the dough the dough is equal to the F so We now we can pay attention to the notes in the same column as I said they represent one beat of the song So that means that those notes that appear in the same column. They must play at the same time in the song, right? so For example them the me here and the dough here Has to play at the same time. So what happens if one player holds a me and a do at the same time? Well, I will show you that it is very hard to play two unclean at the same time We need to choose which one we want to play this in this example. It's very it's kind of easy But also it makes the sound very ugly and Sometimes one of the unclean doesn't play So imagine if there are five unclean and then we need to play the biggest one and the smallest one at the same time Well, that's pretty much impossible. So we need to avoid that kind of occurrence and another thing is That There are a lot of different notes here, right and not all of them play within the same amount so For example This note here the double lower ray here. It only plays one beat Throughout the whole song. So imagine if one player holds this unclean and then he just Stands there throughout the whole song only only playing at one beat and then just standing there until the song ends Well, that is also Another thing that we want to avoid. So we want to give a Player as many times as many notes as he can play but also avoiding collisions like the one I explained before and Also, there's one more thing we need to Take care that the balance of the sizes of the unclean that we give to a specific player is Aesthetically good. So for example, there are unclean in the extremes that come to this size So when I stand here The unclean can be as this big So the player has to hold it and shake it like this and then there are some Unclean that which are smaller actually smaller than this one it comes to maybe sorry maybe as small as this so it plays the really high notes and We don't want to give one player all of those small unclean And we also don't want to give one player all of the big unclean's So if we give one player all of the big unclean's then he will become Burdened by the size of the unclean and then he will be unable to play and also the big the smaller uncle's imagine if one player has to hold Five of these small unclean's then this hand will become very crowded and he couldn't reach each single one so There are three things that we need to take care about This is an example of the good balance of the sizes of the unclean So as you can see here one player holds a quite big unclean the size of a table and also a smaller unclean on his his fingers so There can be about five or four unclean can be more can be less depending on the skill of the player And we need to distribute them in such a way So how does python come into this you wonder so first of all here is another sample of Unclean sheet music as you can see here There are rows and columns in that sheet music So probably you can guess how this sheet music is written in a digital form if you You can notice then it looks a lot like a spreadsheet so Usually this kind of sheet music is written in a spreadsheet program And also since Excel Microsoft Excel is used a lot then Fortunately, we can read it using open PyExcel because in Python. There's a library for everything, right? So We can use open PyExcel to read these sheet music using My that are written using Microsoft Excel so basically we split the rows and then we connect the the rows such that it Forms one long row that is the whole song and then from there we can see that the rows in the same column Should be played together which means we cannot give the same those unclean to the same player and also we can count the number the number of how many How many beats a specific note plays in that song so we read we read it from left to right and then we give it Cell numbers like one two three four five for example. This is the code sample for the For the program that I wrote so first of all you load the workbook and then we Iterate through the rows and then for from the rows we iterate through the cells And then we count all of the notes that appear in that in that cell And then when when we meet an empty row like From here we need we meet an empty row then that means there is another We need to connect it like this in order to read it correctly, so from there We can we can gather the data about one one sheet music about the notes in the sheet music and then How how those notes interact with each other and then we Basically summarize those that information into two tables the first one is What I call a collision table and another is what I call playtime information. So in the collision table How you read it is that? The headers the column header and the row header you look at them. So for example in the top left cell We can see the dough and the ray meets 13 times and then the dough and the me meets 40 times which means The dough and the me are more likely to collide with each other in the song. So it's We should avoid giving a combination of dough and me to the same player. Whereas for example ray and me Only meet play together for two times Which means We it's kind of safe to give it to to the same player because they only meet once and then well It can be covered by another player in that in that certain Collision and another time another thing is playtime information. So In here, it's much more simpler. We only have a list of notes. Don't ray me and file and then The bottom row is the number of occurrences of that song. How many beats? That's that note plays in the song. So for example, this dough plays 100 beats in the song and then The me plays 76 beats and so on. So it means that we know that The for example the five is the one that plays the least in the song and then we can give it to a player with With a less number of play plays. Yes Oh the zeros in this in the score Okay, so the zeros are rests actually so you know the the music In the Western sheet music to have kind of specific shape for a rest. No, no notes Well, we here we notate that using a zero So one two three four five six seven is the note actual notes that play and the zero is Arrest so you don't play anything there and the dots are the the extenders so you play the same note as before and The lines above them are dividers So if there is a line above a specific column, then that means that beat is divided into two Subbeats so half beat and half beat and so on like that Okay, so Here is the basic algorithm of the how I Create the collision table. So basically it's iterating through all the cells in the table and then we find the valid notes in that in that cell and then We count the the other The other rows the other notes in that column and then we count how much they they appear together And then after that in the bottom, we normalize it. So the maximum value is one and then Zero point something in in the middle and then that's the table of the collision table and This is the playtime. So this is much simpler We just go through the whole score and then we count the number in every cell we just We just increment the the Playtime of that specific note and then we find like for example this The minus sign or the minus equal sign means that the beat is divided into sub beats Which means that the duration is half or quarter or or whatever Yeah, and then same as before in the bottom. We normalize it to gain the Playtime as a number between zero and one and Then we optimize the distribution. So based on those three factors that I said before The minimum number we want the minimum number of collisions for a specific player But we want the maximum amount of playtime for that specific player also And we also want a good balance of size of the unclean for that specific player so this is kind of like linear programming where we find the optimum value of of These criteria, but also there is the the factor of the good balance So of course, this is still a work in progress and I haven't found the The right algorithm until now so but of course we I am still improving According to the results. So this is the final Algorithm that I that I came up with until now, which is basically So there is a I assign a specific weight factor to each unclean that I would give to this unclean to a player so for example, I have several players each of them Hold don't hold that unclean initially and then I iterate through each unclean and then I I determine Which player has the has the biggest weight? So if if the player already has unclean then I I reduce the the weight of that that player And then if that unclean if that player has an unclean that collides with this unclean Then I reduce the weight of that player and so on Well, this has shown shown Varying results sometimes it works and sometimes it doesn't and I'm constantly asking for feedback for from my For my players and then asking them like how how can I improve this or do you have any ideas or of? How I might make this algorithm better better I also tried a different approach one time using genetic algorithms where I modeled the unclean as having Like I Generated a distribution randomly, and then I I calculated the collisions and the playtime and then I I cross-breduted them and then until until it Makes a specific value Optimum value so Inclusion in conclusion. There are many possibilities for future improvements of other aspects of unclean with this technology So we can use Python to basically improve the lives of conductors in Thinking how how to distribute the unclean in in the best way possible And I in this talk I also skipped a lot of details including key signatures the conversion of relative to absolute notes as I mentioned just before and I Could go on in a deeper detail, but there's the time restriction. So Well, that's what I can say today So thank you and a little proscript come work in Japan if you are interested then please open this link. Thank you very much Thank you a lot for your explanation about how hard it is like to actually prepare a concern. You're still not playing there Okay, we have time for questions I'm curious. How do they assign the ankluns to the orchestra now without Python? trial and error Yes, absolutely. So We before this algorithm of course we used some kind of trial and error. So we There's this There's this system that you can calculate the collisions manually Using some kind of table. So you you scan you read the sheet music and then you mark Which ankluns collide with each other and then you make a distribution based on your judgment whether that unclean is best given to which player and then you try try it on the team and then You find out some errors and then you switch out the ankluns until it's better. Yeah, so basically trial and error Maybe I missed the notes. It seems that the notes already have a line per something Is it like per person or because it's not like everything is grouped together? Yeah, so the groups here represent It's easier to show here. I guess so this sheet music also has a Big line here and it's also separated Like that's the first line. This is the second line. Well, I'm going to shoot music is kind of like that. So the the notes that appear closer together are a chord so basically They are they they play together Whereas the one that's separated by this empty row is a different part of the song No, it's not what I'm asking is like why do you have zeros in the first row for example, okay? So why don't you just group and sort if for every column you just Sounds together. What are the every one row of the three? What does it mean actually? Oh one row of the three is the One note so you can only put one note in one row and then the zeros there are to Signify that that note stops playing. Yes But for some reason you would put zero in the first row and one in the second row Why don't you put one in the first row because the previous notes stop playing you start playing one, right? Why don't they sort it for example like what I Really some meaning to each row. Okay, so it's actually sorted based on the pitch So if you can see here the there are dots in the bottom and dots in the top The dots in the top mean higher pitch and the dots in the bottom mean lower pitch so they are sorted so Let's take an example this bottom row here five and a three and a one The five is the lowest note because it has two dots on the bottom And then the three is the middle lower note because it only has one dot and then the one here has no dot So it's in the middle, but in the very first bar you have empty row above Oh, yeah, the end there are empty rows because not all parts in the song have the same number of Notes playing when did you just like push everything to not have the first row like wouldn't have Why do you have the femtiro then I Sorry, could you repeat why wouldn't you just push the second row up to not have the empty row above? Oh Because that's a different part of a song So it's not the the three in the top right at the top left and the three in the top left there Don't play together. It's a different part So you read it like from there to there and then the very first bar has two rows empty and non-empty Why do you have the empty row above? Why wouldn't you put the non-empty row above? The non-empty row is three mile three one Three one five one. Yeah, why wouldn't it not be above like why do you have the empty row? Well, because they play in succession. So after the three, there's the one Yeah, wouldn't they play in succession if you would have it on the first row and on the second first row Like move them up Okay, I understand so it's basically The the arranger of the song decides where to put those notes like they can absolutely put it on the top row Yeah, as you said, why not put it? Why not put the three one five one on the top row? Why leave it empty, right? it's because The the the arranger decided to put it there It's it doesn't it doesn't have any difference if you put it on the top or the middle row or the bottom row but it's nice to have the same pitches aligned together so the The first row there the first bar has the same pitches and it's all the lower pitch Which has one dot so it's better aligned to the one with the lower pitches, too Yeah, but basically you can you can also put it on the top. It doesn't matter Okay, so apparently even sheet music is difficult Any other question? Yeah, I've got two questions The first one just to understand if I got got your idea the number of player is pretty determined The number of players is not pretty determined So you can have any number of players actually in your algorithm. Oh in my Do you decide in advance? I will have 20 players and I want to optimize my distribution or Is it is it given or? Do you try and try and determine what the optimal number of players would be for first core in my specific algorithm? It is predetermined because we know how many players are in that team first and then we we want to distribute Yeah, okay, that's what I wanted to know and my second question is What do you do when you play the next song? Do are you trying to optimize for a whole whole set or? Do everybody change instruments between songs So in this case I have to I have to consider the whole set have to consider the whole performance Whereas one performance can have from one song to like Five songs in succession when it has five song in succession then I have to join those Sheet music together and then put it inside the algorithm and feed it into the algorithm So yes to get to the answer Have to consider all of these songs together as one like large performance. Yes Thank you. Thank you very much we are now going to the spins presentation and Next to in the lightning tools but before that I propose that we say thanks Timo for his great talk explanation About the hard way to play music Thank you