0.5.1 • Published 1 year ago

@ondas/soundfont v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

SoundFont

A self-container mono-sample piano

npm version npm version

A Soundfont player. By default it loads audio from Benjamin Gleitzman's package of pre-rendered sound fonts.

import Soundfont from "@ondas/soundfont";

// Create a new instrument
const marimba = new Soundfont(new AudioContext(), "marimba");

// Wait until the audio is loaded
await marimba.ready();

// Start and stop
const stopNote = marimba.start("C4");
stopNote();

Install

npm i @ondas/soundfont

Usage

Start and stop notes

start function returns another function to stop notes:

const stopNote = marimba.start("C4");
stopNote();

But a global stop is possible to stop all notes:

["C4", "E4", "G4"].map(marimba.start);
marimba.stop();

Schedule

Libraries

import Soundfont, { SoundfontLibraries } from "@ondas/soundfont";

Object.keys(SoundfontLibraries); // => ["FluidR3" | "MusyngKite"];

const url = SoundfontLibraries.MusyngKite.url("marimba");
const marimba = new Soundfont(new AudioContext(), url);

It uses audio in MIDI.js format. Read Benjamin Gleitzman's package for more information.

0.5.0

1 year ago

0.5.1

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago