pitch-class

Get pitch class of a note or midi number

Usage no npm install needed!

<script type="module">
  import pitchClass from 'https://cdn.skypack.dev/pitch-class';
</script>

README

pitch-class npm version

tonal

Get the pitch class of a note:

var pc = require('pitch-class')
pc('a4') // => 'A'
pc('fx3') // => 'F##'

It works with midi numbers too:

pc(57) // => 'A'

This is part of tonal:

tonal.pitchClass('bb2') // => 'Bb'

License

MIT License