CamillaDSP - Cross-platform IIR and FIR engine for crossovers, room correction etc

I have tried your script but:

Python:
cdsp = CamillaClient("127.0.0.1", 1234)
cdsp.connect()

is not working because module can not be found.

I installed camillaDSP with the tutorial from mdsimon with this lines:
Bash:
mkdir ~/camilladsp ~/camilladsp/coeffs ~/camilladsp/configs
wget https://github.com/HEnquist/camilladsp/releases/download/v3.0.1/camilladsp-linux-aarch64.tar.gz -O ~/camilladsp/camilladsp-linux-aarch64.tar.gz
sudo tar -xvf ~/camilladsp/camilladsp-linux-aarch64.tar.gz -C /usr/local/bin/
And so camilladsp is in a different location

Any idea what i have to use instead of:
Python:
from camilladsp import CamillaClient
 
At the moment i do it this way, but don't know, if it has any disadvantage:
Python:
import asyncio
import evdev
import socket
import websocket
import time
import json

cmdUp = {
    "AdjustVolume": [1.0, -60.0, 0.0]
}
cmdDown = {
    "AdjustVolume": [-1.0, -60.0, 0.0]
}

MOUSE_PATH = "/dev/input/event2"

ws = websocket.create_connection("ws://localhost:1234")

def adjust_volume(direction):
    if direction == "up":
        print(f"UP")
        ws.send(json.dumps(cmdUp))
    else:
        print(f"DOWN")
        ws.send(json.dumps(cmdDown))

async def main():
    device = evdev.InputDevice(MOUSE_PATH)
    async for event in device.async_read_loop():
        # Listen for relative wheel events (e.g., mouse wheel or similar)
        if event.type == evdev.ecodes.EV_REL and event.code == evdev.ecodes.REL_WHEEL:
            if event.value > 0:
                #print(f"Up")
                adjust_volume("up")
            elif event.value < 0:
                #print(f"Down")
                adjust_volume("down")
               
if __name__ == "__main__":
    asyncio.run(main())
 
Last edited:
a little bit cleaned code:
Python:
import asyncio
import evdev
import websocket
import json

cmdUp = {"AdjustVolume": [1.0, -60.0, 0.0]}
cmdDown = {"AdjustVolume": [-1.0, -60.0, 0.0]}

MOUSE_PATH = "/dev/input/event2"

ws = websocket.create_connection("ws://localhost:1234")

def adjust_volume(direction):
    if direction == "up":
        #print("UP")
        ws.send(json.dumps(cmdUp))
    else:
        #print("DOWN")
        ws.send(json.dumps(cmdDown))

async def main():
    device = evdev.InputDevice(MOUSE_PATH)
    async for event in device.async_read_loop():
        # Listen for relative wheel events (e.g., mouse wheel or similar)
        if event.type ==
        .EV_REL and event.code == evdev.ecodes.REL_WHEEL:
            if event.value > 0:
                adjust_volume("up")
            elif event.value < 0:
                adjust_volume("down")
               
if __name__ == "__main__":
    asyncio.run(main())
 
"cdsp = CamillaClient("127.0.0.1", 1234)cdsp.connect()is not working because module cannot be found.


install pyCamillaDSP, the Companion Python library for CamillaDSP.



"At the moment I do it this way, but don't know, if it has any disadvantage":

Ok, it work but here are the main reasons why using the pycamilladsp library is more appropriate than manually sending JSON via websocket when interacting with CamillaDSP:

1) Instead of building and sending raw JSON commands, you can use intuitive Python methods like:

cdsp.adjust_volume(1.0, -60.0, 0.0)


This improves readability, maintainability, and reduces the risk of mistakes in the command format.

DSP communication,

2) The CamillaClient class handles:
  • WebSocket connection establishment
  • Reconnection logic (if needed)
  • JSON serialization/deserialization
You don’t have to deal manually with websocket.create_connection, json.dumps(), etc.

3) It ensures that commands you send follow the structure expected by CamillaDSP.
You avoid silent bugs due to incorrect field names, types, or missing values.

4) The library includes structured error responses and exceptions, which makes it easier to catch and debug issues.
With raw websockets, you have to parse everything manually.

5) If the CamillaDSP protocol evolves, the library can be updated to stay compatible —
you won’t need to rewrite your JSON messages or low-level socket logic.

6) Using pycamilladsp helps separate application logic (e.g., handling a rotary encoder) from DSP communication, which makes your code cleaner and more modular.
 
  • Thank You
Reactions: chriss0212