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
EventHandler<MidiVisualizerElement, CustomEvent<any>> EventHandler<MidiVisualizerElement, CustomEvent<any>> Context<MidiVisualizerElement & JsxContext<MidiVisualizerElement> & Omit<{ <T>(ctor) => <T>(ctx) => #
src/midi-visualizer.tsx#L12 MidiVisualizerElement
#
onmounted
#
onunmounted
#
src/midi-visualizer.tsx#L46 mounted
($)
#
$
CleanClass<T>
Wrapper<T>
"transition"
>> mounted($) =>
- void
Credits
- sigl by stagas – Web framework
- webaudio-tools by stagas – Useful tools for WebAudio.
Contributing
All contributions are welcome!