Topic: JSON-RPC api

Anyone manage to connect to the API

Running on Windows 11

C:\Program Files\Modartt\Pianoteq 7>"Pianoteq 7.exe" --serve localhost:8081

C:\Program Files\Modartt\Pianoteq 7>Listening for JSON-RPC on http://localhost:8081/jsonrpc

But can't connect.

Also @Modartt do you have specs for the API, don't see it in the manual?

Re: JSON-RPC api

Maybe localhost was not a great suggestion. You can try with "--serve 8081" or "--serve 127.0.0.1:8081" , you should be able to open http://127.0.0.1:8081 in your browser.

Then you will find the API reference and a python example in that page.

Re: JSON-RPC api

julien wrote:

Maybe localhost was not a great suggestion. You can try with "--serve 8081" or "--serve 127.0.0.1:8081" , you should be able to open http://127.0.0.1:8081 in your browser.

Then you will find the API reference and a python example in that page.

thanks, 127.0.0.1 worked

Re: JSON-RPC api

Does this work in macOS? I can open Pianoteq from the macOS command-line, but it does not recognize any arguments (--serve --fullscreen etc.).

open -a /Applications/Pianoteq\ 7\ STAGE/Pianoteq\ 7\ STAGE.app

Re: JSON-RPC api

Groove On wrote:

Does this work in macOS? I can open Pianoteq from the macOS command-line, but it does not recognize any arguments (--serve --fullscreen etc.).

open -a /Applications/Pianoteq\ 7\ STAGE/Pianoteq\ 7\ STAGE.app

I start it on macOS like this:

/Applications/Pianoteq\ 7/Pianoteq\ 7.app/Contents/MacOS/Pianoteq\ 7 --serve 8081

Not the stage version in this case, but the point is to take the path into the app package contents to the app itself. (If making the "obvious" edit to my command line doesn't work for you then you can look inside the package to see where things are at by "right clicking" the app in finder and choosing "Show Package Contents")

(Edit: Note there's no "open - a" here, you just type the path.)

Last edited by xooorx (23-12-2021 21:20)

Re: JSON-RPC api

The JSON-RPC API is great!

However, the embedded MIDI sequencer still does not seem to work in the headless mode.

So the commands midiRecord, midiPlay, midiStop,... work only in GUI mode.

Re: JSON-RPC api

Hi,

First, thanks Modartt for that surprised feature in 7.5.  This is a great addition in my opinion.  I have started using the JsonRPC api and so far it works great.  Here are a few suggestions that I find could help make the API better.

Suggestions:
1- When an API changes the state of Pianoteq than that API should return that new state.  For instance,
  abSwitch() should return the state that it is now. i.e. either A or B
2- When providing a wrong command name, the Pianoteq instance crashes instead of returning an error
3- Metronome API - I could not find anything about the metronome
4- getInfo() API - When the loaded preset is a custom one, the name of the preset includes the bank info in it.  Pls, consider adding the attribute bank like it is for the getListOfPresets() API
  * Ex: "name": "My Presets/NY Steinway Model D (RC)" - The "My Presets" Is the bank attribute mixed with the name attribute.  This makes it not consistent across your API and introduce confusion.


Issue that I am facing at the moment
1- (FIXED - No longer an issue) Found my issue with loading custom presets.  I forgot to include the bank name in the request.  Now fixed


Thanks again for this API!

Cheers

Last edited by sordess (05-01-2022 19:55)
Sordess
Author of PTQ Client Webapp: (https://github.com/robert-rc2i/ptq-client-webapp)
Kawai CA79

Re: JSON-RPC api

drahoslove wrote:

The JSON-RPC API is great!

However, the embedded MIDI sequencer still does not seem to work in the headless mode.

So the commands midiRecord, midiPlay, midiStop,... work only in GUI mode.

FYI, Julien has confirmed that this will be addressed in the next version.

Re: JSON-RPC api

Irmin wrote:

Anyone manage to connect to the API

Running on Windows 11

C:\Program Files\Modartt\Pianoteq 7>"Pianoteq 7.exe" --serve localhost:8081

C:\Program Files\Modartt\Pianoteq 7>Listening for JSON-RPC on http://localhost:8081/jsonrpc

But can't connect.

Also @Modartt do you have specs for the API, don't see it in the manual?

There's a typo in the command given. It should be this:

"C:\Program Files\Modartt\Pianoteq 7\Pianoteq 7.exe" --serve localhost:8081

This took me a few minutes to see, but then it clicked.

When I tried it, PTC7 popped right up on Windows 10. If you created the typo when you typed it here, then your issue is Windows 11 being snotty with permissions not allowing a remote host to connect via the loopback.

Last edited by jcitron (11-01-2022 08:15)

Re: JSON-RPC api

I got this to work nicely, but is it possible to run this remotely on the remote client without asking for activation?

I had to map a network drive "Z:" and then put in the path. This launched the application on my remote host, a tablet, but request activation which I did not want to do.

Re: JSON-RPC api

jcitron wrote:

I got this to work nicely, but is it possible to run this remotely on the remote client without asking for activation?

I had to map a network drive "Z:" and then put in the path. This launched the application on my remote host, a tablet, but request activation which I did not want to do.

You will need to active it if you want to run it from that computer.  The licence is per device that you run it from not where it is stored.  Otherwise, we would be able to exceed the limit of 3 devices.

Sordess
Author of PTQ Client Webapp: (https://github.com/robert-rc2i/ptq-client-webapp)
Kawai CA79

Re: JSON-RPC api

navindra wrote:
drahoslove wrote:

The JSON-RPC API is great!

However, the embedded MIDI sequencer still does not seem to work in the headless mode.

So the commands midiRecord, midiPlay, midiStop,... work only in GUI mode.

FYI, Julien has confirmed that this will be addressed in the next version.

It works now! Both via JSON-RPC and MIDI control. Thanks, Julien!

Re: JSON-RPC api

The RPCs are a great feature.  However, they are very slow, like 1-2 second delay.  Maybe they could be sped up using select().