REW Beta Release REW API beta releases

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
This thread is for beta releases of the REW API. Here are the download links (updated 24th October 2024):

Windows 64-bit
Windows 32-bit
MacOS
Linux AMD 64
Linux no JRE

The API is REST(ish) with webhooks. Here is the online help. The API documentation is served by swagger-ui and can be accessed by browsing to localhost:4735 after starting the API server, either from the Preferences API tab or by launching REW with the -api argument. The OpenAPI specification for the API can be accessed at localhost:4735/doc.json or localhost:4735/doc.yaml for JSON or YAML formats. The swagger UI has links to the relevant help section.

The API is a work in progress, the help and the OpenAPI specification list the endpoints that have been implemented so far but there are others yet to do.
 
Last edited:

sm52

Member
Joined
Mar 14, 2019
Posts
1,004
What should those who do not plan to use the API install this version and use as before, or not install this version?
 

JoinUs

New Member
Joined
Jan 6, 2023
Posts
85
Can regular users use this version to share the same experience or feedback as using regular beta versions? Or is this just for programming?
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
Can regular users use this version
Sure, the API is just another feature that will be included in releases from 5.40 onwards. This initial beta doesn't have anything else that isn't in 5.30.2, however.
 

serko70

Member
Joined
Oct 13, 2017
Posts
286
Location
Germany
More  
Preamp, Processor or Receiver
Marantz SR6015
Main Amp
Rotel Michi X3
DAC
Oppo 205
Computer Audio
Intel NUC
Universal / Blu-ray / CD Player
Oppo 205
Streaming Subscriptions
TIDAL, ROON
Front Speakers
Focal Kanta 2
Center Channel Speaker
Linn Trikan
Surround Speakers
Focal Dome Flax
Surround Back Speakers
Focal Dome Flax
Front Height Speakers
Focal Dome Flax
Rear Height Speakers
Focal Dome Flax
Subwoofers
Focal Sub Air
Video Display Device
LG 65 3D OLED
Great new addition John, thank you very much!

So far, I could only properly manage to get version info with an HTML script but I will eventually get there :)

Will there be trace arithmetic APIs in the future?
 

serko70

Member
Joined
Oct 13, 2017
Posts
286
Location
Germany
More  
Preamp, Processor or Receiver
Marantz SR6015
Main Amp
Rotel Michi X3
DAC
Oppo 205
Computer Audio
Intel NUC
Universal / Blu-ray / CD Player
Oppo 205
Streaming Subscriptions
TIDAL, ROON
Front Speakers
Focal Kanta 2
Center Channel Speaker
Linn Trikan
Surround Speakers
Focal Dome Flax
Surround Back Speakers
Focal Dome Flax
Front Height Speakers
Focal Dome Flax
Rear Height Speakers
Focal Dome Flax
Subwoofers
Focal Sub Air
Video Display Device
LG 65 3D OLED
These imported measurements both have 16,384 samples and REW shows that correctly in measurement notes&Info. IR Windows will show 16,383 samples however regardless of the import settings in Analysis tab. When I click the "up arrow" in IR Windows Right width, span in samples would increase to 16,384 although right window width doesn't seem to change. But when I select the other measurement and come back to this one, the span in samples would go back to 16,383 again. A very minor problem but could be some sort of rounding bug hence the share.
 

Attachments

  • Span in Samples.mdat
    501.2 KB · Views: 84
Last edited:

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
A very minor problem but could be some sort of rounding bug hence the share.
Not a bug as such. The window reference time may not be on a sample index and the pre and post durations will typically not be whole numbers of samples, so it can be tricky to maintain an overall number of samples.
 

serko70

Member
Joined
Oct 13, 2017
Posts
286
Location
Germany
More  
Preamp, Processor or Receiver
Marantz SR6015
Main Amp
Rotel Michi X3
DAC
Oppo 205
Computer Audio
Intel NUC
Universal / Blu-ray / CD Player
Oppo 205
Streaming Subscriptions
TIDAL, ROON
Front Speakers
Focal Kanta 2
Center Channel Speaker
Linn Trikan
Surround Speakers
Focal Dome Flax
Surround Back Speakers
Focal Dome Flax
Front Height Speakers
Focal Dome Flax
Rear Height Speakers
Focal Dome Flax
Subwoofers
Focal Sub Air
Video Display Device
LG 65 3D OLED
Not a bug as such. The window reference time may not be on a sample index and the pre and post durations will typically not be whole numbers of samples, so it can be tricky to maintain an overall number of samples.
Understood, thanks.
 

