REW Beta Release REW API beta releases

Elko

Registered
Joined
Nov 6, 2022
Posts
5
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.
I don't think an openapi 3.0.0 version declaration will cut this. The spec has properties as host, basePath, schemes, definitions which are swagger 2.0 definitions and are not accepted by openapi 3.0.0 standard.

I understand that SparkSwagger's main focus is with swagger-UI. Whereas swagger/openapi is more than just documentation. e.g.: swagger-codegen for generating clients (and servers).
This mixed syntax in the openAPI/Swagger document is not accepted by these tools.
 

Elko

Registered
Joined
Nov 6, 2022
Posts
5
I also found another issue;

The post methods are defined in the swagger document to return a 200 status code. However, the actual response is 202:
Code:
// YAML version swagger doc

post:
      tags:
      - "generator"
      description: "Send a command to the generator "
      parameters:
      - in: "body"
        name: "body"
        description: "Body object description"
        required: true
        schema:
          $ref: "#/definitions/Command"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/APIResponse"
          responseSchema:
            $ref: "#/definitions/APIResponse"

This results in a client side error, as the response deviates from the declaration.
runtime.APIError{OperationName:"[POST /generator/command] PostGeneratorCommand", Response:client.response{resp:(*http.Response)(0xc000126630)}, Code:202}

This one does work through in the Swagger-UI as undocumented.
1705672657637.png
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
The post methods are defined in the swagger document to return a 200 status code. However, the actual response is 202:
Where things will take time it seemed more appropriate to respond with 202, any opinions on that? SparkSwagger hardcodes the entries as 200, but I can easily update the code to add 202 entries where they can occur.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
Here's a doc.json (renamed as doc.txt to allow attachment) generated without responseSchema, SwaggerUI doesn't seem to care.
 

Attachments

  • doc.txt
    161.6 KB · Views: 27

chrisf26

Registered
Joined
Jan 18, 2024
Posts
6
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.
thanks for the guidance, I am now able to execute some commands.
I was having some issues with saving/exporting data to a file... first, it is possible to export the measurement as a .txt file? I got an error message saying the file needs to be in .mdat format.
Also, the measurements/{id}/command endpoint has a body structure of
{
"command": "String",
"parameters": {},
"resultUrl": "String"
}
I am not sure what is supposed to go in resultUrl.
thanks in advance for the help.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
first, it is possible to export the measurement as a .txt file?
No, I haven't implemented any export endpoints.

You can retrieve the frequency response from /measurements/{id}/frequency-response as Base64 strings. It is straightforward to turn those back into float arrays but that needs software, here's how that is done in Java, for example:

Code:
    public static float[] decodeArray(String base64Encoded) {
        return byteToFloatArray(Base64.getDecoder().decode(base64Encoded));
    }
  
    private static float[] byteToFloatArray(byte[] bytes) {
        FloatBuffer buf = ByteBuffer.wrap(bytes).asFloatBuffer();
        float[] floatArray = new float[buf.limit()];
        buf.get(floatArray);
        return floatArray;
    }
 

chrisf26

Registered
Joined
Jan 18, 2024
Posts
6
No, I haven't implemented any export endpoints.

You can retrieve the frequency response from /measurements/{id}/frequency-response as Base64 strings. It is straightforward to turn those back into float arrays but that needs software, here's how that is done in Java, for example:

Code:
    public static float[] decodeArray(String base64Encoded) {
        return byteToFloatArray(Base64.getDecoder().decode(base64Encoded));
    }
 
    private static float[] byteToFloatArray(byte[] bytes) {
        FloatBuffer buf = ByteBuffer.wrap(bytes).asFloatBuffer();
        float[] floatArray = new float[buf.limit()];
        buf.get(floatArray);
        return floatArray;
    }
thanks for providing this alternative.
do you plan to implement export endpoints into the API at some point?
 

Elko

Registered
Joined
Nov 6, 2022
Posts
5
Where things will take time it seemed more appropriate to respond with 202, any opinions on that? SparkSwagger hardcodes the entries as 200, but I can easily update the code to add 202 entries where they can occur.
Yes 202 is the appropriate and common response for POST requests.

It would be great if the doc matches the response. This will prevent errors from rising on the client side.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
thanks for providing this alternative.
do you plan to implement export endpoints into the API at some point?
Maybe, but APIs are for software to talk to software so there doesn't seem much point in writing the data to a file when it can be retrieved directly.
 

chrisf26

Registered
Joined
Jan 18, 2024
Posts
6
Maybe, but APIs are for software to talk to software so there doesn't seem much point in writing the data to a file when it can be retrieved directly.
that makes sense. Playing around with /measurements/{id}/frequency-response endpoint and postprocessing the u64 string is giving quite weird results (at least comparing to what I exported manually to txt).
for example, I am getting values such as [2.03131938353307e-11, -3.7898538721492514e-05, 2.0795245913062854e-32, 1.5884937277363544e+37, -359954699517952.0, -3.7704823625972494e-05,] when I am looking for SPL(dB) vs frequency values.

