Musical keyboard component written in React.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

16 行
399 B

  1. export default (dummyKeys: number[]): Record<number, number[]> => (
  2. dummyKeys
  3. .map(k => [k, Math.floor(k / 12)])
  4. .reduce<Record<number, number[]>>(
  5. (theOctaves, [key, keyOctave, ]) => ({
  6. ...theOctaves,
  7. [keyOctave]: (
  8. Array.isArray(theOctaves[keyOctave])
  9. ? [...theOctaves[keyOctave], key]
  10. : [key]
  11. )
  12. }),
  13. {}
  14. )
  15. )