FYLSunghwan / react-native-piano-sampler

React Native Piano Sampler : Reads sf2 with FluidSynth(on Android) or sfz with AudioKit(on iOS)
MIT License
13 stars 4 forks source link

react-native-piano-sampler

NPM

React Native Piano Sampler : Reads sf2 with FluidSynth(on Android) or sfz with AudioKit(on iOS)

Installation

npm install --save react-native-piano-sampler

Usage

Prerequisites (iOS/iPadOS)

Prerequisites (Android)

Usage in React Native Code

import PianoSampler from "react-native-piano-sampler";

// ...

// Must do before playNote(), and stopNote()
PianoSampler.prepare();

// Play the piano sound from selected midiNum, and velocity until stopNote() is call.
// midiNum is midi Number, and velocity is the intensity.
PianoSampler.playNote(midiNum, velocity);
// Stop the pian sound
PianoSampler.stopNote(midiNum);
// Set Volume 0~1.0
PianoSampler.setVolume(0.5);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT