function parse (str, isTonic, tuning) {
	  if (typeof str !== 'string') return null
	  var m = REGEX.exec(str)
	  if (!m || !isTonic && m[4]) return null

	  var p = { letter: m[1].toUpperCase(), acc: m[2].replace(/x/g, '##') }
	  p.pc = p.letter + p.acc
	  p.step = (p.letter.charCodeAt(0) + 3) % 7
	  p.alt = p.acc[0] === 'b' ? -p.acc.length : p.acc.length
	  var pos = SEMITONES[p.step] + p.alt
	  p.chroma = pos < 0 ? 12 + pos : pos % 12
	  if (m[3]) { // has octave
	    p.oct = +m[3]
	    p.midi = pos + 12 * (p.oct + 1)
	    p.freq = midiToFreq(p.midi, tuning)
	  }
	  if (isTonic) p.tonicOf = m[4]
	  return p
	}
Parse a note name in scientific notation an return it's components,
and some numeric properties including midi number and frequency.

@name parse
@function
@param {String} note - the note string to be parsed
@param {Boolean} isTonic - true the strings it's supposed to contain a note number
and some category (for example an scale: 'C# major'). It's false by default,
but when true, en extra tonicOf property is returned with the category ('major')
@param {Float} tunning - The frequency of A4 note to calculate frequencies.
By default it 440.
@return {Object} the parsed note name or null if not a valid note

The parsed note name object will ALWAYS contains:
- letter: the uppercase letter of the note
- acc: the accidentals of the note (only sharps or flats)
- pc: the pitch class (letter + acc)
- step: s a numeric representation of the letter. It's an integer from 0 to 6
where 0 = C, 1 = D ... 6 = B
- alt: a numeric representation of the accidentals. 0 means no alteration,
positive numbers are for sharps and negative for flats
- chroma: a numeric representation of the pitch class. It's like midi for
pitch classes. 0 = C, 1 = C#, 2 = D ... 11 = B. Can be used to find enharmonics
since, for example, chroma of 'Cb' and 'B' are both 11

If the note has octave, the parser object will contain:
- oct: the octave number (as integer)
- midi: the midi number
- freq: the frequency (using tuning parameter as base)

If the parameter `isTonic` is set to true, the parsed object will contain:
- tonicOf: the rest of the string that follows note name (left and right trimmed)

@example
var parse = require('note-parser').parse
parse('Cb4')
// => { letter: 'C', acc: 'b', pc: 'Cb', step: 0, alt: -1, chroma: -1,
        oct: 4, midi: 59, freq: 246.94165062806206 }
// if no octave, no midi, no freq
parse('fx')
// => { letter: 'F', acc: '##', pc: 'F##', step: 3, alt: 2, chroma: 7 })