INTERACT FORUM

More => Old Versions => JRiver Media Center 28 for Windows => Topic started by: mattkhan on May 01, 2021, 05:43:24 pm

Title: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 01, 2021, 05:43:24 pm
I know I've asked before but it's been a few versions since asking so.... basically the Load/Save DSP file option as an MCWS call would be great. I think this would add some value as there is at least one app out there that would adopt it straightaway.

BEQ (bass eq) has moved on now from the thick client mentioned in https://yabb.jriver.com/interact/index.php/topic,124236.0.html to the ezbeq webapp (see attached & https://ezbeq.readthedocs.io/) which means minidsp and monolith htp1 users get to load the DSP config for a particular track from their phone/tablet. Meanwhile I'm sitting here using a phone/tablet to pick something to watch but *can't* edit the DSP applied in the same way and instead have to do that manually like some barbarian :'(

We have >3k films and TV series with published filters now (https://beqcatalogue.readthedocs.io/en/latest/) so it's a pretty comprehensive library of filters to apply, just need those couple of MCWS calls to make it possible.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 04, 2021, 04:59:46 pm
Are you looking to load a saved configuration file using the file saving we recently added?
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 04, 2021, 05:15:55 pm
Ideally I would just send the content of such a file as the payload on the request and be able to aim that at a particular zone. I do not want to load some actual local file that exists on the target host.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: JimH on May 04, 2021, 05:34:27 pm
Hi Matt,
Are you 3ll3d00d over on AVS Forum?

I think I follow you but let me be sure.

You have packages of equalizer information that your users need to adjust the bass for playing Blu-ray movies that lost some of the bass when the discs were produced.

Can you define a couple of MCWS calls you need to make?  Is it just this?

Quote
basically the Load/Save DSP file option as an MCWS call
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 05, 2021, 03:18:02 am
yes that's me and you understand correctly, there are a large number of filters that have been designed to restore low frequency content on film/tv soundtracks & we now have a remote control app which can load those filters into certain DSP devices. To add support for MC, I minimally need 2 calls that do the following

1) get the DSP config for a zone, is equivalent to the save DSP file option in DSP studio

GET MCWS/v1/DSP/Save?Zone=12345&ZoneType=ID

response includes the same content the DSP file export would produce

2) set the DSP config for a zone, is equivalent to the load DSP file option in DSP studio

for this call, it would be ideal to be able to post the dsp file content in the body of the response

POST MCWS/v1/DSP/Load?Zone=12345&ZoneType=ID
   BODY = dsp file content

I haven't seen any other MCWS calls that have a body though so not sure if some limitation there

if there is such a limitation then an approach that relies on access to a shared drive can be made to work

Thanks for considering this!
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: JimH on May 05, 2021, 06:11:30 am
We'll take a look at it.  Thanks.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 06, 2021, 09:10:36 am
Just to follow up here, we recently added these two features:
NEW: The Playback/LoadDSPPreset function accepts a saved DSP preset file (remember to URL escape).
NEW: Added Playback/SaveDSPPreset to return a saved preset.

Thanks for the help.  If there is more we should do, just let us know.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 07, 2021, 05:53:20 pm
NEW: The Playback/LoadDSPPreset function accepts a saved DSP preset file (remember to URL escape).
can you clarify what exactly is expected to the Name parameter pls, does it mean it's expected a full path to a file accessible to the remote machine or does it mean you will allow the entire payload to be packed into the query parameter? (the latter will be quite massive)

I tried both of the above and can get neither to work though the call appears to return OK regardless of what I send so bit hard to tell what is going on.

Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 07, 2021, 05:58:14 pm
can you clarify what exactly is expected to the Name parameter pls, does it mean it's expected a full path to a file accessible to the remote machine or does it mean you will allow the entire payload to be packed into the query parameter? (the latter will be quite massive)

I tried both of the above and can get neither to work though the call appears to return OK regardless of what I send so bit hard to tell what is going on.

It's either the name of a saved preset, or the contents of a preset file.

When I was testing, I needed to URL escape the contents like this:
Code: [Select]
JRString strPreset;
strPreset.FromFile(_T("C:\\Smile.dsp"));
strPreset = strPreset.GetURLEncoded();

