Musical keyboard component written in React.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

12 lines
402 B

  1. import mem from 'mem'
  2. import getKeyOctaveUnmemoized from './getKeyOctave'
  3. import * as caches from './caches'
  4. const getKeyOctave = mem(getKeyOctaveUnmemoized, { cache: caches.getKeyOctave })
  5. type GetOctaveCount = (startKey: number, endKey: number) => number
  6. const getOctaveCount: GetOctaveCount = (startKey, endKey) => getKeyOctave(endKey) - getKeyOctave(startKey) + 1
  7. export default getOctaveCount