{"action":"opened","issue":{"url":"https://api.github.com/repos/saebekassebil/teoria/issues/68","labels_url":"https://api.github.com/repos/saebekassebil/teoria/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/saebekassebil/teoria/issues/68/comments","events_url":"https://api.github.com/repos/saebekassebil/teoria/issues/68/events","html_url":"https://github.com/saebekassebil/teoria/issues/68","id":56332688,"number":68,"title":"Normalizing a note","user":{"login":"amitgur","id":4021701,"avatar_url":"https://avatars.githubusercontent.com/u/4021701?v=3","gravatar_id":"","url":"https://api.github.com/users/amitgur","html_url":"https://github.com/amitgur","followers_url":"https://api.github.com/users/amitgur/followers","following_url":"https://api.github.com/users/amitgur/following{/other_user}","gists_url":"https://api.github.com/users/amitgur/gists{/gist_id}","starred_url":"https://api.github.com/users/amitgur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitgur/subscriptions","organizations_url":"https://api.github.com/users/amitgur/orgs","repos_url":"https://api.github.com/users/amitgur/repos","events_url":"https://api.github.com/users/amitgur/events{/privacy}","received_events_url":"https://api.github.com/users/amitgur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-03T04:31:56Z","updated_at":"2015-02-03T04:31:56Z","closed_at":null,"body":"Somtimes musical operations on note and interval gets notes like B# or Fb. I needed to simplify that to c and e, I wrote this function. Any other way to do that ?\r\n\r\nteoria.normalizeNote = function(n){\r\n\r\n\tvar acc = n.accidental();\r\n\r\n\tif (acc === '#') {\r\n\t\tvar name =  n.name();\r\n\t\tif (name === 'b'){\r\n\t\t\treturn teoria.note('c' + (n.octave() + 1));\r\n\t\t}\r\n\t\tif (name === 'e'){\r\n\t\t\treturn teoria.note('f' + (n.octave()));\r\n\t\t}\r\n\t}\r\n\r\n\tif (acc === 'b') {\r\n\t\tvar name =  n.name();\r\n\t\tif (name === 'c'){\r\n\t\t\treturn teoria.note('b' + (n.octave() - 1));\r\n\t\t}\r\n\t\tif (name === 'f'){\r\n\t\t\treturn teoria.note('e' + (n.octave()));\r\n\t\t}\r\n\t}\r\n\treturn n;\r\n}\r\n\r\nI guess there should be a function for the general case Gbb=F"}}