JRString strResponse;
strResponse.FromFile(_T("http://localhost:52199/MCWS/v1/Playback/LoadDSPPreset?Name=") + strPreset);
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 07, 2021, 06:04:05 pm
Hmm ok, I think that is what I was doing. I will try again. Can you respond with a 400 if I send something you can't understand and 500 if you can't apply it? Would help debug issues I think (or log a bit more about what just happening)
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 08, 2021, 07:40:00 am
It's either the name of a saved preset, or the contents of a preset file.

When I was testing, I needed to URL escape the contents like this:
Code: [Select]
JRString strPreset;
strPreset.FromFile(_T("C:\\Smile.dsp"));
strPreset = strPreset.GetURLEncoded();

JRString strResponse;
strResponse.FromFile(_T("http://localhost:52199/MCWS/v1/Playback/LoadDSPPreset?Name=") + strPreset);
can you share the file above and show the encoded output pls so I can compare locally as I can't get this to work

here's an example, this is taken from a wireshark packet capture to be sure what actually hit the wire

Code: [Select]
/MCWS/v1/Playback/LoadDSPPreset?Token=mytoken&Zone=Player&ZoneType=Name&Name=%3C%3Fxml+version%3D%271.0%27+encoding%3D%27UTF-8%27%3F%3E%0D%0A%3CDSP+Version%3D%221%22%3E%0D%0A%3CPreset%3E%0D%0A%3CKey+Name%3D%22DSP+Studio%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order+Version%3C%2FName%3E%0D%0A%3CValue%3E5%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order%3C%2FName%3E%0D%0A%3CValue%3E%281%3A1%29%282%3A12%29%2813%3AOutput+Format%29%2815%3AVolume+Leveling%29%2815%3AAdaptive+Volume%29%289%3AEqualizer%29%2820%3AParametric+Equalizer%29%287%3AEffects%29%2810%3AHeadphones%29%2813%3ATempo+%26amp%3B+Pitch%29%2815%3ARoom+Correction%29%2811%3AConvolution%29%2822%3AParametric+Equalizer+2%29%288%3AAnalyzer%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EDSP+Studio+Last+Selection%3C%2FName%3E%0D%0A%3CValue%3EAnalyzer%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Room+Correction%22+%2F%3E%0D%0A%3CKey+Name%3D%22Analyzer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMinimum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E40%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMaximum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E18000%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%3CName%3EFilters%3C%2FName%3E%3CValue%3E%281%3A1%29%281%3A1%29%28241%3A%26lt%3BXMLPH+version%3D%221.1%22%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Enabled%22%26gt%3B1%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Slope%22%26gt%3B12%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Q%22%26gt%3B1.2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Type%22%26gt%3B3%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Gain%22%26gt%3B4%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Frequency%22%26gt%3B40%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Channels%22%26gt%3B2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3B%2FXMLPH%26gt%3B%29%3C%2FValue%3E%3C%2FData%3E%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer+2%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Tempo+%26amp%3B+Pitch%22+%2F%3E%0D%0A%3CKey+Name%3D%22Volume+Leveling%22+%2F%3E%0D%0A%3CKey+Name%3D%22Equalizer%22+%2F%3E%0D%0A%3CKey+Name%3D%22Effects%22+%2F%3E%0D%0A%3CKey+Name%3D%22Convolution%22+%2F%3E%0D%0A%3CKey+Name%3D%22Audio+Settings%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Impact+Filter%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Encoding%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Pseudo+Surround+Detection%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channels%3C%2FName%3E%0D%0A%3CValue%3E2%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Sample+Rate+Settings%3C%2FName%3E%0D%0A%3CValue%3E%281%3A3%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Phantom+Center%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channel+Layout%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Two+Point+One+Mixing%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Cutoff+Downmix%3C%2FName%3E%0D%0A%3CValue%3E120%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3ECenter+Level%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EAllow+Custom+Output+Format%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Padding+Channels%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Cutoff%3C%2FName%3E%0D%0A%3CValue%3E60%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3ELast+Change+Time%3C%2FName%3E%0D%0A%3CValue%3E1615739210%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Mode%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Adaptive+Volume%22+%2F%3E%0D%0A%3C%2FPreset%3E%0D%0A%3C%2FDSP%3E
decoded this produces