is there something I am doing wrong here?
 

Elko

Registered
Joined
Nov 6, 2022
Posts
5
thanks for the guidance, I am now able to execute some commands.
I was having some issues with saving/exporting data to a file... first, it is possible to export the measurement as a .txt file? I got an error message saying the file needs to be in .mdat format.
Also, the measurements/{id}/command endpoint has a body structure of
{
"command": "String",
"parameters": {},
"resultUrl": "String"
}
I am not sure what is supposed to go in resultUrl.
thanks in advance for the help.
The resultUrl is optional and can be set as address for the results to be posted to. If not needed, you can omit it in your request.
 

Navish360

Registered
Joined
Jan 11, 2024
Posts
4
I can't seem to find the link to the current BETA version of REW. I remember seeing a change note allowing height channels to be selected.
 

sm52

Member
Joined
Mar 14, 2019
Posts
1,009

John Mulcahy,​

There are two cases where the phase on the SPL plot is displayed incorrectly. When the REW window is minimized halfway and smoothing is set to anything other than zero. For example, 1/48. If there is no smoothing, the phase is correct. The second case is when the REW window is expanded to full size, and the frequency axis is compressed so that 1 hertz is visible on the left. Then, too, with any smoothing other than zero, the phase is displayed incorrectly. I have the lower displayed frequency set to 0.5Hz.
 

Attachments

  • Phase sm0.JPG
    Phase sm0.JPG
    152.3 KB · Views: 35
  • Phase sm1.48.JPG
    Phase sm1.48.JPG
    150.7 KB · Views: 34
  • Phase sm0 1Hz.JPG
    Phase sm0 1Hz.JPG
    270.9 KB · Views: 28
  • Phase sm1.48 1Hz.JPG
    Phase sm1.48 1Hz.JPG
    258 KB · Views: 35

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
I can't seem to find the link to the current BETA version of REW. I remember seeing a change note allowing height channels to be selected.
The latest beta release links are in the first post of this thread. You misunderstood the release comment, it is not possible for REW to select the height channels of an AVR.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
There are two cases where the phase on the SPL plot is displayed incorrectly.
Please use the Generate diagnostic file option in the Help menu and attach that file and the measurement you had loaded when you encountered the issue.
 

sm52

Member
Joined
Mar 14, 2019
Posts
1,009
Here they are.
 

Attachments

  • tw phase.mdat
    1.4 MB · Views: 34
  • REWdiagnostic_1705752400554.zip
    35 KB · Views: 28

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
Thanks, the problem was with handling of cal file phase values. I have fixed it for the next build.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
Builds updated today (beta 4) with these changes:
  • Added: API stepped-measurement endpoint
  • Changed: API HTTP 202 (Accepted) response codes indicated in API spec where used
  • Changed: Removed responseSchema entries from the API spec documents
  • Fixed: Reading the RTA configuration from the API did not return the max overlap setting
  • Fixed: Null pointer exception could occur when sorting the modal resonance table
  • Fixed: Applying a cal file could cause phase to be outside -180..180 degrees in some circumstances
 

sm52

Member
Joined
Mar 14, 2019
Posts
1,009
If you request an update, beta 4 is offered, but since it is already installed, the update is not automatically offered.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
Beta releases are not included in update checks at the moment. The update checks are for the 5.30.x revisions.
 

serko70

Member
Joined
Oct 13, 2017
Posts
294
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
Builds updated today (beta 4) with these changes:
  • Added: API stepped-measurement endpoint
  • Changed: API HTTP 202 (Accepted) response codes indicated in API spec where used
  • Changed: Removed responseSchema entries from the API spec documents
  • Fixed: Reading the RTA configuration from the API did not return the max overlap setting
  • Fixed: Null pointer exception could occur when sorting the modal resonance table
  • Fixed: Applying a cal file could cause phase to be outside -180..180 degrees in some circumstances
Not related to APIs but is it viable to include previous RAM allocation when "update existing installation" is selected during new REW updates? If a custom RAM allocation above 3GB is used, it needs to be updated manually in the options file each time.
 

John Mulcahy

REW Author
Thread Starter
Joined
Apr 3, 2017
Posts
8,052
As an alternative to editing the roomeqwizard.vmoptions file parameters can be passed to the runtime via the command line (e.g. by editing the Target of a shortcut). To do that they must be preceded by -J, so to force REW to start with 4 GB allocation (for example) regardless of the contents of the vmoptions file the shortcut target on Windows could be C:\Program Files\REW\roomeqwizard.exe -J-Xmx4096m
 
Top Bottom