npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tabkit/audio

v0.1.3

Published

Web Audio API synthesis engine for tabkit — play notes during tablature playback

Readme

@tabkit/audio

Web Audio API synthesis engine for tabkit — play notes during tablature playback.

Install

npm install @tabkit/audio

Peer dependency: @tabkit/core ^0.1.0.

Quick Start

import { TabPlayer } from '@tabkit/player'
import { TabAudio } from '@tabkit/audio'

const audio = new TabAudio({ instrument: 'guitar', waveform: 'triangle' })

const player = new TabPlayer(measures, {
  tempo: 120,
  onNote: (notes, _m, _b, tempo) => audio.playNotes(notes, tempo),
})

player.play() // now plays sound!

With React:

import { TabPlayer } from '@tabkit/react'
import { TabAudio } from '@tabkit/audio'

function App() {
  const audioRef = useRef<TabAudio | null>(null)

  useEffect(() => {
    const a = new TabAudio({ instrument: 'guitar' })
    audioRef.current = a
    return () => a.destroy()
  }, [])

  return (
    <TabPlayer
      measures={measures}
      onNote={(notes, _m, _b, tempo) => audioRef.current?.playNotes(notes, tempo)}
    />
  )
}

TabAudio

Constructor

new TabAudio(options?: AudioOptions)

AudioOptions

| Option | Type | Default | Description | |---|---|---|---| | volume | number | 0.7 | Master volume (0–1) | | waveform | OscillatorType | 'triangle' | Oscillator waveform ('sine', 'triangle', 'square', 'sawtooth') | | instrument | InstrumentPreset \| InstrumentConfig | 'guitar' | Instrument tuning for pitch mapping |

Methods

| Method | Description | |---|---| | playNote(note, tempo?) | Play a single TabNote | | playNotes(notes, tempo?) | Play all notes in a beat simultaneously (chords) | | setInstrument(instrument) | Change the instrument tuning | | setVolume(volume) | Set master volume (0–1) | | setWaveform(waveform) | Set oscillator waveform for future notes | | mute() | Mute all output | | unmute() | Unmute output | | destroy() | Close the AudioContext and release resources |

Properties

| Property | Type | Description | |---|---|---| | isMuted | boolean | Whether audio is muted | | volume | number | Current volume level |

Low-level API

Synth

Direct access to the synthesis engine. Each tone uses a dual-oscillator design (primary + detuned chorus) with micro pitch variation for a richer, more realistic sound:

import { Synth } from '@tabkit/audio'

const synth = new Synth()
synth.playTone(440, 0.5, { waveform: 'triangle', volume: 0.7 })
synth.destroy()

Pitch utilities

import { fretToMidi, midiToFrequency, fretToFrequency, TUNING_MIDI } from '@tabkit/audio'

fretToMidi(guitarConfig, 1, 0)    // 64 (high E open)
fretToMidi(guitarConfig, 6, 5)    // 45 (A on low E)
midiToFrequency(69)               // 440 (A4)
fretToFrequency(guitarConfig, 1, 12) // ~659.26 Hz (E5)

TUNING_MIDI

Pre-defined open-string MIDI numbers (thick → thin):

| Instrument | MIDI values | |---|---| | Guitar | 40, 45, 50, 55, 59, 64 | | Bass | 28, 33, 38, 43 | | Ukulele | 67, 60, 64, 69 | | Banjo | 67, 50, 55, 59, 62 |

Envelope

ADSR envelope with exponential decay/release for natural pluck sounds:

import { applyEnvelope, PLUCK_ENVELOPE } from '@tabkit/audio'

// PLUCK_ENVELOPE = { attack: 0.003, decay: 0.15, sustain: 0.15, release: 0.3 }

Ecosystem

| Package | Description | |---------|-------------| | @tabkit/core | Core SVG tablature renderer | | @tabkit/parser | Parse ASCII tabs and MusicXML | | @tabkit/player | Playback with cursor and metronome | | @tabkit/react | React components and hooks |

License

MIT