Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teropa/spectrum-analyser
A Web Audio spectrum analyser
https://github.com/teropa/spectrum-analyser
Last synced: 9 days ago
JSON representation
A Web Audio spectrum analyser
- Host: GitHub
- URL: https://github.com/teropa/spectrum-analyser
- Owner: teropa
- Created: 2020-05-27T06:13:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-12T12:20:38.000Z (over 3 years ago)
- Last Synced: 2024-10-30T04:13:18.797Z (15 days ago)
- Language: TypeScript
- Size: 10.7 KB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Web Audio Spectrum Analyser
Visualises the spectrum of any Web Audio node. Uses log scale for both frequency and amplitude.
## Install
```
npm install @teropa/spectrum-analyser
```ES Modules, CommonJS modules, and an UMD build are all provided.
## Usage
Create an analyser and attach it to an existing `` element, then connect it to an AudioNode and start visualising:
```js
import { SpectrumAnalyser } from "@teropa/spectrum-analyser";let spectrum = new SpectrumAnalyser(myCanvasElement, audioContext, {
fftSize: 8192,
});
spectrum.connect(myAudioNode);
spectrum.start();
```The canvas visualisatioon will be sized according to the natural (CSS-based) size of the canvas.
The third argument to the constructor supports the following options:
- `fftSize` - number - the FFT size of the backing AnalyserNode. This affects the resolution of the spectrum analysis.
- `backgroundColor` - string - the (CSS) color to use for the visualisation background
- `spectrumColor` - string - the (CSS) color to use for the filled spectrum