Skip to content

Pipelines

A spec names the recordings, the operations and the output. It’s data, so the same spec runs from Python, the command line and the app, and it’s saved beside each result.

{
"dspk_pipeline": 1,
"nodes": {
"raw": {"op": "read", "path": "recording.bin"},
"hp": {"op": "iir", "band": "highpass", "cutoff": [300.0], "mode": "forward"},
"out": {"op": "write", "path": "filtered.zarr", "format": "zarr"}
},
"edges": [["raw", "hp"], ["hp", "out"]]
}
import dspk
dspk.pipeline.plan("spec.toml") # what it would do, without touching the device
reports = dspk.pipeline.run("spec.toml")
def progress(input, inputs, done, windows):
print(f"file {input + 1}/{inputs}: {done}/{windows}")
# return False to cancel
dspk.pipeline.run("spec.toml", progress=progress)

Cancelling (or Ctrl+C) raises KeyboardInterrupt, removes the unfinished output and keeps inputs already finished.

More on specs: Pipelines and the spec reference.