schwinn / khtool

Tool to query or change settings of Neumann KH DSP speakers
MIT License
10 stars 2 forks source link

How to set “frequence”,“q”,“gain” and other curve functions #3

Open Kvas392 opened 6 months ago

Kvas392 commented 6 months ago

Hi,I'm a new one for python, I want to know how to set the frequence curve functions by code, can you give examples? Thanks.

schwinn commented 6 months ago

Hi,

below is an example.

These are the possible values for "type". PARAMETRIC LOSHELF HISHELF LOWPASS HIGHPASS BANDPASS NOTCH ALLPASS HI6DB LO6DB INVERSION

The MA 1 software is using only using filter type "PARAMETRIC".

Hope this helps.

./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"enabled":[true,true,true,true,true,true,true,true,true,true]}}}}'
./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"type":["PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC","PARAMETRIC"]}}}}'
./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"frequency":[84.889,98.930,111.507,196.987,73.046,1291.415,135.585,55.138,381.993,583.255]}}}}'
./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"q":[8.741,11.543,15.390,4.006,8.175,3.553,9.344,3.533,4.248,4.989]}}}}'
./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"gain":[0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000]}}}}'
./khtool.py -i en1 -t 1 --expert '{"audio":{"out":{"equalizer":{"boost":[-3.589,-3.793,-3.041,-8.611,3.186,-2.802,-6.297,1.915,1.443,-1.265]}}}}'
Kvas392 commented 6 months ago

Thanks Can you try it in KH80dsp? (PEQ function)

schwinn commented 6 months ago

This will work for KH80 DSP.

Kvas392 commented 6 months ago

Hi I try it but not work.My system is windows11, First I use Powershell to research my interface name.Then use Miniconda3 try to get my KH80dsp information, can you help me to find where is wrong? Follow is my code,thanks. image


PS C:\Users\Mazhe> ipconfig Windows IP Configuration Ethernet adapter 以太网 6: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Wireless LAN adapter WLAN 2: Connection-specific DNS Suffix . : IPv6 Address. . . . . . . . . . . : 2409:8a18:c16:xxxx::xxx IPv6 Address. . . . . . . . . . . : 2409:8a18:c16:c290:100e:9796:xxxx:xxxx Temporary IPv6 Address. . . . . . : 2409:8a18:c16:c290:80dc:1a9f:xxxx:xxxx Link-local IPv6 Address . . . . . : fe80::f3ef:4856:447b:63xxxx IPv4 Address. . . . . . . . . . . : 192.168.xxx.x Subnet Mask . . . . . . . . . . . : 255.255.xxx.x Default Gateway . . . . . . . . . : fe80::12xxx 192.168.xxxx.x

(base) PS C:\Users\Mazhe> cd D:\khtool-main\ (base) PS D:\khtool-main> python .\khtool.py usage: khtool.py [-h] [--scan] [-q] [--backup BACKUP] [--restore RESTORE] [--comment COMMENT] [--save] [--brightness BRIGHTNESS] [--delay DELAY] [--dimm DIMM] [--level LEVEL] [--mute] [--unmute] [--expert EXPERT] -i INTERFACE [-t {all,0,1,2,3,4,5,6,7,8}] [-v] khtool.py: error: the following arguments are required: -i/--interface (base) PS D:\khtool-main> python .\khtool.py -i WLAN2 -q Traceback (most recent call last): File "D:\khtool-main\khtool.py", line 537, in main() File "D:\khtool-main\khtool.py", line 530, in main device.connect(interface=interface) File "C:\Users\Mazhe\AppData\Roaming\Python\Python311\site-packages\pyssc\Ssc_device.py", line 29, in connect self.socket = socket.create_connection((self.ip + interface, port)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\miniconda3\Lib\socket.py", line 827, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ProgramData\miniconda3\Lib\socket.py", line 962, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno 11001] getaddrinfo

schwinn commented 6 months ago

I have never tested it on Windows. I will test it in the next few days and get back to you.

Kvas392 commented 6 months ago

Thanks,I connect right speaker to my PC with actual net line, I also try it with CMD, Now I can generate khtool.json, json's information is right ,but order(-q) don't work.