Code: [Select]
<?xml version=\'1.0\' encoding=\'UTF-8\'?>\r\n<DSP Version="1">\r\n<Preset>\r\n<Key Name="DSP Studio">\r\n<Data>\r\n<Name>Plugin Order Version</Name>\r\n<Value>5</Value>\r\n</Data>\r\n<Data>\r\n<Name>Plugin Order</Name>\r\n<Value>(1:1)(2:12)(13:Output Format)(15:Volume Leveling)(15:Adaptive Volume)(9:Equalizer)(20:Parametric Equalizer)(7:Effects)(10:Headphones)(13:Tempo &amp; Pitch)(15:Room Correction)(11:Convolution)(22:Parametric Equalizer 2)(8:Analyzer)</Value>\r\n</Data>\r\n<Data>\r\n<Name>DSP Studio Last Selection</Name>\r\n<Value>Analyzer</Value>\r\n</Data>\r\n</Key>\r\n<Key Name="Room Correction" />\r\n<Key Name="Analyzer">\r\n<Data>\r\n<Name>Enabled</Name>\r\n<Value>1</Value>\r\n</Data>\r\n<Data>\r\n<Name>Minimum Frequency</Name>\r\n<Value>40</Value>\r\n</Data>\r\n<Data>\r\n<Name>Maximum Frequency</Name>\r\n<Value>18000</Value>\r\n</Data>\r\n</Key>\r\n<Key Name="Parametric Equalizer">\r\n<Data>\r\n<Name>Enabled</Name>\r\n<Value>1</Value>\r\n</Data>\r\n<Data><Name>Filters</Name><Value>(1:1)(1:1)(241:&lt;XMLPH version="1.1"&gt;\r\n&lt;Item Name="Enabled"&gt;1&lt;/Item&gt;\r\n&lt;Item Name="Slope"&gt;12&lt;/Item&gt;\r\n&lt;Item Name="Q"&gt;1.2&lt;/Item&gt;\r\n&lt;Item Name="Type"&gt;3&lt;/Item&gt;\r\n&lt;Item Name="Gain"&gt;4&lt;/Item&gt;\r\n&lt;Item Name="Frequency"&gt;40&lt;/Item&gt;\r\n&lt;Item Name="Channels"&gt;2&lt;/Item&gt;\r\n&lt;/XMLPH&gt;)</Value></Data></Key>\r\n<Key Name="Parametric Equalizer 2">\r\n<Data>\r\n<Name>Enabled</Name>\r\n<Value>1</Value>\r\n</Data>\r\n</Key>\r\n<Key Name="Tempo &amp; Pitch" />\r\n<Key Name="Volume Leveling" />\r\n<Key Name="Equalizer" />\r\n<Key Name="Effects" />\r\n<Key Name="Convolution" />\r\n<Key Name="Audio Settings">\r\n<Data>\r\n<Name>Output Surround Subwoofer Impact Filter</Name>\r\n<Value>1</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Encoding</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Pseudo Surround Detection</Name>\r\n<Value>1</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Channels</Name>\r\n<Value>2</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Sample Rate Settings</Name>\r\n<Value>(1:3)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)(1:0)</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Surround Phantom Center</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Channel Layout</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Surround Two Point One Mixing</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Surround Subwoofer Cutoff Downmix</Name>\r\n<Value>120</Value>\r\n</Data>\r\n<Data>\r\n<Name>Center Level</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Allow Custom Output Format</Name>\r\n<Value>1</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Padding Channels</Name>\r\n<Value>0</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Surround Subwoofer Cutoff</Name>\r\n<Value>60</Value>\r\n</Data>\r\n<Data>\r\n<Name>Last Change Time</Name>\r\n<Value>1615739210</Value>\r\n</Data>\r\n<Data>\r\n<Name>Output Surround Mode</Name>\r\n<Value>1</Value>\r\n</Data>\r\n</Key>\r\n<Key Name="Adaptive Volume" />\r\n</Preset>\r\n</DSP>
if I write this to a file and load it via DSP studio, the configuration is applied as expected
if I hit that URL, MC returns a 200 and nothing happens

