react-mobx-music

Render & play music with MobX and React.

Usage no npm install needed!

<script type="module">
  import reactMobxMusic from 'https://cdn.skypack.dev/react-mobx-music';
</script>

README

React Mobx Music

Install

yarn add react-mobx-music

Usage

<ReactMobxMusic instrumentNames={["accordion"]}>
  {({ isLoading, instruments }) =>
    isLoading ? (
      <div> Loading </div>
    ) : (
      <div>
        Loaded !
        <button
          onMouseDown={() => {
            instruments.get("accordion").play("A4");
          }}
          onMouseUp={() => {
            instruments.get("accordion").stop("A4");
          }}
        >
          Play A4
        </button>
      </div>
    )
  }
</ReactMobxMusic>