Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

audio-index-to-frequency

Jam36MIT1.0.0

converts an index to Hz frequency for WebAudio

web, audio, webaudio, frequencies, freq, freqs, frequency, hz, herz, index, range, analyser

readme

audio-index-to-frequency

stable

Convert an index to Hz frequency for WebAudio frequency analysis. Also see audio-frequency-to-index.

const index2freq = require('audio-index-to-frequency')
const sampleRate = audioContext.sampleRate // 44100
const length = analyserNode.frequencyBinCount // 1024

const freq = index2freq(19, sampleRate, length)
//=> 409.130859375

Usage

NPM

frequency = indexToFrequency(index, sampleRate, frequencyBinCount)

Converts the index integer to a frequency (in Hz) with the given audioContext.sampleRate and analyserNode.frequencyBinCount from the WebAudio API.

License

MIT, see LICENSE.md for details.