We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Enhancing Angklung Music Rehearsals with Python

00:00

Formal Metadata

Title
Enhancing Angklung Music Rehearsals with Python
Subtitle
Using Python to increase the quality of rehearsals of a traditional music instrument from Indonesia
Title of Series
Number of Parts
118
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Angklung is a traditional musical instrument from Indonesia. This instrument has a lot of variety in how it is performed; a common format is the orchestral format in which 15-30 players gather to form a team. Playing Angklung in this way is fun but also presents some challenges that are hard to solve manually. First, I will introduce you to the instrument and how it works/how it is played. Then, I will show you how Python-based algorithms can be used to ease the pains of managing Angklung teams, by reading Angklung-specific sheet music and calculating the most optimal distribution of Angklung based on several important factors.
Keywords
Point cloudGoogolGamma functionSoftwareFrame problemBitSoftware engineeringComputer programmingFrame problemLengthTunisLevel (video gaming)Greatest elementLatent heatOctaveFlow separationSoftwareMusical ensembleTube (container)Sinc functionLecture/ConferenceComputer animation
Frame problemKey (cryptography)Right angleComputer animationLecture/Conference
Moving average1 (number)Computer animationMeeting/Interview
Sampling (statistics)Musical ensemble
Cloning
Right angleFlow separationSurjective functionFile formatMusical ensembleDigitizingLine (geometry)Shape (magazine)Latent heatClefComputer animation
NumberEncryptionPositional notationReading (process)Different (Kate Ryan album)Musical ensembleNumberTranslation (relic)Latent heatFile formatBeat (acoustics)DeciphermentCryptographyClefArithmetic meanMultiplication signPositional notationCodeLine (geometry)Shape (magazine)QuicksortEncryption
Multiplication signLecture/Conference
Newton's law of universal gravitationCollisionBEEPExtreme programmingMultiplication signChemical equationDifferent (Kate Ryan album)Beat (acoustics)Computer animation
Chemical equationIntelligent NetworkLecture/Conference
Table (information)Row (database)Musical ensembleForm (programming)Sampling (statistics)Lecture/ConferenceMeeting/Interview
Open setDaylight saving timeRevision controlSource codeLibrary (computing)CollisionInformationRow (database)Sinc functionCellular automatonPiSpreadsheetLibrary (computing)Musical ensembleCollisionBeat (acoustics)Table (information)Right angleLatent heatOrder (biology)NumberInformationCodeSampling (statistics)Multiplication signOpen setEmailComputer programmingComputer animationDiagram
CollisionTable (information)InformationEmailElectronic mailing listComputer fileRow (database)Beat (acoustics)Musical ensembleCellular automatonLine (geometry)Quantum stateDivisorCollisionMultiplication signLatent heatShape (magazine)Dot productTable (information)AlgorithmInformationCombinational logicNumberLattice (order)Extension (kinesiology)Computer animation
Normed vector spaceInclusion mapCommon Language InfrastructureMaxima and minimaTotal S.A.Software development kitEquals signNumberMaxima and minimaTable (information)Greatest elementMultiplication signCellular automatonSign (mathematics)CollisionBeat (acoustics)Row (database)Point (geometry)JSON
Distribution (mathematics)Maxima and minimaCollisionComputer programmingCollisionLinear programmingDivisorNumberGoodness of fitChemical equationDistribution (mathematics)Maxima and minimaMultiplication signArithmetic progressionAlgorithmRight angleComputer clusterComputer animation
Distribution (mathematics)Maxima and minimaCollisionComputer programmingPointer (computer programming)AlgorithmResultantMultiplication signDistribution (mathematics)WeightDivisorFeedbackLatent heatCollisionMathematical optimizationComputer animationSource codeJSON
Data conversionAbsolute valueInclusion mapElectronic signatureMultiplication signLink (knot theory)Computer animation
Physical systemLine (geometry)Group actionError messageMultiplication signTable (information)Musical ensembleAlgorithmCollisionDistribution (mathematics)Absolute valueLecture/Conference
Dot productArithmetic meanGreatest elementRow (database)Line (geometry)Group actionMereologyMusical ensembleNumberQuicksortChord (peer-to-peer)Computer animation
Row (database)Mereology2 (number)Right angleComputer animation
Different (Kate Ryan album)Row (database)Musical ensembleGreatest elementDot productComputer animation
NumberAlgorithmMusical ensembleCASE <Informatik>Set (mathematics)Distribution (mathematics)Mathematical optimizationPresentation of a groupMathematicsDemo (music)Computer animationLecture/Conference
Transcript: English(auto-generated)
Thank you, everyone, and thank you for the introduction. Hello, everyone. My name is Bumi. And here, I'm going to show you how to enhance Angular performances with Python. First of all, a little bit of an introduction from 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 specifically 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 Anklung. 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 in Japan, you can go talk to me later. I have been an Anklung 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 Anklung rehearsals
and performances. So here, I'm going to show you how I do it. So first of all, has anyone here ever heard of the Anklung? No? Oh, 1%. That's great. So this is an Anklung. Here, I brought an example.
So as you can see here, the Anklung is made all 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 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 Anklung. So 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 Anklung
produce different notes. So as you can see, we need bigger Anklung to produce lower notes, and we need smaller Anklung to produce higher notes.
So you can imagine one Anklung as representing one key of a piano. So the bigger Anklung represents the lower notes, which are on the left of the piano, and the smaller Anklung produces higher notes, which are on the right of the piano. And as you may know, of course, we cannot play a whole
song with only one key of a piano. So we need a lot of these Anklung with various sizes to produce a song. So this is an example of an Anklung orchestra or Anklung team, which is performing in a concert hall. This is the Anklung 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 Anklung, each in their hand. And each of those Anklung also have different sizes, from the bigger ones about this size to smaller ones about this size.
So all of those Anklung 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 Anklung orchestra.
OK, so can anyone guess what the title of the song is? Is it all? OK, yeah, that's correct. It was the Star Wars main theme is played by the Anklung. So this also gives you a picture of how Anklung can actually 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 Anklung. So here, we are faced with a problem. So we have a lot of Anklung with various sizes and a lot of people in a team.
So how do we distribute those Anklung 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 Anklung, we found that there are several problems that come with distributing Anklung randomly
or really not caring about how we distribute the Anklung. So I'm going to introduce you to those things. But first, I need to introduce you to the Anklung 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's this shape of the G clef and also the shape of these bars, bar lines and stuff.
Well, this is a sort of sheet music everyone knows, but Anklung does not use this kind of sheet music. It uses different kind of sheet music, which when I googled the English translation, it is called the cipher notation. Or in Indonesian, we call it not anka. 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 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 Anklung 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 Do Re Mi song, you also know that these notes can also be pronounced Do Re Mi Fa Sol La Si, 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 relative notes. These are relative notes, and then they can shift.
So Do can mean C, and it also can mean D, depending on the song that we are playing. So for this example, the Do is equal to F. We can see on the top left corner that the Do is equal to the F. So 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, the Mi here and the Do here has to play at the same time. So what happens if one player holds a Mi and a Do
at the same time? Well, I will show you that it is very hard to play two ankh-lung at the same time. We need to choose which one we wanna play. In this example, it's kind of easy, but also it makes the sound very ugly. And sometimes one of the ankh-lung doesn't play.
So imagine if there are five ankh-lung, 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 re here, it only plays one beat throughout the whole song. So imagine if one player holds this ankh-lung and then he just stands there throughout the whole song,
only playing it 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 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 ankh-lung that we give to a specific player is aesthetically good. So for example, there are ankh-lung in the extremes that come to this size.
So when I stand here, the ankh-lung can be as this big. So the player has to hold it and shake it like this. And then there are some ankh-lung which are smaller, actually smaller than this one. It comes to maybe, oh, 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 ankh-lungs and we also don't want to give one player all of the big ankh-lungs. So if we give one player all of the big ankh-lungs, then he will become burdened by the size of the ankh-lung and then he will be unable to play.
And also the smaller ankh-lungs, imagine if one player has to hold five of these small ankh-lungs, then his 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 ankh-lung. So as you can see here, one player holds a quite big ankh-lung, the size of a table, and also a smaller ankh-lung on his fingers. So there can be about five or four ankh-lung, 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's another sample of ankh-lung 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've noticed, then it looks a lot like a spreadsheet. So usually this kind of sheet music is written in a spreadsheet program. And since Excel, Microsoft Excel is used a lot,
then fortunately we can read it using OpenPyExcel because in Python there's a library for everything, right? So we can use OpenPyExcel to read this sheet music that are written using Microsoft Excel. So basically we split the rows,
and then we connect 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 those ankh-lung to the same player. And also we can count the number of how many beats
a specific note plays in that song. So 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 program that I wrote.
So first of all, you load the workbook, and then we iterate through the rows. And then from the rows, we iterate through the cells, and then we count all of the notes that appear in that cell. And then when we meet an empty row, like from here, 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 gather the data about one sheet music, about the notes in the sheet music, and then how those notes interact with each other.
And then we basically summarize 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 do and the re meets 13 times. And then the do and the mi meets 40 times, which means the do and the mi are more likely to collide with each other in the song.
So we should avoid giving a combination of do and mi to the same player, whereas for example, re and mi only meet, play together for two times, which means it's kind of safe to give it to the same player because they only meet once
and then, well, it can be covered by another player in that certain collision. And another thing is playtime information. So in here, it's much more simpler. We only have a list of notes, do, re, mi and fa, and then the bottom row is the number of occurrences
of that song, how many beats that note plays in the song. So for example, this do plays 100 beats in the song and then the mi plays 76 beats and so on. So it means that we know that the, for example, the fa is the one that plays the least in the song and then we can give it to a player
with a less number of plays, yes? Oh, the zeros in the score. Okay, so the zeros are rests actually. So you know the music, in the Western sheet music, they have kind of specific shape for a rest, no notes.
Well, here we notate that using a zero. So one, two, three, four, five, six, seven is the actual notes that play and the zero is a rest. So you don't play anything there. And the dots are 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 sub beats. So half beat and half beat and so on like that. Okay, so here is the basic algorithm of how I create the collision table.
So basically, it's iterating through all the cells in a table and then we find valid notes in that cell and then we count the other rows, the other notes in that column and then we count how much 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 the middle. And then that's the table of the collision table and this is the play time. So this is much simpler. We just go through the whole score
and then we count the number in every cell. We just increment the play time of that specific note. And then we find like, for example, 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 whatever. Yeah, and then same as before, in the bottom, we normalize it to gain the play time 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, we want the minimum number of collisions for a specific player, but we want the maximum amount of play time for that specific player also. And we also want a good balance of size of the algorithm for that specific player. So this is kind of like linear programming
where we find the optimum value of these criteria. But also there is the factor of the good balance. So of course, this is still a work in progress and I haven't found the right algorithm until now. But of course, I'm still improving according to results.
So this is the final algorithm that I came up with until now, which is basically, so I assign a specific weight factor to each unclean that I would give to a player.
So for example, I have several players. Each of them don't hold that unclean initially. And then I iterate through each unclean. And then I determine which player has the biggest weight. So if the player already has unclean,
then I reduce the weight of 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 varying results. Sometimes it works and sometimes it doesn't.
And I'm constantly asking for feedback from my players and then asking them like, how can I improve this? Or do you have any ideas of how I might make this algorithm 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 calculated the collisions and the play time. And then I cross-produced them.
And then until it makes a specific value, optimum value. So 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 to distribute the unclean in the best way possible. And 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 pro script, 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 to actually prepare a concert. You're still not playing there. Okay, we have time for questions. I'm curious, how do they assign the unclones to the orchestra now without Python?
Trial and error, is it? Yes, absolutely. So we, before this algorithm, we used some kind of trial and error. So we, there's this system that you can calculate the collisions manually
using some kind of table. So you scan, you read the sheet music, and then you mark which unclones collide with each other, and then you make a distribution based on your judgment, whether that unclone is best given to which player, and then you try it on the team, and then you find out some errors,
and then you switch out the unclones until it's better. Yeah, so basically trial and error. Maybe I misunderstood 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, and this is the second line.
Well, unclon sheet music is kind of like that. So the notes that appear closer together are a chord. So basically they play together, whereas the one that's separated by this empty row is a different part of the song. No, that's not what I'm asking. It's like, why do you have zeros in the first row, for example?
Okay, so. Why don't you just group and sort? For every column you just have a bunch of 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 didn't you put one in the first row? Because the previous note stopped playing, and then you start playing one, right? Why aren't they sorted, for example? What are, there's apparently some meaning to each row.
Okay, so it's actually sorted based on the pitch. So if you can see here, 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 dots, so it's in the middle. But in the very first bar, you have empty row above? Oh yeah, there are empty rows, because not all parts in the song have the same number of notes playing.
Why didn't you just push everything to not have the first row? Like, why do you have the empty row then? 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 three in 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, three, one, 51. Three, one, five, one. Yeah, why wouldn't this 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 100 pixels. Oh, okay, I understand. So it's basically the arranger of the song decides where to put those notes. They can absolutely put it on the top row, as you said. Why not put the three, one, five, one on the top row? Why leave it empty, right? It's because the arranger decided to put it there.
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 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 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 your idea. The number of player is predetermined. The number of players is not predetermined. So you can have any number of players, actually. In your algorithm. Oh, in my algorithm. Do you decide in advance I will have 20 players and I want to optimize my distribution?
Or is it given? Or do you try and determine what the optimal number of players will be for score? In my specific algorithm, it is predetermined because we know how many players are in the team first and then we want to distribute the algorithm. Okay, that's what I wanted to know.
And my second question is, what do you do when you play the next song? Are you trying to optimize for a whole set? Or do everybody change instruments between songs? That's a good question, yes. So in this case, 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 songs 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 the answer,
I have to consider all of these songs together as one large performance, yes. Thank you, thank you very much. We are now going to the spins presentation and next to the lightning tools.
But before that, I propose that we thanks Timo for his great talk and explanation about the hard way to play music. Thank you. Thank you.