Pentatonality

By the time this blog entry is published, I will have submitted my new Silverlight app to the MIX 10K Challenge. Pentatonality, as I have named it, is a Silverlight 3-based application that provides a fun way to make music - simply by clicking or dragging boxes to turn them on and off. This is made possible through the use of a pentatonic scale, so that virtually any combination of notes will "sound good."
EDIT: I've linked to a local copy of the app at the end of the post.
EDIT 2: The entry has been posted to the MIX site: please vote for it!

INTERFACE

The user is presented with a 16x16 grid of boxes. Clicking on any box will hide it, and clicking on an empty space will bring the box back. It is also possible to click and drag to hide or return multiple boxes in the path of the mouse cursor. Finally, the Escape key can be used to bring back all the boxes at once. That's it!

INNARDS

Pentatonality generates its own sounds on the fly, as including MP3s or other audio files would have been inefficient (and not nearly as cool). This is done using new functionality exposed by Silverlight 3, by passing an overridden MediaStreamSource class to a MediaElement, and generating raw PCM data inside said class. The UI is created in both XAML and C# because, for some purposes, XAML actually ends up being less verbose than C#, but for most, C# is the more laconic of the two.

INSPIRATION

Pentatonality was inspired by a Wii homebrew app called Harmonium, which, in turn, was inspired by a Flash demo of a web-based music composition application called Audiotool.

RESOURCES

Those below were extremely helpful while I was making this app, in chronological order:

  1. http://www.kindohm.com/archive/2009/07/30/produce-a-sine-wave-tone-in-silverlight-3.aspx - basics of tone generation in Silverlight
  2. http://www.charlespetzold.com/blog/2009/07/Simple-Electronic-Music-Sequencer-for-Silverlight.html - beyond basics
  3. http://www.phy.mtu.edu/~suits/notefreqs.html - lists the frequencies I needed
  4. Shane Milton - helped me with some theory behind tone generation that I was severely lacking

COMMENTARY

This is my first real Silverlight app, not counting the few test apps I made playing around with various aspects of the framework. I did not use Blend, simply because I don't have it installed on my home machine, so everything was done in Visual Studio. Some concepts, mainly XAML-related, were less than obvious, while others immediately made sense.

Not only was this my first Silverlight app, but it was also my first app that generated its own sounds. That was by far the most challenging aspect of programming Pentatonality. It is still imperfect, but it's probably the best I could do in 10K at this time. I would like to have implemented an ADSR envelope, but that would have taken too long and likely taken the app past the 10K limit. I did implement an LFO to make the sounds a bit more pleasing to the ear.

Overall, I'm pretty proud of this app, as well as the fact that I got it done in a rather short amount of time. I hope it wins :)

P.S. Oh, by the way, here's a locally-hosted copy to play around with.

Trackback URL for this post:

http://www.arktronic.com/cms/trackback/23

Comments

Good job, I like it!
Syedur (not verified)
December 31, 2009 - 1:47pm