Looking at repeat block in Music Block Code(Coding Period III)

Abhijeet Singh
2 min readJun 19, 2024

--

Introduction to repeat block in Music Block

In this blog we are gonna look at repeat block and how we are going to add this in our parser when there is repetition

Repetition in abc notion is represented by (:)

X:1
T:Speed the Plough
M:4/4
C:Trad.
K:G
|:GABc dedB|dedB dedB|c2ec B2dB|c2A2 A2BA|
GABc dedB|dedB dedB|c2ec B2dB|A2F2 G4:|
|:g2gf gdBd|g2f2 e2d2|c2ec B2dB|c2A2 A2df|
g2gf g2Bd|g2f2 e2d2|c2ec B2dB|A2F2 G4:|

In above you could see that the repetition start from the first melody ie |:GABc till the next of the line G4:| Lillypond also have same notion for repetition

How repeat blocks looks like in MB

The Playing Structure would be A-> Odetojoy*2 ->B,now let us see how this would look like in MusicBlocks Code

you could see that the repeat block is added in the last even though i mean the block id even though repeat block is in the middle

Now i think this is not necessary for the abc notion because we know prehand where is the repetition is so we could add this repeat block in sequential way when parsing

But for initial let’s add the repeat block in the end and then update the connection with other blocks.

This week task update
1)Worked on Repeat block it is working for 1 repetition block when there is more than one block the block isn’t working because if its in the middle you have to look for many cases
2)This week i will fix that bug , and then we remove that part of code make it efficient by adding repeat block sequentially

In Next week we will look at how we could we optimize the code and use patterns

--

--

Abhijeet Singh

Software Dev @Vizuara | ex-5irechain( India's fastest unicorn) |