• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Building a wireless remote volume control with a rotary knob for Raspberry pi - help needed with Python

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
Hi Marcus,
Michael, over in another forum, suggested that you might be able to help me with my remote control solution for CamillaDSP.

So far - I've got working a remote control using 2 esp32s using the espNOW protocol. What I'd like to do is get CamillaDSP/Rpi4 to talk to my esp32 receiver and read the values. I will be using 6 gain channels and maybe one filter. Michael suggested that I could base this on his Flirc script. But, to be honest, I've absolutely no idea how to proceed from there. It seems that you have gone through the a similar learning process and are now a 5 start expert?
There are plenty of esp32 serial tutorials online so getting that side of things working should be possible for me.
with thanks
James
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,369
Location
Detroit, MI
Hi Marcus,
Michael, over in another forum, suggested that you might be able to help me with my remote control solution for CamillaDSP.

So far - I've got working a remote control using 2 esp32s using the espNOW protocol. What I'd like to do is get CamillaDSP/Rpi4 to talk to my esp32 receiver and read the values. I will be using 6 gain channels and maybe one filter. Michael suggested that I could base this on his Flirc script. But, to be honest, I've absolutely no idea how to proceed from there. It seems that you have gone through the a similar learning process and are now a 5 start expert?
There are plenty of esp32 serial tutorials online so getting that side of things working should be possible for me.
with thanks
James

I actually think it would be better to base your script on @MarcosCh's knob script as he is manipulating gain values in a tone filter which is somewhat similar to what you want to do.

@MarcosCh are you willing to share your script (if you already did this and I missed it I apologize).

Michael
 
  • Like
Reactions: MCH

Timcognito

Major Contributor
Forum Donor
Joined
Jun 28, 2021
Messages
3,556
Likes
13,351
Location
NorCal
FYI $20 for $1000 of tools
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
Hi Marcus,
Michael, over in another forum, suggested that you might be able to help me with my remote control solution for CamillaDSP.

So far - I've got working a remote control using 2 esp32s using the espNOW protocol. What I'd like to do is get CamillaDSP/Rpi4 to talk to my esp32 receiver and read the values. I will be using 6 gain channels and maybe one filter. Michael suggested that I could base this on his Flirc script. But, to be honest, I've absolutely no idea how to proceed from there. It seems that you have gone through the a similar learning process and are now a 5 start expert?
There are plenty of esp32 serial tutorials online so getting that side of things working should be possible for me.
with thanks
James
Hi @jbjbjbjbjb

I am not sure I understand what you intend to do but of course, I can share or try to help you as much as I can, but I can tell you I am no expert!. Like @mdsimon2 , I am not sure anymore of what I have shared and what I have not, but what I have done so far in terms of remote controls and camilladsp is the following:

- Volume control/mute via mqtt with a knob (this thread)
- Tone control (bass/treble) via mqtt with the same knob – but you could have access to and change basically anything in your camilladsp config with some changes.
- Volume config etc via IR with a flirc dongle (basically michael’s tutorial)
- On/off and other switching stuff via IR with a raspberry pi pico w


All of these run in python/micropython so even the mqtt ones could be useful as starting point for IR.

I have also built some tiny streamers with ESP32 microcontrollers but they don’t have any remote control capabilities, and to be honest I would have no idea how to implement remote control to them, but I am sure it is doable. See here:


Just let me know what you want me to share, and, if you wish, share your original question in the other forum or explain a bit further what exactly you want to do and I can try to help you.

By the way, are you ok doing your changes blind or you want the changes to show in a display? In my opinion doing filters changes blind is a bit risky unless you have golden ears... If you want to see the changes in a display, it adds a layer of complexity but is doable as well (my experience is only with an oled display as per michael’s tutorial).
 

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
Hi @jbjbjbjbjb

I am not sure I understand what you intend to do but of course, I can share or try to help you as much as I can, but I can tell you I am no expert!. Like @mdsimon2 , I am not sure anymore of what I have shared and what I have not, but what I have done so far in terms of remote controls and camilladsp is the following:

