
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
redux-webmidi
Advanced tools
An intuitive Redux reducer/action creators for handling MIDI devices.
npm i redux-webmidi -S
import { createStore, combineReducers } from 'redux';
import { midiReducer as midi, midiProvider } from 'redux-webmidi';
const reducer = combineReducers({
// Your other reducers
midi
});
const store = createStore(reducer);
// Wrap your store with a proxy provider
midiProvider(store);
import { connect } from 'react-redux';
@connect((state) => ({midi: state.midi}))
let App = ({ midi }) => (
<div>
{midi.ports.map((c, i) => <InstrumentView data={c} key={i}/>)}
<Synth keys={(midi.ports[0]) ? midi.ports[0].keys : null}/>
</div>
);
type KeyMap {
// The index is the key on the keyboard.
[index: number]: {
// The status keycode
status: number,
velocity: number
}
};
type MidiDevice: {
id: number,
name: string,
manufacturer: string,
state: 'connected' | 'disconnected',
type: 'input' | 'output' | 'input/output',
keys: KeyMap
};
type WebMidiState = {
ports: MidiDevice[]
};
Refer to the official Midi specification or WebMidi specification if you have any other questions.
The first byte (denoted as zero in all examples in the table) describes the midi channel, whereas the larger byte describes the actual message.
Message | Status |
---|---|
Note Off | 0x80 |
Note On | 0x90 |
let {keys} = this.state.port[0];
keys.map( key => {
if (key.status & 0x90) {
playSound('./bee.wav');
}
});
FAQs
🎹 Intuitive Redux reducer/action creators for handling MIDI devices.
The npm package redux-webmidi receives a total of 2 weekly downloads. As such, redux-webmidi popularity was classified as not popular.
We found that redux-webmidi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.