Microsoft Windows [Version 10.0.22631.2861] (c) Microsoft Corporation. All rights reserved.

D:\khtool-main>python .\khtool.py usage: khtool.py [-h] [--scan] [-q] [--backup BACKUP] [--restore RESTORE] [--comment COMMENT] [--save] [--brightness BRIGHTNESS] [--delay DELAY] [--dimm DIMM] [--level LEVEL] [--mute] [--unmute] [--expert EXPERT] -i INTERFACE [-t {all,0,1,2,3,4,5,6,7,8}] [-v] khtool.py: error: the following arguments are required: -i/--interface

D:\khtool-main>python .\khtool.py -i--Ethernet6-q Found 1 Device(s) and stored configuration to khtool.json. image

image

schwinn commented 6 months ago

If you have two sepakers connected, please use this command, until both speakers are discovered.

D:\khtool-main>python .\khtool.py -i Ethernet6 --scan

The you can use this command the query all speakers.

D:\khtool-main>python .\khtool.py -i Ethernet6 -q

Kvas392 commented 6 months ago

Hi, I try it and find my two speakers, but it show the Errno 11001 ,I will search further on Google, and wait for your test, Thanks. image image

schwinn commented 6 months ago

I have uploaded a new version. Please give it a try. Under windows, the inteface no longer needs to be specified.

Kvas392 commented 6 months ago

Best wishes for a happy New Year! I test it in win11, but I find some issue in it:

  1. the equalizer can't show all parameters(like q gain and other frequency... ); image
  2. the expert mode seem not work; image

    Brightness/Mute/Unmute/Save is work.

schwinn commented 6 months ago

Hi,

I have reverted the last change in khtool. The interface must now specified again. On my Windows 11 system, I did a ipconfig /all and the local link IPv6 address of the adapter was like 'fe80::3000:0000:0000:cd4f%35'. Then the interface name is the name after the percent sign, so it's 35 in this case.

On windows, the quotation marks has to be excaped. So the correct expert mode command looks like this:

python khtool.py -i 35 --expert {\"m\":{\"audio\":null}} -t 0

The problem with the incomplete output is related to the pyssc library. Please use the my fork of the library. Here are the commands to replace the version.

pip3 uninstall pyssc
pip3 install https://github.com/schwinn/pyssc/archive/master.zip#egg=pyssc
Kvas392 commented 6 months ago

Hi It not ok Step1: Update pyssc,then I connect my Right speaker to motherboard with line, I can find it in MA1 sofaware image image I also try Left speaker, It work. image Step2: I research 以太网6 Idx with CMD, the Idx is 4 image Step3: I exit MA1 software, and try khtool.py but not work. image Step4: I check 以太网6 IPv6,not find problem image image PS: I connect pair speakers to my H3C BX54 Router LAN ,and try to find them on WIFI with MA1 software, I can't see anyone, I will try to check my setting ,strangeness...... image image

Kvas392 commented 6 months ago

I restart my PC, Open MA1 Software, I can find pair speakers use WIFI(WLAN2), then try khtool.py it also not find my speakers. image image image image

schwinn commented 6 months ago

This is strange, because the interface configuration is not used for the device scanning. I have uploaded a new version, where the scanning timeout is increased. Please power cycle your speakers before the scan and try the new version.

schwinn commented 6 months ago

Please post the output of pip3 show pyssc

Kvas392 commented 6 months ago

Hi update new khtool and this is my test,but have some problems: Step1:get the pyssc and khtool information image image Step2: use MA1 software to find speakers by WLAN2, it ok image Step3: research WLAN2 Idx ,Idx=9 image Step4: try to find my pair speakers by khtool, it can find pair speakers and creative the json image image Step5: try to get the pair speakers informations, but it show my Front Left not online,also no Right information image Step5: Try searching for speakers again,it also can find speakers image

schwinn commented 6 months ago

The IPv& address of your "Front left" speaker looks strange. Normally the IP ist starting with fe80::.

I have published a new version, which is supporting non link local IPv6 addresses. Please test this version.

Kvas392 commented 6 months ago

Hi I test the last version, All functions are working and successful, I will buy a pair of KH120II later and test it. The Ipv6 address seems beacause of in China and use wifi to connect my speakers Very Thanks for you. image