- Volume control/mute via mqtt with a knob (this thread)
- Tone control (bass/treble) via mqtt with the same knob – but you could have access to and change basically anything in your camilladsp config with some changes.
- Volume config etc via IR with a flirc dongle (basically michael’s tutorial)
- On/off and other switching stuff via IR with a raspberry pi pico w


All of these run in python/micropython so even the mqtt ones could be useful as starting point for IR.

I have also built some tiny streamers with ESP32 microcontrollers but they don’t have any remote control capabilities, and to be honest I would have no idea how to implement remote control to them, but I am sure it is doable. See here:


Just let me know what you want me to share, and, if you wish, share your original question in the other forum or explain a bit further what exactly you want to do and I can try to help you.

By the way, are you ok doing your changes blind or you want the changes to show in a display? In my opinion doing filters changes blind is a bit risky unless you have golden ears... If you want to see the changes in a display, it adds a layer of complexity but is doable as well (my experience is only with an oled display as per michael’s tutorial).

Thanks Marcus,
In essence, I'm looking to do your tone control knob project but bypassing the MQTT broker and talking to the Rpi/Camilla directly. My esp32 receiver provides display (using neopixel rings) and the remote itself uses slider pots - so it's very easy to see what's set. I'm testing this at the moment and the espnow protocol seems rock solid. It's set up to pass 3 variables from 0-127 which I intend to use as Volume, balance, and Basslift/cut, but it will be easy to add more sliders or switches later.

So, I think I need to make a serial connection between the esp32 receiver and Rpi and pass the camilladsp config with suitable changes? Could you show me your Tone control script so I can try to work out how it works?

thanks
james
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
Thanks Marcus,
In essence, I'm looking to do your tone control knob project but bypassing the MQTT broker and talking to the Rpi/Camilla directly. My esp32 receiver provides display (using neopixel rings) and the remote itself uses slider pots - so it's very easy to see what's set. I'm testing this at the moment and the espnow protocol seems rock solid. It's set up to pass 3 variables from 0-127 which I intend to use as Volume, balance, and Basslift/cut, but it will be easy to add more sliders or switches later.

So, I think I need to make a serial connection between the esp32 receiver and Rpi and pass the camilladsp config with suitable changes? Could you show me your Tone control script so I can try to work out how it works?

thanks
james
Cool, sure, i will post my knob script and you take it from there. I am not home now, but will try to do it tonight or during the weekend.
It is very simple actually, in the meantime i recommend you to read camilladsp python library in the link below. What is of interest for your project is the get and set config parts. With this Camilladsp gives and receives all config settings. You will see in my script how you can handle them.


One thing that i did is to receive and use actions from my remote, not absolute values, (that is, volume down or volume up, not volume -25) for two reasons:
1. If some messages are lost on their way and you don't notice it, you might experience a very drastic change next time you use your remote
2. If you make changes using other means (for instance the UI), you need to find the way to reset the absolute value of your remote... probably easy to do, but it is something you will not find in my script.
*edit:ah i see you use sliders, so you will want to use absolute values then. That is fine, and probably easier.

Hope it helps, feel free to give me a heads up if I forget to post the script.
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
@jbjbjbjbjb
You can find attached the tone control script. Have a look and feel free to ask whatever questions you have. You can see that there are many print instructions commented, i find them extremely useful to troubleshoot and to see what is going on when I write the code. If you know nothing about python like me, i recommend you to use them.
You can see as well that i limited the range of the control to a maximum of +/- 9.5 db, (that i consider is more than enough anyways), because otherwise the changes necessary to display two figures on the oled display would be way too complex. You can of course do what you please with that. I fixed the increments to +-0.5 dB, again, your choice.

For this to work you need to have filters called "bass" and "treble", in this case, or the name of your choice in your camilladsp config, but they need to match with the names you use in your script.
I also highly recommend that first thing you print the output of cdsp.get_config() and get familiar with what exactly you want to change. This output will change depending on your configuration.
Well, have fun and let me know how it works for you.

PS: btw, if someone has suggestions on how to get the parameters easier from the string that camilladsp outputs, i would like to hear them. Thanks
 

Attachments

  • 2023-01-27 tonecontrolevent py.zip
    1,014 bytes · Views: 62
