saebekassebil/teoria — pull request #5 by LukeHorvat (2012-08-06 12:05:12+00:00)
Title: Added TeoriaNote.dots and TeoriaNote#durationInSeconds

I've been playing around with loading sheet music from MusicXML, and have found I often need to associate a note with a dotted duration. For a while, I was storing the dot count per note separate from each `TeoriaNote` object, but that felt needlessly clunky, so I added a `dots` property to the class. Like `duration`, this is an optional argument to the `TeoriaNote` constructor, so it is backwards compatible with all previous versions of Teoria. New constructor:

```javascript
TeoriaNote(name, duration, dots)
```

To give this property a bit of utility other than being a simple value that can be read from/written to, I implemented `TeoriaNote#durationInSeconds`. This function returns the duration of a note (including dots) in seconds at a specified tempo, which may be handy for those doing sound synthesis. Example:

```javascript
teoria.note('c', 4).durationInSeconds(120); //returns 0.5
teoria.note('c', 4, 0).durationInSeconds(120); //returns 0.5
teoria.note('c', 4, 1).durationInSeconds(120); //returns 0.75
teoria.note('c', 4, 2).durationInSeconds(120); //returns 0.875
teoria.note('c', 2, 1).durationInSeconds(60); //returns 3
teoria.note('c', 1, 2).durationInSeconds(240); //returns 1.75
```