sm52

Member
Joined
Mar 14, 2019
Posts
1,004
If you specify the number of repetitions when measuring impedance, measure the impedance, and then switch to measuring SPL, then SPL will measure the same number of repetitions. Previously there was a similar behavior (it has been fixed), but in reverse. Also, if you specify a delay before the SPL measurement, goes to the impedance measurement, the delay will remain active for the impedance measurement.
To measure the impedance, I spent an hour fiddling around connecting, unplugging the sound card, rebooting the computer, and taking calibration measurements to get through the 2nd calibration step. REW wrote that the entry level should be much lower at this step. There were such figures -15 dB, -25 dB. Then it became -5 dB and -15 dB on its own, and REW skipped me to the third step. But the difference is the same. Then something else changed and it became -6 -28. Then -6 -44. And so it remained. I was able to make impedance measurements. I did it for more than an hour, everything was fine. This happened to me many times, but I could not understand the reason. The equipment was not changed, no programs were launched. All input devices except inputs 1/2 of the external sound card are disabled. All output devices except outputs 1/2 are disabled. It is not clear who cannot agree with whom immediately, but only after an hour.
 

Attachments

  • short circuit measurement 1.JPG
    short circuit measurement 1.JPG
    66.9 KB · Views: 107
  • short circuit measurement 2.JPG
    short circuit measurement 2.JPG
    115.3 KB · Views: 119
  • short circuit measurement 3.JPG
    short circuit measurement 3.JPG
    112.8 KB · Views: 94
  • short circuit measurement 4.JPG
    short circuit measurement 4.JPG
    33.2 KB · Views: 97

serko70

Member
Joined
Oct 13, 2017
Posts
286
Location
Germany
More  
Preamp, Processor or Receiver
Marantz SR6015
Main Amp
Rotel Michi X3
DAC
Oppo 205
Computer Audio
Intel NUC
Universal / Blu-ray / CD Player
Oppo 205
Streaming Subscriptions
TIDAL, ROON
Front Speakers
Focal Kanta 2
Center Channel Speaker
Linn Trikan
Surround Speakers
Focal Dome Flax
Surround Back Speakers
Focal Dome Flax
Front Height Speakers
Focal Dome Flax
Rear Height Speakers
Focal Dome Flax
Subwoofers
Focal Sub Air
Video Display Device
LG 65 3D OLED
Do I need parameters for cross corr align?

{
"processName": "Cross corr align",
"measurementIndices": [1,2],
"parameters": "",
"resultUrl": ""
}


Error: Bad Request

Exception trying to parse request: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 4 column 18 path $.parameters
 

serko70

Member
Joined
Oct 13, 2017
Posts
286
Location
Germany
More  
Preamp, Processor or Receiver
Marantz SR6015
Main Amp
Rotel Michi X3
DAC
Oppo 205
Computer Audio
Intel NUC
Universal / Blu-ray / CD Player
Oppo 205
Streaming Subscriptions
TIDAL, ROON
Front Speakers
Focal Kanta 2
Center Channel Speaker
Linn Trikan
Surround Speakers
Focal Dome Flax
Surround Back Speakers
Focal Dome Flax
Front Height Speakers
Focal Dome Flax
Rear Height Speakers
Focal Dome Flax
Subwoofers
Focal Sub Air
Video Display Device
LG 65 3D OLED
IIUC the docs they should be a JSON object (hence the "Expected BEGIN_OBJECT" error). Maybe an empty object would do ({})?
Thanks, that worked and I received "feature not implemented yet!" message ;)
 

phofman

Member
Joined
Jun 26, 2019
Posts
180
That's a response we will likely see often for long, REW is huge and covering+documenting most features is the major effort. Just the decision to provide an API (even headless!) for a GUI-based SW is admirable. Also, I am afraid it's maybe the most boring work on John's todo list :-)
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
Thanks, that worked and I received "feature not implemented yet!" message ;)
I implemented Cross corr align, Time align and IR start align yesterday, along with an Arithmetic command for trace arithmetic so those will be in the next build.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
If you specify the number of repetitions when measuring impedance, measure the impedance, and then switch to measuring SPL, then SPL will measure the same number of repetitions.
if you specify a delay before the SPL measurement, goes to the impedance measurement, the delay will remain active for the impedance measurement.
SPL and Impedance measurements do not have independent sets of measurement configuration. In either mode the number of repetitions will be the number shown, the delay will be the time shown.