Last edited:

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
@MarcosCh
Thanks very much indeed for your script and advice.
So, I'm trying to "print the output of cdsp.get_config()"

I'm looking at the example on pycamilladsp page-

from camilladsp import CamillaConnection

cdsp = CamillaConnection("127.0.0.1", 1234)
cdsp.connect()
print("Version: {}".format(cdsp.get_version()))

I'm assuming I can connect to the websocket via a browser. But I really don't know how to do this, and haven't been able to find any tutorial that I can understand yet.
Can you point me in the right direction?
Sorry if this is very basic.
thanks!
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
@MarcosCh
Thanks very much indeed for your script and advice.
So, I'm trying to "print the output of cdsp.get_config()"

I'm looking at the example on pycamilladsp page-

from camilladsp import CamillaConnection

cdsp = CamillaConnection("127.0.0.1", 1234)
cdsp.connect()
print("Version: {}".format(cdsp.get_version()))

I'm assuming I can connect to the websocket via a browser. But I really don't know how to do this, and haven't been able to find any tutorial that I can understand yet.
Can you point me in the right direction?
Sorry if this is very basic.
thanks!
just run your python script draft from the command window. For instance, i have just taken the example script that i attached before and added a line with an instruction to print the config that camilladsp reports. In my example i have called it cdspconf:

1677950510078.png


and here is the outcome of what camilladsp reported as example. In my script, the target was to change the bass and treble gain, i have highlighted where these parameters are. Your case will be different. This is just an example that i think will help you see what you are targeting. It is not necessary to do, just that i think will help you to know what are you dealing with when you write the code. Hope it helps and does not confuse further. (note that "bass" and "treble" filters are there because i created them and gave them those names. If you don't have such filters in your config, you will not see them)

1677950324066.png
 

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
Fantastic @MarcosCh, your help is invaluable!
I've now understood how to get the bits of cdspconf into variables and print them out. I feel like a programmer already!
Next test is to change them and send them back, I think I understand how your script does it.

Do you have any examples of setting up a serial connection using a GPIO? Then it would really all look possible...
 
  • Like
Reactions: MCH
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
Do you have any examples of setting up a serial connection using a GPIO? Then it would really all look possible...
I am afraid i don't. I am working now on a different project in which i aim to control a spdif transceiver chip from this same raspberry pi via i2c. The only thing i know for now is that there are python modules that allow you to do that via python, for instance smbus and smbus2. But this is to send, and receive, i2c messages from the pi, i believe you want to do the opposite (?). I have no idea i am afraid...

 

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
I am afraid i don't. I am working now on a different project in which i aim to control a spdif transceiver chip from this same raspberry pi via i2c. The only thing i know for now is that there are python modules that allow you to do that via python, for instance smbus and smbus2. But this is to send, and receive, i2c messages from the pi, i believe you want to do the opposite (?). I have no idea i am afraid...

Just a quick update -
It turns out that you can use a usb lead to connect a esp32/arduino to a rpi - and it works! The rpi can now see the volume setting. Now I need to work out how to shove that into cdspconf. More soon.
 

jbjbjbjbjb

Member
Joined
Feb 12, 2022
Messages
24
Likes
12
I'm almost all done! Thanks to you guys and ChatGTP (seriously! - it's incredibly helpful. For example, ask it to print a file tree version of cdspconf....)
I'll show you the completed project when I've made the remote pretty, and a more advanced display.
I was a bit confused for a while because although the web GUI updates the volume (and has live meters) the changes to cdspconf aren't reflected - not even the bass and treble. Do you have any idea why? or if this can be changed?
 
  • Like
Reactions: MCH
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
I was a bit confused for a while because although the web GUI updates the volume (and has live meters) the changes to cdspconf aren't reflected - not even the bass and treble. Do you have any idea why? or if this can be changed?
Same happens to me, but as it isn't relevant for my use case i never bothered to try to fix it... Let's see if someone chimes in... @mdsimon2 any idea?
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,369
Location
Detroit, MI
Same happens to me, but as it isn't relevant for my use case i never bothered to try to fix it... Let's see if someone chimes in... @mdsimon2 any idea?

