Install
TestPyPI for CPython, the MIP index for boards# CPython: audiodsp comes along from PyPI
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ omnipython-audioeffects
# MicroPython, on a firmware that has audiodsp in it
import mip
mip.install("audioeffects", index="https://PyDevices.github.io/mip")
Both are pure Python. On a board they need a firmware built with audiodsp, whose nodes they are made of.
Try this first
One click through a digital delayimport array
import audiocore
import audioeffects
RATE = 48000
click = array.array("h", [20000] + [0] * (RATE - 1)) # one click, one second
source = audiocore.RawSample(click, sample_rate=RATE, channel_count=1)
echo = audioeffects.create("DigitalDelay", source, RATE,
time_ms=250, feedback=0.5, mix=0.5)
heard = array.array("h")
while len(heard) < RATE:
_, block = audiocore.get_buffer(echo.output)
heard.extend(array.array("h", bytes(block)))
for ms in range(0, 1000, 250):
start = ms * RATE // 1000
print(ms, "ms: loudest sample", max(abs(v) for v in heard[start:start + 12000]))
It prints the click, then echoes at 250, 500 and 750 ms, each half as loud as the last because feedback is 0.5. On a board, hand echo.output to audio_out.play() instead of pulling it yourself. To put something worth processing in front of it, add audioinstruments, and to use the effects in a DAW, install MPVST.
Read more
Depth lives in the repositoryDocs
Install, first program, guides and the reference.
The effects
Every effect and rack, by name, with its controls.
Chain effects
Wire one effect into the next and keep the wire stable.
audiodsp
The CircuitPython-compatible audio nodes underneath.