I spent an hour fiddling around connecting, unplugging the sound card, rebooting the computer, and taking calibration measurements to get through the 2nd calibration step. REW wrote that the entry level should be much lower at this step. There were such figures -15 dB, -25 dB. Then it became -5 dB and -15 dB on its own, and REW skipped me to the third step. But the difference is the same. Then something else changed and it became -6 -28. Then -6 -44. And so it remained.
I don't know why those figures should be varying, but with the leads shorted the measurement input should be very low since it is connected to a short circuit. If it isn't then something is wrong.
 

sm52

Member
Joined
Mar 14, 2019
Posts
1,004
SPL and Impedance measurements do not have independent sets of measurement configuration. In either mode the number of repetitions will be the number shown, the delay will be the time shown.
Thank you. I'll know.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
Do I need parameters for cross corr align?

{
"processName": "Cross corr align",
"measurementIndices": [1,2],
"parameters": "",
"resultUrl": ""
}


Error: Bad Request

Exception trying to parse request: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 4 column 18 path $.parameters
You can just omit the parameters and resultUrl entries completely if you are not using them, the API is fairly tolerant. The swaggerUI at localhost:4735 will also show you suitable formatting using the "Try it out" buttons.

{
"processName": "Cross corr align",
"measurementIndices": [1,2]
}
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
Builds updated today (beta 3) with these changes:
  • Added: API processMeasurements commands now include an Arithmetic command to perform trace arithmetic
  • Added: API processMeasurements Cross corr align command has been implemented
  • Added: API processMeasurements Time align command has been implemented
  • Added: API processMeasurements Align IR start command has been implemented
  • Added: spl-meter endpoint
  • Added: The Application error log will have an error message if a subscription is removed due to a timeout or error

Note that the first index in the list for cross correlation alignment is used as the reference, it can be any measurement index.
 

chrisf26

Registered
Joined
Jan 18, 2024
Posts
6
Hello,
I am wondering if the API has features to export measurement data (eg: to a .txt file)
Further, are the API features implemented to start and stop the RTA, set the number of averages, and save the current RTA to a new measurement?
if so, what are the endpoints needed to execute this?
I am quite new to working with an API so apologies if this doesn't make sense.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
Start the API server from the API preferences and open a browser tab at localhost:4735. Everything is listed, with links to the relevant help section and you can try everything from that page with the "Try it out" buttons.
 

Elko

Registered
Joined
Nov 6, 2022
Posts
5
Not sure if this is the place to add bug reports; If not, please let me know.

Issue:​

The swagger spec definition has a mix of OpenAPI versions syntax:
Code:
"/application/commands": {"get": {"tags": [],"description": "Get the list of commands ","parameters": [],"responses": {"200": {"description": "successful operation","schema": {"type": "array","items": {"type": "string"}},"responseSchema": {"type": "array","items": {"type": "string"}}}}}

The document is defined as "swagger": "2.0" therefor the responseSchema property nested on the paths is invalid.
responseSchema is openapi 3.0 syntax instead of swagger 2.0.
Only the schema property is allowed.

Symptoms:​

Swagger CLI:
For Every Path poperty:
- "paths./measurements/frequency-response/units.get.responses.200" must validate one and only one schema (oneOf). Found none valid

(not a real) Fix:​

For local purposes, a quick and dirty property deletion on the specification will fix above error and allows for generation
Code:
//nodeJS example:
 for (const path in data.paths) {
        for (const method in data.paths[path]) {
            delete data.paths[path][method]["responses"]["200"]["responseSchema"]
        }
    }
 
Last edited:

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
7,992
The document is defined as "swagger": "2.0" therefor the responseSchema property nested on the paths is invalid.
responseSchema is openapi 3.0 syntax instead of swagger 2.0.
Only the schema property is allowed.
The file is generated using SparkSwagger, which looking at the source deprecated setSchema in favour of setResponseSchema. Should the file declare itself as openapi 3.0 instead of swagger 2.0, then? SwaggerUI seems happy with it as is, and I haven't had that reported as an issue from other users of the API.
 
Top Bottom