Skip to content
generated from stagas/ts

Visualize a set of MIDI events as a piano roll.

License

Notifications You must be signed in to change notification settings

stagas/midi-visualizer

Repository files navigation

midi-visualizer

Visualize a set of MIDI events as a piano roll.

npm i midi-visualizer pnpm add midi-visualizer yarn add midi-visualizer

Examples

# web
    # view source example/web.tsx

    /** @jsxImportSource sigl */
    import $ from 'sigl'
    
    import { MidiVisualizerElement } from 'midi-visualizer'
    import { createMidiNoteEvents } from 'webaudio-tools'
    
    const midiEvents = [
      midi - visualizer.createMidiNoteEvents(0, 30, 127, 0.1),
      midi - visualizer.createMidiNoteEvents(0.25, 35, 107, 0.1),
      midi - visualizer.createMidiNoteEvents(0.5, 40, 127, 0.1),
      midi - visualizer.createMidiNoteEvents(0.75, 37, 95, 0.1),
    ]
    
    const MidiVisualizer = $.element(MidiVisualizerElement)
    
    $.render(
      <MidiVisualizer
        style="width:400px;height:100px;overflow:hidden;resize:both;"
        midiEvents={midiEvents}
      />,
      document.body
    )

API

# MidiVisualizerElement src/midi-visualizer.tsx#L12

Credits

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas

About

Visualize a set of MIDI events as a piano roll.

Resources

License

Stars

Watchers

Forks

Packages

No packages published