React Native Piano Sampler : Reads sf2 with FluidSynth(on Android) or sfz with AudioKit(on iOS)
npm install --save react-native-piano-sampler
UprightPianoKW-SFZ-20190703
.
UprightPianoKW-SFZ-20190703
├── photo.jpg
├── readme.txt
├── samples
│ ├── A0vH.wav
│ └── A0vL.wav
│ ...
└── UprightPianoKW-20190703.sfz
UprightPianoKW-SFZ-20190703
folder is in your Project File -> Build Phases -> Copy Bundle Resources
Project File -> Signing & Capabilities
, then press the + Capability
button below the tab menu, and press Background Modes. Check the Audio, AirPlay, and Picture in Picture
checkbox.pod install
{ProjDirectory}/android/app/src/main/assets
.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);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT