Skip to content

Commit

Permalink
kStepNumber should contain numbers instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
saebekassebil committed Jun 17, 2013
1 parent a37a136 commit 0611b0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ TeoriaChord.prototype = {

interval = kStepNumber[interval];
for (i = 0, length = intervals.length; i < length; i++) {
if (intervals[i].interval === +interval) {
if (intervals[i].interval === interval) {
return teoria.interval.from(this.root, intervals[i]);
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,17 @@
};

var kStepNumber = {
'first': '1',
'tonic': '1',
'second': '2',
'third': '3',
'fourth': '4',
'fifth': '5',
'sixth': '6',
'seventh': '7',
'ninth': '9',
'eleventh': '11',
'thirteenth': '13'
'first': 1,
'tonic': 1,
'second': 2,
'third': 3,
'fourth': 4,
'fifth': 5,
'sixth': 6,
'seventh': 7,
'ninth': 9,
'eleventh': 11,
'thirteenth': 13
};

// Adjusted Shearer syllables - Chromatic solfege system
Expand Down
4 changes: 1 addition & 3 deletions src/scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ TeoriaScale.prototype = {
},

get: function(i) {
if (typeof i === 'string' && i in kStepNumber) {
i = parseInt(kStepNumber[i], 10);
}
i = (typeof i === 'string' && i in kStepNumber) ? kStepNumber[i] : i;

return this.notes[i - 1];
},
Expand Down

0 comments on commit 0611b0c

Please sign in to comment.