MC logs say

Code: [Select]
50592665: 18856: Sharing Plugins: CHTTPListenerWorker::HandleConnection: Start
50592665: 18856: Sharing Plugins: CHTTPListenerWorker::HandleRequest: TCP: 1.2.3.4: GET: http://1.2.3.4:52199/MCWS/v1/Playback/LoadDSPPreset?Token=mytoken&Zone=Player&ZoneType=Name&Name=%3C%3Fxml+version%3D%271.0%27+encoding%3D%27UTF-8%27%3F%3E%0D%0A%3CDSP+Version%3D%221%22%3E%0D%0A%3CPreset%3E%0D%0A%3CKey+Name%3D%22DSP+Studio%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order+Version%3C%2FName%3E%0D%0A%3CValue%3E5%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order%3C%2FName%3E%0D%0A%3CValue%3E%281%3A1%29%282%3A12%29%2813%3AOutput+Format%29%2815%3AVolume+Leveling%29%2815%3AAdaptive+Volume%29%289%3AEqualizer%29%2820%3AParametric+Equalizer%29%287%3AEffects%29%2810%3AHeadphones%29%2813%3ATempo+%26amp%3B+Pitch%29%2815%3ARoom+Correction%29%2811%3AConvolution%29%2822%3AParametric+Equalizer+2%29%288%3AAnalyzer%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EDSP+Studio+Last+Selection%3C%2FName%3E%0D%0A%3CValue%3EAnalyzer%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Room+Correction%22+%2F%3E%0D%0A%3CKey+Name%3D%22Analyzer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMinimum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E40%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMaximum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E18000%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%3CName%3EFilters%3C%2FName%3E%3CValue%3E%281%3A1%29%281%3A1%29%28241%3A%26lt%3BXMLPH+version%3D%221.1%22%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Enabled%22%26gt%3B1%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Slope%22%26gt%3B12%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Q%22%26gt%3B1.2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Type%22%26gt%3B3%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Gain%22%26gt%3B4%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Frequency%22%26gt%3B40%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Channels%22%26gt%3B2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3B%2FXMLPH%26gt%3B%29%3C%2FValue%3E%3C%2FData%3E%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer+2%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Tempo+%26amp%3B+Pitch%22+%2F%3E%0D%0A%3CKey+Name%3D%22Volume+Leveling%22+%2F%3E%0D%0A%3CKey+Name%3D%22Equalizer%22+%2F%3E%0D%0A%3CKey+Name%3D%22Effects%22+%2F%3E%0D%0A%3CKey+Name%3D%22Convolution%22+%2F%3E%0D%0A%3CKey+Name%3D%22Audio+Settings%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Impact+Filter%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Encoding%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Pseudo+Surround+Detection%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channels%3C%2FName%3E%0D%0A%3CValue%3E2%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Sample+Rate+Settings%3C%2FName%3E%0D%0A%3CValue%3E%281%3A3%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Phantom+Center%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channel+Layout%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Two+Point+One+Mixing%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Cutoff+Downmix%3C%2FName%3E%0D%0A%3CValue%3E120%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3ECenter+Level%3C%2FName%3E%0D%0A%3CValue%3E0
........................
50592667: 18856: Sharing Plugins: JRWebService::Process: Start
50592667: 18856: Sharing Plugins: JRWebService::Process: URL: /MCWS/v1/Playback/LoadDSPPreset?Token=mytoken&Zone=Player&ZoneType=Name&Name=%3C%3Fxml+version%3D%271.0%27+encoding%3D%27UTF-8%27%3F%3E%0D%0A%3CDSP+Version%3D%221%22%3E%0D%0A%3CPreset%3E%0D%0A%3CKey+Name%3D%22DSP+Studio%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order+Version%3C%2FName%3E%0D%0A%3CValue%3E5%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EPlugin+Order%3C%2FName%3E%0D%0A%3CValue%3E%281%3A1%29%282%3A12%29%2813%3AOutput+Format%29%2815%3AVolume+Leveling%29%2815%3AAdaptive+Volume%29%289%3AEqualizer%29%2820%3AParametric+Equalizer%29%287%3AEffects%29%2810%3AHeadphones%29%2813%3ATempo+%26amp%3B+Pitch%29%2815%3ARoom+Correction%29%2811%3AConvolution%29%2822%3AParametric+Equalizer+2%29%288%3AAnalyzer%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EDSP+Studio+Last+Selection%3C%2FName%3E%0D%0A%3CValue%3EAnalyzer%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Room+Correction%22+%2F%3E%0D%0A%3CKey+Name%3D%22Analyzer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMinimum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E40%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EMaximum+Frequency%3C%2FName%3E%0D%0A%3CValue%3E18000%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%3CName%3EFilters%3C%2FName%3E%3CValue%3E%281%3A1%29%281%3A1%29%28241%3A%26lt%3BXMLPH+version%3D%221.1%22%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Enabled%22%26gt%3B1%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Slope%22%26gt%3B12%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Q%22%26gt%3B1.2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Type%22%26gt%3B3%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Gain%22%26gt%3B4%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Frequency%22%26gt%3B40%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3BItem+Name%3D%22Channels%22%26gt%3B2%26lt%3B%2FItem%26gt%3B%0D%0A%26lt%3B%2FXMLPH%26gt%3B%29%3C%2FValue%3E%3C%2FData%3E%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Parametric+Equalizer+2%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EEnabled%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3C%2FKey%3E%0D%0A%3CKey+Name%3D%22Tempo+%26amp%3B+Pitch%22+%2F%3E%0D%0A%3CKey+Name%3D%22Volume+Leveling%22+%2F%3E%0D%0A%3CKey+Name%3D%22Equalizer%22+%2F%3E%0D%0A%3CKey+Name%3D%22Effects%22+%2F%3E%0D%0A%3CKey+Name%3D%22Convolution%22+%2F%3E%0D%0A%3CKey+Name%3D%22Audio+Settings%22%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Impact+Filter%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Encoding%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Pseudo+Surround+Detection%3C%2FName%3E%0D%0A%3CValue%3E1%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channels%3C%2FName%3E%0D%0A%3CValue%3E2%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Sample+Rate+Settings%3C%2FName%3E%0D%0A%3CValue%3E%281%3A3%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%281%3A0%29%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Phantom+Center%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Channel+Layout%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Two+Point+One+Mixing%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3EOutput+Surround+Subwoofer+Cutoff+Downmix%3C%2FName%3E%0D%0A%3CValue%3E120%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CName%3ECenter+Level%3C%2FName%3E%0D%0A%3CValue%3E0%3C%2FValue%3E%0D%0A%3C%2FData%3E%0D%0A%3CData%3E%0D%0A%3CNa
........................
50592692: 18856: Sharing Plugins: JRWebService::Process: Finish (25 ms)
50592693: 18856: Sharing Plugins: VHTTPMessage::Write: Wrote 83 bytes
50592700: 18856: Sharing Plugins: CHTTPRequestMessage::ReadPreamble: Failed to read Method
50592700: 18856: Sharing Plugins: CHTTPListenerWorker::HandleConnection: Finish (35 ms)

