Weekly Progress of GSoC: Scale Degree vs n^th modal pitch.
This is first in a series of blogs that I’ll be writing to document my Google Summer of Code progress.
First Week: 4/05/20 – 11/05/20
On 4th May 2020, I received the mail at 11:30 PM that my project Scale Degree vs n^th Modal Pitch has been accepted. The moment was wonderful as 3 months of hard work had finally yielded results.
I really looked forward to working with Music Blocks mentors and Sugar Labs community.
The first month, as part of the program, is termed as community bonding period. Its aim is to pair students with mentors and encourage them to form a close and formal relationship with them meanwhile also diving deeper into the organization community.
Later that day, I received an E-Mail from Walter Bender, Founder of Sugar Labs and maintainer of the Music Blocks project, congratulating me and fellow student developers who got selected for the Music Blocks project. After that, he invited us to for a daily meeting at 5:00 PM IST which would serve as a common stand-up point for various people involved in Music Blocks project [including mentors and students] to catch up with each other.
Cut to the next day, we had our first meeting on the 5th of May on Jitsi. I was kind of unprepared for the meeting that day and joined a little late. The meeting was attended by Walter, Vaibhav D. Aren (Mentor), Anindya Kundu (fellow student developer), and me. It was mostly introduction and Walter expanded on our thinking of Music Blocks, explaining its pedagogical implications. Later that day, I played around a little with a fun project made by Walter over the weekend.
The next day we had a short meeting with much better participation. It was decided during the meeting to finish remaining work on ES6 porting of the entire Music Blocks code base which involved:
- Conversion of var to let
- Conversion of regular functions to arrow functions
There were a number of open Pull requests on the issue and we worked together peer reviewing those and getting the changes merged.
Just after the team meeting came to an end, I had my first meeting with my project mentor Devin Ulibarri and Sumit Srivastava (Mentor). Devin gave me an idea of basic music theory and while experimenting with a Music Blocks project we encountered a bug in the way octaves are calculated for the current scale degree block.
Theoretically, when playing a scale, an octave must change whenever we cross note B.
Down that week we merged a number of PRs related to ES6 porting. Namely:
During group meetings, I had discussions with Walter regarding the functionality of musicutils.js file in Music Blocks and the redundancy present in it. I am on the lookout for improving its working. This file handles all the backend work related to creating a scale for a particular key, calculating octaves, handling transposition, etc. In essence, it is the crux of the musical-mathematical mapping that is Music Blocks and it falls under the domain of my project in its entirety.
During further meetings with Devin, he built upon various of my musical concepts. More or less he took a music class, each day, spanning for an hour and a half and that really gave me a headstart to work with all the musical stuff inside MB. Before my selection, my contributions were largely focussed on the Javascript bugs that popped up and I was never comfortable starting with a issue that required me to have knowledge of some music theory. Devin has worked very patiently to bridge that gap for me.
Towards the end of the week, I figured out the underlying cause for the octave bug.
What you see above is a code snippet from calcOctave() inside musicutils.js. This line instantly returns the value held by the octave argument of the scale degree block (soon to be renamed as n^th modal pitch), doing a sanity check that octave isn’t less than 1 or greater than 9. Now, this behaviour might dodge a few cases but it is certainly not enough. I’ll demonstrate that through an example:
Above is a piece of the project we discovered this bug on. So when I play this project I would expect the first 5 notes of a G major scale, starting from 4th octave, and they should be: G4 A4 B4 C5 D5.
Notice how we expect an octave change going from B –> C, irrespective of the fact that our octave argument is always fixed at 4. Now the current code snippet (attached above), would not have made this possible because it makes no further calculation if the argument provided is a number i.e. it would return the octave value as 4 in all the cases and resultant notes played would be: G4 A4 B4 C4 D4. This, for certain, isn’t the right musical behavior.
My last meeting with Devin that week led to some rough sketches for a new scale degree block. The skeletal framework would be more or less a replica of the current scale degree block (n^th modal pitch), but there were major differences in a few Pie Menus and (obviously) behind the scenes working.
This is where I ended this week with an idea of what is the issue we’re facing. How we build upon that and entirely revamped the whole octave calculation process, and created a more robust design for new scale degree block, that I’ll document in the next blog.
Objectives for next week include: