This is the simplest game I’ve written so far. Unlike the other games, it only provides minimal scoring, does not use any HTML5-specific features, and works on older browsers — or at least it works in IE 8.

The idea for the user is to toggle black keys on or off to create the correct keyboard pattern for a given starting note. That’s it! The drill uses three sizes: eight, eleven, and fifteen white keys. The starting note is chosen at random; when the user correctly draws the keyboard and presses the “DONE” button, all of the note names appear on the white keys.

All of the drawing (including the “DONE” and “CONTINUE” buttons) for the game itself is done on a Raphael SVG canvas. Raphael provides a nice API for adding event handlers — click listeners, etc — and this made it fairly easy to create the game.

You can try out the game here.

Finally, the fifth game is up and running. Each of these iterations results in some new learning experience for me. With this game I decided to add some basic audio, using the excellent soundmanager2 javascript library. This library automatically detects whether or not HTML5 audio is supported, but also falls back to Flash if HTML5 audio is not supported. It also allows Flash to be the preferred delivery method, which is good, because in general Flash audio is much more robust than HTML5 audio.

Unfortunately, when I tested the audio on the iPad, I found the latency to be so bad as to be unusable. So the interval games are visual-only on the iPad, with no listening component.

From a design and programming perspective, I found the Intervals game to be a little trickier than the other games. I wanted the interval generation to be random within the level parameters for the game. But there are a number of variables when dealing with intervals that are not an issue with plain notes or key signatures. For example, depending on the chosen “base” note, certain intervals may or not be possible. If B# is the base note, it is not possible to generate an Augmented 5th above it (B# – F## is a perfect 5th), to cite one instance.

However, I think the Javascript dynamic programming capabilities are cool: it was relatively easy to set up data structures that could use the same identifiers for note specs for the VexFlow notation rendering as for generating the appropriate sounds using the
SoundManager2 APIs.

The fourth game in this series of “flash” (as in “flash cards,” not “Flash plugin”) games is a bit more challenging. It is a scale-degree identification game. Scale degrees are identified three ways: as numbers, as solfege symbols, and as technical names. For example, if the key signature is F major, and the note is “A”, the correct answer will be 3, mi, or mediant, depending on which option is available. The game levels determine the type of answer.

In addition to working on this third game, I’ve also spent some time working with the VexFlow notation api, and even submitted a small contribution to the project: automatic key signature placement of accidentals depending on the current clef.

Some of the design decisions for these games are based on the idea that a student will be more motivated if there is a certain amount of time pressure, and the idea of progressive level advancement. There is no penalty for being slow, only for being inaccurate. So as a player works on a given level, he can continue to work at that level for as long as necessary, and will only have to start the game over if a certain wrong-answer threshold is reached (typically five wrong answers). Also, at any level, the correct answer must be given before advancing to the next question.

I have seen many online music games that look for a specific answer, and if the answer is wrong, some kind of negative “WRONG!” response is given, and the question advances to the next item regardless. I think that’s about as “de-motivational” as a game could be. So I like the idea of having multiple lives, multiple chances, and time limits.

Speaking of time limits, a recent blog entry from JogNog seems to reinforce the value of placing time limits on tasks.

Laurel Ensminger liked this post

Designing and writing software can become very complicated very quickly. One of my goals this summer and this fall has been to develop some good coding and design habits. I’ve been using javascript/html/css coding in my projects as a kind of testing ground for creating larger projects. This approach has been invaluable to me as I’ve been able to experience firsthand what works and what doesn’t in trying to implement version control, reusable code, and maintainability of a code base. Here are some of the things I’m learning:

1. Git and Github: I’m kind of stumbling through this, but little by little, starting to get the hang of not only setting up a repo, but learning how to branch, push, pull, merge, and do other command-line type things. I’ve started to get involved in the VexFlow project, and have actually submitted my first pull request! I plan to keep working on this until many of the git / github operations become second nature.

2. An ounce of prevention: when I took the Team Software Project class at MTU, the professor emphasized often just how difficult good software design, creation, implementation, testing, and maintenance can be, and how important spending plenty of time in the initial planning, design, and documentation stages is. I’m experiencing that first-hand. For example, I already know of several changes that I should make to the earliest games I created this summer. I’ve spent a good amount of time re-factoring one of the games; each time I create a new one, I try to reuse code from the previous game – this is allowing me to build a base of re-usable code modules. But my plan going forward will be to try to plan more of the re-usable modules up front, and try to spend even more time researching, thinking through, and documenting all the details before I actually write the code.

3. Collaboration. This point really goes with #1 above, but I really think being involved in collaborative projects like VexFlow will be invaluable. I’ve already learned a considerable amount just by reading through the comments, pull requests, and group discussions. I hope to learn even more as more experienced coders look at my code and give suggestions.

4. Efficiency. Ahhee – it is so easy to get distracted and find excuses to procrastinate when coding. It is hard work, and can be very draining mentally. So in order to be productive and keep the momentum going, I’m trying to improve my efficiency. Part of this has to do with tools and workflow at the computer, but it also has to do with carefully planning my schedule, making the most of the time I have available, and, as mentioned above, taking the time to do the correct planning and documentation – avoiding the temptation to just jump in and hack something together.

I’m happy to say that a new Key Signature game is up on the website.  This game works similarly to the note-naming games, but without a practice mode.  There are currently 14 levels of play, where key signatures are presented incrementally, first in major mode, then minor, with gradually increasing numbers of sharps and flats. As was the case with those games, this one has been tested extensively on my iPad.  It also uses the VexFlow music notation API.

Speaking of VexFlow, I joined the VexFlow Google group and hope to learn more about its features, as well as potentially contribute some code to the project. As I become more involved in that, I will probably write some posts about specific features of that project.

I found myself spending more time with colors on this Key Signature game.  When testing on the iPad, I found that certain colors for input buttons looked really good and were easy to read, while others just looked pale or were difficult to read.  I will probably continue to tweak the colors, which is relatively easy since they are stored specified in a separate CSS file.  I’ve been using Inkscape to mock up the buttons and text labels, and then quickly inserting the corresponding RGB values into the CSS file.

Hope you enjoy this new game!

Jon

© 2012 Pedaplus Blog Suffusion theme by Sayontan Sinha