abcjs.mdx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Piano } from 'react-piano';
  2. import 'react-piano/dist/styles.css';
  3. import ABCNotation from '@site/src/components/ABCNotation';
  4. # Notation
  5. Flipping through a bunch of pdfs for scales isn't going to cut it so I'm adding two libraries to help me with music notation. The first is a library for rendering piano keys and the second is a library for rendering ABC notation.
  6. - [react-piano](https://github.com/kevinsqi/react-piano)
  7. - [abcjs](https://www.abcjs.net/)
  8. - [ABC Notation](https://en.wikipedia.org/wiki/ABC_notation)
  9. ## Piano Example
  10. <Piano
  11. noteRange={{ first: 48, last: 74 }}
  12. width={600}
  13. playNote={(midiNumber) => {
  14. console.log(midiNumber);
  15. }}
  16. stopNote={(midiNumber) => {
  17. console.log(midiNumber);
  18. }}
  19. />
  20. ## ABC Notation Example
  21. <ABCNotation notation={`X:1
  22. T:Example
  23. M:4/4
  24. L:1/8
  25. K:C
  26. C,D,E,F, G,A,B,C DEFG ABcd|efgab c'd'e'f' g'a'b'c''|`} />
  27. You can add interactive features by setting more options:
  28. <ABCNotation
  29. notation={`X:1
  30. T:Example with chord symbols
  31. M:4/4
  32. L:1/4
  33. K:C
  34. "C"CDEF|"G"GABc|"F"FEDC|"C"C4|`}
  35. options={{
  36. add_classes: true,
  37. responsive: 'resize',
  38. clickListener: (abcElem) => {
  39. console.log(abcElem);
  40. }
  41. }}
  42. />