This module provides some syntactic sugar over the AudioContext.createBiquadFilter function.
- Source:
Example
import { conn, square, lowpass, filter, master } from 'synth-kit'
master.start(conn(square('C4'), lowpass('C5')))
master.start(conn(square('A4'), filter({ type: 'hipass', Q: 10, freq: 1000 }))
Methods
(static) bandpass(config) → {AudioNode}
Create a bandpass filter. An alias for filter({ type: 'bandpass', ... })
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | same as |
- Source:
- See:
-
- filter
Returns:
the bandpass filter
- Type
- AudioNode
Example
conn(square(800), bandpass(400))
(static) filter(config) → {AudioNode}
Create a filter (a BiquadFilterNode)
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | it may include:
Instead of a configuration object you can pass a frequency number of note name just to specify the frequency. |
- Source:
Returns:
the BiquadFilterNode
- Type
- AudioNode
Example
conn(square(800), filter({ type: 'lowpass', freq: 600 }))
(static) hipass(config) → {AudioNode}
Create a hipass filter. An alias for filter({ type: 'hipass', ... })
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | same as |
- Source:
- See:
-
- filter
Returns:
the hipass filter
- Type
- AudioNode
Example
conn(square(800), hipass(400))
(static) lowpass(config) → {AudioNode}
Create a lowpass filter. An alias for filter({ type: 'lowpass', ... })
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | same as |
- Source:
- See:
-
- filter
Returns:
the lowpass filter
- Type
- AudioNode
Example
conn(square('C4'), lowpass(400))