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

I am not editing this config file because the readme indicated that the config file that's used by the backend is in /home/mark/camilladsp/config/
Ah got it, there is room for improved here in the readme. If says the backend config is at config/camillagui.yml, and this "config" directory is a subdirectory of the backend. I'll try to clarify this.
Since you are using the bundle, the backend file structure is a little different. I would suggest editing the file in /home/mark/camilladsp/camillagui_backend/_internal/config/ and then you don't need the -c option when starting the backend.
 
  • Thank You
Reactions: Mark'51
YEESSSS...
I found a script to read out the mouse scroll-wheel. With a little edit I can control the volume of CDSP with a mouse scroll wheel.
Hopefully it will work with a wireless mouse with USB dongle as well... can not check at the moment, have just wired ones 😉

Python:
from evdev import InputDevice, categorize, ecodes, list_devices
import socket
import websocket
import time
import json

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

# Config: path to CamillaDSP control socket
host = 'localhost'
port = 1234
DSP_SOCKET = (host, port)

# Adjust volume by this dB step
VOLUME_STEP = 1.0

devices = [InputDevice(path) for path in list_devices()]
mouse = None
for dev in devices:
    if 'Mouse' in dev.name or 'mouse' in dev.name:
        mouse = dev
        break

if mouse:
    print(f"Monitoring: {mouse.name}")
    for event in mouse.read_loop():
        if event.type == ecodes.EV_REL and event.code == ecodes.REL_WHEEL:
            ws = websocket.create_connection("ws://localhost:1234")
            if event.value > 0:
                print("Scroll up")
                ws.send(json.dumps(cmdUp))
                result = ws.recv()
                print("Response:", result)
                ws.close()
            elif event.value < 0:
                print("Scroll down")
                ws.send(json.dumps(cmdDown))
                result = ws.recv()
                print("Response:", result)
                ws.close()
 
  • Like
Reactions: TNT and PMental
Maybe it will work with pynput if evdev is not working... on my windows laptop this snippet is working with wireless and wired mouse:

Python:
from pynput import mouse

def on_scroll(x, y, dx, dy):
    if dy > 0:
        print("Up")
    elif dy < 0:
        print("Down")
# Start the mouse listener
with mouse.Listener(on_scroll=on_scroll) as listener:
    listener.join()
 
Last edited:
Maybe this could be an alternative solution?

Python:
import subprocess

proc = subprocess.Popen(['libinput', 'debug-events'], stdout=subprocess.PIPE)

try:
    for line in proc.stdout:
        decoded = line.decode('utf-8').strip()
        print(decoded)
        if 'pointer axis' in decoded and 'vertical' in decoded:
            if 'value 1.0' in decoded:
                print("Scrolled Up")
            elif 'value -1.0' in decoded:
                print("Scrolled Down")
except KeyboardInterrupt:
    proc.terminate()
Requires the libinput-tools package:
Python:
sudo apt install libinput-tools
 
python3 -m evdev.evtest
ID Device Name Phys Uniq
-------------------------------------------------------------------------------------------------------------------
0 /dev/input/event0 Aureon 7.1 USB usb-0000:01:00.0-1.3/input3
1 /dev/input/event1 MOSART Semi. 2.4G Keyboard Mouse usb-0000:01:00.0-1.4/input0
2 /dev/input/event2 MOSART Semi. 2.4G Keyboard Mouse usb-0000:01:00.0-1.4/input1
3 /dev/input/event3 MOSART Semi. 2.4G Keyboard Mouse Consumer Control usb-0000:01:00.0-1.4/input1
4 /dev/input/event4 MOSART Semi. 2.4G Keyboard Mouse System Control usb-0000:01:00.0-1.4/input1
5 /dev/input/event5 MOSART Semi. 2.4G Keyboard Mouse usb-0000:01:00.0-1.4/input1

--------------------------------------------------------------------------------------------------
 
Last edited:
Python:
import asyncio
import evdev
from camilladsp import CamillaClient

MOUSE_PATH = "/dev/input/event2"

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

def adjust_volume(direction):
    current_volume = cdsp.volume.main_volume()
    if current_volume is None:
        print("Error: volume not available")
        return
    volume_change = 1 if direction == "up" else -1
    # Clamp volume between -100 and 0
    new_volume = max(-100, min(0, current_volume + volume_change))
    cdsp.volume.set_main_volume(new_volume)
    print(f"Volume set to {new_volume}")

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:
                adjust_volume("up")
            elif event.value < 0:
                adjust_volume("down")

if __name__ == "__main__":
    asyncio.run(main())