• Stars
    star
    176
  • Rank 209,650 (Top 5 %)
  • Language
    TypeScript
  • License
    ISC License
  • Created over 1 year ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A parametric EQ for Web Audio

weq8

NPM

A parametric equaliser for Web Audio.

weq8 screenshot

Try the live demo.

Sculpt the spectrum of your Web Audio graph using a filter bank of up to eight filters, with an intuitive UI inspired by Ableton Live's EQ Eight.

  • Built on top of standard BiquadFilterNodes.
  • Includes lowpass, highpass, lowshelf, highshelf, peaking, and notch filters, all with -12dB or -24dB roll-off.
  • Controlled with a Web Component UI, or headlessly with a TypeScript/JavaScript API.

Usage

Install

As an NPM package:

yarn add weq8
# or
npm install weq8

Setup and Connect The Runtime

The audio processing of the equaliser all happens in an instance of the WEQ8Runtime class. You'll need to import it, initialise it using your AudioContext, and connect it to the signal path of the audio source you wish to equalise:

import { WEQ8Runtime } from "weq8"; // or from "https://cdn.skypack.dev/weq8"

let weq8 = new WEQ8Runtime(yourAudioCtx);
yourAudioSourceNode.connect(weq8.input);
weq8.connect(yourAudioDestinationNode);

Plug in The UI

The user interface for the equaliser is provided by a Web Component called <weq8-ui />. First import the UI module so that this web component gets registered:

import "weq8/ui"; // or "https://cdn.skypack.dev/weq8/ui"

Then in your HTML, where you want the equaliser UI to appear, add the element:

<weq8-ui />

And finally, connect the WEQ8Runtime you initialised into this UI by setting it as a property:

document.querySelector("weq8-ui").runtime = weq8;

You should see the fully functional UI appear on your page.

Programmatic Control

You can also control the EQ runtime directly with JavaScript. This is useful if you have some alternative UI controls you wish to use, or if you want to operate the EQ fully headlessly.

Note: If you're only using programmatic control, you need not import the weq8/ui module at all, and can operate purely on the runtime.

All control methods take the filter number 0-7 as the first argument.

weq8.setFilterType(filterNumber, "lowpass12"); // or "lowpass24", "highpass12", "highpass24", "bandpass", "lowshelf12", "lowshelf24", "highshelf12", "highshelf24", "peaking12", "peaking24", "notch12", "notch24"
weq8.toggleBypass(filterNumber, true); // true to bypass this filter, false to (re-)connect it.
weq8.setFilterFrequency(filterNumber, 1000); // filter frequency in Hz
weq8.setFilterQ(filterNumber, 1.0); // filter Q
weq8.setFilterGain(filterNumber, 0.0); // filter gain in dB

The types, frequencies, Qs, and gains are as documented for the standard BiquadFilterNode. The filter types suffixed with 12 are singular BiquadFilterNodes and the types suffixed with 24 are two BiquadFilterNodes in series.

Persisting Filter State

This library does not persist the filter configuration between page loads. Instead, it provides a data structure you can serialize and load back, so that you may persist it on the application level.

To get notified whenever the filter state changes, subscribe to the filtersChanged event on the runtime:

weq8.on("filtersChanged", (state) => {
  // state is a data structure you can store in a variable, or serialize to JSON.
});

When initialising the runtime on a subsequent load, you may provide a previous state to directly load the equaliser into:

let weq8 = new WEQ8Runtime(yourAudioCtx, state);

Development

Run yarn dev and open your browser in http://localhost:3000 to get a development page with live reloading.

More Repositories

1

redux-voting-server

Server app for the Full-Stack Redux Tutorial
JavaScript
585
star
2

build-your-own-angularjs

Source Code & Errata for the "Build Your Own AngularJS" book. http://teropa.info/build-your-own-angular
JavaScript
584
star
3

redux-voting-client

Client app for the Full-Stack Redux Tutorial
JavaScript
372
star
4

angular-virtual-dom

A Virtual DOM based AngularJS view renderer designed to be used with immutable data structures
JavaScript
225
star
5