note that the logged URL is truncated but is followed by ..... so I guess this might be done deliberately to avoid dumping potentially massive values out

Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Hendrik on May 08, 2021, 07:49:43 am
You should actually be able to send a POST request, in multipart/form-data format, this should reduce the problems of encoding, I would think.
Maybe "Save" should also send you a file download instead of wrapping it into an additional layer of XML?
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 08, 2021, 08:01:06 am
You should actually be able to send a POST request, in multipart/form-data format, this should reduce the problems of encoding, I would think.
Maybe "Save" should also send you a file download instead of wrapping it into an additional layer of XML?
good call, I didn't think of that. Now it works, thanks :)

so it was an encoding problem, would be interesting to know what the difference is between your encoding and mine. I'm just using some python stdlib (https://docs.python.org/3/library/urllib.parse.html#url-quoting) so there must be some difference between this and how you encode/decode (which seems like useful info to know).

for reference, if using python with the requests lib (https://docs.python-requests.org/en/master/), working code is

Code: [Select]
        r = requests.post(f"{self.__base_url}/Playback/LoadDSPPreset",
                          params={'Token': self.__token, 'Zone': zone_name, 'ZoneType': 'Name'},
                          files={'Name': (None, dsp)})

dsp is some string containing a correctly formatted config file
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 08, 2021, 08:02:55 am
Maybe "Save" should also send you a file download instead of wrapping it into an additional layer of XML?
I'm fine with it as is but a straight file download would be a useful option I think
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 08, 2021, 08:08:43 am
I'm working on making the save just return a DSP file.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 08, 2021, 08:22:03 am
We could make loading the preset take a filename if you prefixed it with file: or something?  That way you wouldn't have to worry about escapement.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Hendrik on May 08, 2021, 08:24:17 am
Sending it as a POST request is pretty reliable, you can even do it with curl, eg.

curl -u user:password -F "Name=<Preset.dsp" http://..../Playback/LoadDSPPreset

Don't think anything else is really needed
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 14, 2021, 02:25:48 am
a suggestion for SaveDSPPreset, add the Content-Disposition header to provide a sensible suggested filename  (e.g. zonename.dsp)

is there a way to get at the equivalent configuration for a DLNA server? if not, can this be added?
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 14, 2021, 10:14:53 am
a suggestion for SaveDSPPreset, add the Content-Disposition header to provide a sensible suggested filename  (e.g. zonename.dsp)

Good suggestion.  Next build:
Changed: When serving a DSP preset, the filename in the browser will be the zone name.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 21, 2021, 04:38:48 pm
I notice that LoadDSPPreset/SaveDSPPreset appears to be work even if the zone has ZoneDLNA=1 (via MCWS/v1/Zones) whereas DSP Studio says "only available for local zones"

by "appears to work", I mean

* call LoadDSPPreset with some valid config txt
* call SaveDSPPreset
* compare what I sent with what MC returns

they're identical

I don't know if this is just silently ignored config or might be harmful/corrupting in some way but I would think you should return a 400 when such a request is received for a DLNA zone.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 21, 2021, 04:46:36 pm
DLNA supports DSP now.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 21, 2021, 05:08:44 pm
I don't follow

the zone in question is associated with the one and only DLNA server on this MC instance, if I go to the dlna server dsp studio there are no DSP settings configured.

so where did the config I sent go? it didn't apply to the DLNA server (which wouldn't make sense anyway as then you're potentially updating the config for n zones via just 1 of them) and that's the only place to configure this (that I know of)
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 21, 2021, 05:50:28 pm
I'll play around next week and follow up after I do some debugging.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: Matt on May 24, 2021, 10:10:32 am
I see the problem.  It gets the DLNA zone ID, but it really needs the DLNA server's zone ID.

Switching to that isn't straight forward though because it's a zone that is never actually created.

We'll keep brain storming.
Title: Re: Any chance to get an MCWS call to get/load a dsp config?
Post by: mattkhan on May 29, 2021, 02:27:48 pm
one thing I've noticed is that the lack of error handling can leave you in some quite confusing situations

i.e.  the following sequence is problematic

generate some dsp config that is invalid in some (any) way
send it via LoadDSP
call SaveDSP and compare the results
results are identical therefore all looks good

open DSP studio
no config appears to be loaded

Put another way, there is a fundamental disconnect between the actual DSP config and the content served by MCWS.

I think this feature is extremely valuable so I certainly don't advocate disabling it in the absence of validation however it has to come with a health warning given this lack of validation and concomitant potential for bad noises to come out of your speakers.

It would be extremely useful if the loaded config were validated before applying it to the zone so that only valid config is applied. Applying it and returning some error code if invalid would be sufficient though (as I can easily reapply the old config myself) or even a separate "ValidateDSP" call would do.

The recovery from this situation may not be so obvious either, i.e. add any filter via the UI (and then remove it).