Hmm...interesting. You guys are doing more advanced stuff than me so I am not sure I can be of much help. For volume there is a separate command, cdsp.get_volume(), which can be used to get volume. I think this makes sense as volume is a more dynamic property than most configuration parameters. I use cdsp.get_volume() in my oled display routine and can confirm it works with both GUI and IR remote triggered volume updates.

For the bass / treble filters when I update these using the sliders in the GUI it seems to be reflected when running cdsp.get_config().

Rich (BB code):
{'devices': {'samplerate': 48000, 'chunksize': 1024, 'queuelimit': 4, 'silence_threshold': -100.0, 'silence_timeout': 5.0, 'capture': {'type': 'Alsa', 'channels': 20, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'playback': {'type': 'Alsa', 'channels': 22, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'enable_rate_adjust': False, 'target_level': 1024, 'adjust_period': 10.0, 'enable_resampling': False, 'resampler_type': 'Synchronous', 'capture_samplerate': 48000, 'stop_on_rate_change': False, 'rate_measure_interval': 1.0}, 'mixers': {'20x22': {'channels': {'in': 20, 'out': 22}, 'mapping': [{'dest': 0, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 1, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 2, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 3, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 4, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 5, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 6, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 7, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 8, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 9, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 10, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 11, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 12, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 13, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 14, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 15, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 16, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 17, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 18, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 19, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 20, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 21, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}]}}, 'filters': {'Treble': {'type': 'Biquad', 'parameters': {'type': 'Highshelf', 'freq': 6500.0, 'q': 0.7, 'gain': 0.0}}, 'volume': {'type': 'Volume', 'parameters': {'ramp_time': 200.0}}, 'Bass': {'type': 'Biquad', 'parameters': {'type': 'Lowshelf', 'freq': 85.0, 'q': 0.9, 'gain': 3.8}}}, 'pipeline': [{'type': 'Mixer', 'name': '20x22'}, {'type': 'Filter', 'channel': 0, 'names': ['volume', 'Bass', 'Treble']}, {'type': 'Filter', 'channel': 1, 'names': ['volume']}, {'type': 'Filter', 'channel': 2, 'names': ['volume']}, {'type': 'Filter', 'channel': 3, 'names': ['volume']}, {'type': 'Filter', 'channel': 4, 'names': ['volume']}, {'type': 'Filter', 'channel': 5, 'names': ['volume']}, {'type': 'Filter', 'channel': 6, 'names': ['volume']}, {'type': 'Filter', 'channel': 7, 'names': ['volume']}, {'type': 'Filter', 'channel': 8, 'names': ['volume']}, {'type': 'Filter', 'channel': 9, 'names': ['volume']}, {'type': 'Filter', 'channel': 10, 'names': ['volume']}, {'type': 'Filter', 'channel': 11, 'names': ['volume']}, {'type': 'Filter', 'channel': 12, 'names': ['volume']}, {'type': 'Filter', 'channel': 13, 'names': ['volume']}, {'type': 'Filter', 'channel': 14, 'names': ['volume']}, {'type': 'Filter', 'channel': 15, 'names': ['volume']}, {'type': 'Filter', 'channel': 16, 'names': ['volume']}, {'type': 'Filter', 'channel': 17, 'names': ['volume']}, {'type': 'Filter', 'channel': 18, 'names': ['volume']}, {'type': 'Filter', 'channel': 19, 'names': ['volume']}, {'type': 'Filter', 'channel': 20, 'names': ['volume']}, {'type': 'Filter', 'channel': 21, 'names': ['volume']}]}

{'devices': {'samplerate': 48000, 'chunksize': 1024, 'queuelimit': 4, 'silence_threshold': -100.0, 'silence_timeout': 5.0, 'capture': {'type': 'Alsa', 'channels': 20, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'playback': {'type': 'Alsa', 'channels': 22, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'enable_rate_adjust': False, 'target_level': 1024, 'adjust_period': 10.0, 'enable_resampling': False, 'resampler_type': 'Synchronous', 'capture_samplerate': 48000, 'stop_on_rate_change': False, 'rate_measure_interval': 1.0}, 'mixers': {'20x22': {'channels': {'in': 20, 'out': 22}, 'mapping': [{'dest': 0, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 1, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 2, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 3, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 4, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 5, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 6, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 7, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 8, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 9, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 10, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 11, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 12, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 13, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 14, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 15, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 16, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 17, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 18, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 19, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 20, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 21, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}]}}, 'filters': {'Treble': {'type': 'Biquad', 'parameters': {'type': 'Highshelf', 'freq': 6500.0, 'q': 0.7, 'gain': 0.0}}, 'volume': {'type': 'Volume', 'parameters': {'ramp_time': 200.0}}, 'Bass': {'type': 'Biquad', 'parameters': {'type': 'Lowshelf', 'freq': 85.0, 'q': 0.9, 'gain': -2.5}}}, 'pipeline': [{'type': 'Mixer', 'name': '20x22'}, {'type': 'Filter', 'channel': 0, 'names': ['volume', 'Bass', 'Treble']}, {'type': 'Filter', 'channel': 1, 'names': ['volume']}, {'type': 'Filter', 'channel': 2, 'names': ['volume']}, {'type': 'Filter', 'channel': 3, 'names': ['volume']}, {'type': 'Filter', 'channel': 4, 'names': ['volume']}, {'type': 'Filter', 'channel': 5, 'names': ['volume']}, {'type': 'Filter', 'channel': 6, 'names': ['volume']}, {'type': 'Filter', 'channel': 7, 'names': ['volume']}, {'type': 'Filter', 'channel': 8, 'names': ['volume']}, {'type': 'Filter', 'channel': 9, 'names': ['volume']}, {'type': 'Filter', 'channel': 10, 'names': ['volume']}, {'type': 'Filter', 'channel': 11, 'names': ['volume']}, {'type': 'Filter', 'channel': 12, 'names': ['volume']}, {'type': 'Filter', 'channel': 13, 'names': ['volume']}, {'type': 'Filter', 'channel': 14, 'names': ['volume']}, {'type': 'Filter', 'channel': 15, 'names': ['volume']}, {'type': 'Filter', 'channel': 16, 'names': ['volume']}, {'type': 'Filter', 'channel': 17, 'names': ['volume']}, {'type': 'Filter', 'channel': 18, 'names': ['volume']}, {'type': 'Filter', 'channel': 19, 'names': ['volume']}, {'type': 'Filter', 'channel': 20, 'names': ['volume']}, {'type': 'Filter', 'channel': 21, 'names': ['volume']}]}

Sorry this didn't wrap nicely, here is an image to the important part.

1678724793518.png


Are you seeing something different?

Michael
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
Hmm...interesting. You guys are doing more advanced stuff than me so I am not sure I can be of much help. For volume there is a separate command, cdsp.get_volume(), which can be used to get volume. I think this makes sense as volume is a more dynamic property than most configuration parameters. I use cdsp.get_volume() in my oled display routine and can confirm it works with both GUI and IR remote triggered volume updates.

For the bass / treble filters when I update these using the sliders in the GUI it seems to be reflected when running cdsp.get_config().

Rich (BB code):
{'devices': {'samplerate': 48000, 'chunksize': 1024, 'queuelimit': 4, 'silence_threshold': -100.0, 'silence_timeout': 5.0, 'capture': {'type': 'Alsa', 'channels': 20, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'playback': {'type': 'Alsa', 'channels': 22, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'enable_rate_adjust': False, 'target_level': 1024, 'adjust_period': 10.0, 'enable_resampling': False, 'resampler_type': 'Synchronous', 'capture_samplerate': 48000, 'stop_on_rate_change': False, 'rate_measure_interval': 1.0}, 'mixers': {'20x22': {'channels': {'in': 20, 'out': 22}, 'mapping': [{'dest': 0, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 1, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 2, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 3, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 4, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 5, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 6, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 7, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 8, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 9, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 10, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 11, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 12, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 13, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 14, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 15, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 16, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 17, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 18, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 19, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 20, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 21, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}]}}, 'filters': {'Treble': {'type': 'Biquad', 'parameters': {'type': 'Highshelf', 'freq': 6500.0, 'q': 0.7, 'gain': 0.0}}, 'volume': {'type': 'Volume', 'parameters': {'ramp_time': 200.0}}, 'Bass': {'type': 'Biquad', 'parameters': {'type': 'Lowshelf', 'freq': 85.0, 'q': 0.9, 'gain': 3.8}}}, 'pipeline': [{'type': 'Mixer', 'name': '20x22'}, {'type': 'Filter', 'channel': 0, 'names': ['volume', 'Bass', 'Treble']}, {'type': 'Filter', 'channel': 1, 'names': ['volume']}, {'type': 'Filter', 'channel': 2, 'names': ['volume']}, {'type': 'Filter', 'channel': 3, 'names': ['volume']}, {'type': 'Filter', 'channel': 4, 'names': ['volume']}, {'type': 'Filter', 'channel': 5, 'names': ['volume']}, {'type': 'Filter', 'channel': 6, 'names': ['volume']}, {'type': 'Filter', 'channel': 7, 'names': ['volume']}, {'type': 'Filter', 'channel': 8, 'names': ['volume']}, {'type': 'Filter', 'channel': 9, 'names': ['volume']}, {'type': 'Filter', 'channel': 10, 'names': ['volume']}, {'type': 'Filter', 'channel': 11, 'names': ['volume']}, {'type': 'Filter', 'channel': 12, 'names': ['volume']}, {'type': 'Filter', 'channel': 13, 'names': ['volume']}, {'type': 'Filter', 'channel': 14, 'names': ['volume']}, {'type': 'Filter', 'channel': 15, 'names': ['volume']}, {'type': 'Filter', 'channel': 16, 'names': ['volume']}, {'type': 'Filter', 'channel': 17, 'names': ['volume']}, {'type': 'Filter', 'channel': 18, 'names': ['volume']}, {'type': 'Filter', 'channel': 19, 'names': ['volume']}, {'type': 'Filter', 'channel': 20, 'names': ['volume']}, {'type': 'Filter', 'channel': 21, 'names': ['volume']}]}

{'devices': {'samplerate': 48000, 'chunksize': 1024, 'queuelimit': 4, 'silence_threshold': -100.0, 'silence_timeout': 5.0, 'capture': {'type': 'Alsa', 'channels': 20, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'playback': {'type': 'Alsa', 'channels': 22, 'device': 'hw:UltraLitemk5', 'format': 'S24LE3'}, 'enable_rate_adjust': False, 'target_level': 1024, 'adjust_period': 10.0, 'enable_resampling': False, 'resampler_type': 'Synchronous', 'capture_samplerate': 48000, 'stop_on_rate_change': False, 'rate_measure_interval': 1.0}, 'mixers': {'20x22': {'channels': {'in': 20, 'out': 22}, 'mapping': [{'dest': 0, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 1, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 2, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 3, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 4, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 5, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 6, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 7, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 8, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 9, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 10, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 11, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 12, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 13, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 14, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 15, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 16, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 17, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 18, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 19, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 20, 'sources': [{'channel': 12, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}, {'dest': 21, 'sources': [{'channel': 13, 'gain': 0.0, 'inverted': False, 'mute': False}], 'mute': False}]}}, 'filters': {'Treble': {'type': 'Biquad', 'parameters': {'type': 'Highshelf', 'freq': 6500.0, 'q': 0.7, 'gain': 0.0}}, 'volume': {'type': 'Volume', 'parameters': {'ramp_time': 200.0}}, 'Bass': {'type': 'Biquad', 'parameters': {'type': 'Lowshelf', 'freq': 85.0, 'q': 0.9, 'gain': -2.5}}}, 'pipeline': [{'type': 'Mixer', 'name': '20x22'}, {'type': 'Filter', 'channel': 0, 'names': ['volume', 'Bass', 'Treble']}, {'type': 'Filter', 'channel': 1, 'names': ['volume']}, {'type': 'Filter', 'channel': 2, 'names': ['volume']}, {'type': 'Filter', 'channel': 3, 'names': ['volume']}, {'type': 'Filter', 'channel': 4, 'names': ['volume']}, {'type': 'Filter', 'channel': 5, 'names': ['volume']}, {'type': 'Filter', 'channel': 6, 'names': ['volume']}, {'type': 'Filter', 'channel': 7, 'names': ['volume']}, {'type': 'Filter', 'channel': 8, 'names': ['volume']}, {'type': 'Filter', 'channel': 9, 'names': ['volume']}, {'type': 'Filter', 'channel': 10, 'names': ['volume']}, {'type': 'Filter', 'channel': 11, 'names': ['volume']}, {'type': 'Filter', 'channel': 12, 'names': ['volume']}, {'type': 'Filter', 'channel': 13, 'names': ['volume']}, {'type': 'Filter', 'channel': 14, 'names': ['volume']}, {'type': 'Filter', 'channel': 15, 'names': ['volume']}, {'type': 'Filter', 'channel': 16, 'names': ['volume']}, {'type': 'Filter', 'channel': 17, 'names': ['volume']}, {'type': 'Filter', 'channel': 18, 'names': ['volume']}, {'type': 'Filter', 'channel': 19, 'names': ['volume']}, {'type': 'Filter', 'channel': 20, 'names': ['volume']}, {'type': 'Filter', 'channel': 21, 'names': ['volume']}]}

Sorry this didn't wrap nicely, here is an image to the important part.

View attachment 271403

Are you seeing something different?

Michael
I think i have found the issue in my case (as said, i never use the GUI so i never bothered too much).
As you can see above, i had named the filters bass and treble with no caps, and appears that the GUI must be case sensitive :facepalm: just renamed Bass and Treble and all works now...
Before:
Screenshot_2023-03-13-18-03-25-60_40deb401b9ffe8e1df2f1cc5ba480b12.jpg
After:
Screenshot_2023-03-13-18-08-17-09_40deb401b9ffe8e1df2f1cc5ba480b12.jpg
Sorry @jbjbjbjbjb for messing this up. Just need to change the names and i bet it will work
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
I was testing further.
Changing the name of the filters to the correct Bass and Treble makes that both the knob script and the GUI work properly, but when i use the knob to change either, the new value does not update in the GUI, not even refreshing the webpage.
 

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,515
Likes
3,369
Location
Detroit, MI
I was testing further.
Changing the name of the filters to the correct Bass and Treble makes that both the knob script and the GUI work properly, but when i use the knob to change either, the new value does not update in the GUI, not even refreshing the webpage.

Interesting, when you say it doesn't update in the GUI are you saying the sliders on the compact view, the values shown in the filter tab or both? That seems very odd to me because if I use the sliders it updates the values on the filter tab and if I update the levels on the filter tab (and load to the DSP) it is reflected on the sliders. I would think loading a configuration using cdsp.set_config() would be the same.

I assume it is correctly reflected when running cdsp.get_config()?

Michael
 
OP
M

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,652
Likes
2,259
Interesting, when you say it doesn't update in the GUI are you saying the sliders on the compact view, the values shown in the filter tab or both? That seems very odd to me because if I use the sliders it updates the values on the filter tab and if I update the levels on the filter tab (and load to the DSP) it is reflected on the sliders. I would think loading a configuration using cdsp.set_config() would be the same.

I assume it is correctly reflected when running cdsp.get_config()?

Michael
This is very odd, i will try to explain it the best I can, it seems a bit complex and i think needs more testing to understand what is actually going on:

-if i change bass or treble with the sliders in the simplified view in my smartphone, i can hear the effect (=it works) and the knob script sees the change. However the filters tab does not reflect the change. (See capture and picture below)

-if i change bass/treble with the knob, it takes effect on the sound but neither filters tab not smartphone simplified view reflects the change.

-If i change bass/treble in the filters tab, it makes effect on the sound and the knob sees the change but the smartphone sliders don't

-if all cases, if i refresh the smartphone browser, the sliders go back to 0 but this does not change the sound.

Feels like an issue with the sliders in the smartphone and the filters tab: they work if you use them manually but they don't reflect changes done anywhere else

Screenshot_2023-03-13-21-44-28-66_40deb401b9ffe8e1df2f1cc5ba480b12.jpgScreenshot_2023-03-13-22-03-18-98_92460851df6f172a4592fca41cc2d2e6.jpg
*edit: i see the picture doesn't show the names of the filters, but Bass is the one on top and Treble the second from the bottom
 
Top Bottom