# sf2-synth-audio-worklet

> An Audio Worklet-based SoundFont2 synthesizer for the browser

Latest version **0.0.12** (published 2024-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install sf2-synth-audio-worklet
pnpm add sf2-synth-audio-worklet
yarn add sf2-synth-audio-worklet
bun add sf2-synth-audio-worklet
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2024-05-13 |
| First published | 2023-01-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.x |
| Dependencies | 0 |
| Unpacked size | 290.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | neoki |
| Maintainers | neoki |
| Keywords | synthesizer, sampler, audio-worklet, soundfont2 |

## Links

- npm: https://www.npmjs.com/package/sf2-synth-audio-worklet
- Repository: https://github.com/neokidev/sf2-synth-audio-worklet
- Homepage: https://github.com/neokidev/sf2-synth-audio-worklet#readme
- Issues: https://github.com/neokidev/sf2-synth-audio-worklet/issues
- npm.io page: https://npm.io/package/sf2-synth-audio-worklet

## Recent versions

- 0.0.12 (latest) — 2024-05-13
- 0.0.11 — 2024-05-04
- 0.0.10 — 2024-01-26
- 0.0.9 — 2023-08-31
- 0.0.8 — 2023-04-07
- 0.0.7 — 2023-03-28
- 0.0.6 — 2023-03-27
- 0.0.5 — 2023-03-25
- 0.0.4 — 2023-03-25
- 0.0.3 — 2023-03-25
- 0.0.2 — 2023-03-19
- 0.0.1 — 2023-01-29

## README

# sf2-synth-audio-worklet

[![license](https://img.shields.io/npm/l/sf2-synth-audio-worklet.svg)](https://github.com/neokidev/sf2-synth-audio-worklet/blob/main/LICENSE.md)
[![npm](https://img.shields.io/npm/v/sf2-synth-audio-worklet.svg)](https://www.npmjs.com/package/sf2-synth-audio-worklet)
[![npm downloads](https://img.shields.io/npm/dm/sf2-synth-audio-worklet)](https://www.npmjs.com/package/sf2-synth-audio-worklet)
[![ci](https://github.com/neokidev/sf2-synth-audio-worklet/actions/workflows/ci.yml/badge.svg)](https://github.com/neokidev/sf2-synth-audio-worklet/actions/workflows/ci.yml)

An Audio Worklet-based SoundFont2 synthesizer for the browser.

## Installation

```bash
npm install sf2-synth-audio-worklet
```

## Getting Started

This code sets up a simple SoundFont2 player in React using the library.

```tsx
import { useState } from 'react'
import {
  createSoundFont2SynthNode,
  type SoundFont2SynthNode,
} from 'sf2-synth-audio-worklet'

function App() {
  const [node, setNode] = useState<SoundFont2SynthNode>()

  const setup = async () => {
    const audioContext = new AudioContext()
    const sf2Url = 'path/to/soundfont2' // Replace with the SoundFont2 file path
    const node = await createSoundFont2SynthNode(audioContext, sf2Url)
    node.connect(audioContext.destination)
    setNode(node)
  }

  const noteOn = () => node?.noteOn(0, 60, 100, 0)
  const noteOff = () => node?.noteOff(0, 60, 0)

  return (
    <div>
      <button onClick={setup} disabled={!!node}>
        Setup
      </button>
      <button onMouseDown={noteOn} onMouseUp={noteOff} disabled={!node}>
        Sound
      </button>
    </div>
  )
}
```

## License

MIT

---
_Source: https://npm.io/package/sf2-synth-audio-worklet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
