Custom Nodes
Switchboard SDK is designed to be extensible. If you need functionality that isn't provided by the built-in nodes or extensions, you can create your own custom nodes and add them to your audio graphs.
Why Create a Custom Node?
- Add new audio effects or processing algorithms
- Integrate third-party DSP libraries
- Implement custom routing, analysis, or control logic
- Prototype and test new audio features
How to Create a Custom Node
Currently, custom nodes must be developed in C++. You can subclass one of the core node types:
AudioSourceNode
: For nodes that generate audio (no inputs, only outputs)AudioProcessorNode
: For nodes that process audio (inputs and outputs)AudioSinkNode
: For nodes that consume audio (inputs, no outputs)
When implementing your node, you must ensure your code is real-time safe and non-blocking, as it will run in the audio processing thread.
Example: Simple Low-Pass Filter Node
Here's a minimal example of a custom processor node in C++:
class LowPassFilterNode : public AudioProcessorNode {
public:
LowPassFilterNode();
bool process(AudioBus& inBus, AudioBus& outBus) override;
// ...other required overrides...
private:
float previousSample = 0.0f;
};
bool LowPassFilterNode::process(AudioBus& inBus, AudioBus& outBus) {
// Simple averaging filter
for (uint frame = 0; frame < inBus.buffer->getNumberOfFrames(); ++frame) {
float input = inBus.buffer->getSample(0, frame);
float output = (input + previousSample) * 0.5f;
outBus.buffer->setSample(0, frame, output);
previousSample = input;
}
return true;
}
Registering and Using Your Node
Once implemented, register your node with the Switchboard SDK so it can be used in your graphs and referenced in JSON configurations. The best way to distribute and reuse your node is to package it as a Switchboard Extension.
Need Help?
If you have questions or want help building or integrating your custom node, contact us—we're happy to help!