harmonics-explorer

A UI for exploring the harmonic series of sine waves. Done with Angular 2, @ngrx, Immutable.js
TypeScript
213
star
6

hiccups

A ClojureScript port of Hiccup - a fast library for rendering HTML in ClojureScript
Clojure
206
star
7

to-sting

Object.toSting() polyfill
206
star
8

in-c

A realization of Terry Riley's 1964 composition "In C" as an interactive web app
HTML
117
star
9

nlp

My explorations in natural language processing
Clojure
103
star
10

musicforairports.js

JavaScript
63
star
11

windchimes

TypeScript
60
star
12

schmangular.js

An ad hoc, informally-specified, bug-ridden, slow implementation of half of AngularJS
JavaScript
56
star
13

discreetmusic.js

JavaScript
38
star
14

itsgonnarain.js

JavaScript
36
star
15

ng-gfx-demos

Demos for my NG-BE talk about SVG and Canvas graphics and animations in Angular 2.
TypeScript
36
star
16

generative-music-workshop

A simple seed repo for a workshop on making generative music with Tone.js
JavaScript
24
star
17

elseq

An Angular 2 animation experiment, inspired by the cover art of "elseq" by Autechre
TypeScript
15
star
18

triangle-tessellation

A JavaScript implementation of the triangle tessellation algorithm from the OpenGL specification for tessellation shaders.
TypeScript
15
star
19

lein-flyway

A Leiningen plugin for the Flyway database migration framework
Clojure
14
star
20

metabubbles

A generative art experiment in Angular 2
TypeScript
14
star
21

ngrx-hotload-rc5

minimum viable hot loading setup for Angular rc.5 and @ngrx/store
TypeScript
14
star
22

spectrum-analyser

A Web Audio spectrum analyser
TypeScript
11
star
23

ng-fractals

Angular version of https://swizec.com/blog/animating-svg-nodes-react-preact-inferno-vue/swizec/7311
TypeScript
10
star
24

oscilloscope

A Web Audio oscilloscope
TypeScript
8
star
25

drumkit

JavaScript
8
star
26

sproutcore-tutorial-compojure

Sample project of a Compojure / MongoDB backend for the SproutCore ToDos tutorial
Clojure
6
star
27

zombie-pandemic-tracker

They're coming
Java
4
star
28

redux-space-clockwork

A little generative art experiment with Redux and Immutable.
JavaScript
4
star
29

prolefeed

A simple Clojure library for fetching RSS/Atom feeds
Clojure
4
star
30

web-audio-from-the-ground-up-demos

Demo code for the article series "Web Audio From the Ground Up"
TypeScript
4
star
31

failurous-java

Failurous Java client
Java
3
star
32

failurous-ring

Clojure/Ring client for Failurous
Clojure
3
star
33

pickaxe-notes

Some notes to self from re-reading Pickaxe for Ruby 1.9
Ruby
3
star
34

chime-call-response

JavaScript
3
star
35

lein-gwt

A Leiningen plugin for the GWT compiler
Clojure
3
star
36

stem

A fork of the Eclipse Spatiotemporal Epidemiological Modeler project trunk
Java
2
star
37

rails_learning_specs

Learning Rails internals by writing specs
Ruby
2
star
38

rails-int-hh

Rails Intermediate Course for Haaga-Helia
Ruby
2
star
39

gwt-mxhr

A GWT port of the DUI.Stream library
Java
2
star
40

globetrotter

An HTML canvas based slippy map client for GWT
Java
1
star
41

bitrate-magenta-workshop

JavaScript
1
star
42

saddle

An experimental pure JavaScript port of the GWT layout constraint system
JavaScript
1
star
43

isbn_validator

Ruby
1
star
44

presentations

Presentations I've given / am giving
1
star
45

paip-clj

My explorations of "Paradigms of Artificial Intelligence Programming" in Clojure
Clojure
1
star
46

building-angular

Building angular-like framework for much clearer understanding of the core.
JavaScript
1
star
47

closure-study

Learning Closure libs
JavaScript
1
star