Skip to content

About

SyxLibEd.Next: a Windows SysEx test tool and example client of the SysexDB.com public API

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

SyxLibEd.Next

A small Windows tool for testing MIDI System Exclusive (SysEx) messages, and the test client of the SysexDB public API.

It talks to SysexDB only through the public HTTP API (/api/v1 and the OAuth endpoints under /connect), exactly like any external app would. It is a modern port of the old VB6 program SyxLibEd: it keeps the two-pane idea (message to send / message received, with "Copy received to outgoing") and leaves out the librarian and its local database.

The main window: catalog search, MIDI commands, outgoing and received panes

It is meant as a worked example of an integration: the code that talks to the API is in src\SyxLibEd.Next\Api and src\SyxLibEd.Next\Authentication and does not depend on the user interface. Copy what you need (see License).

What it does

  • Sign in / sign out with the OAuth 2.0 device flow (RFC 8628): the app shows a short code and opens the browser on the SysexDB activation page; you approve there. The app never sees your password. The refresh token is kept between runs, encrypted with Windows DPAPI for the current Windows user, in %APPDATA%\SyxLibEd.Next\ (one file per site address). Sign out revokes it on the site and deletes the file.
  • Catalog: search devices, list the public SysEx files of a device, list your own files ("My SysEx", including private ones).
  • Download the selected SysEx file into the outgoing pane (needs sign-in, as on the website). Double-clicking a file in the list does the same. You can also open and save .syx files.
  • MIDI: choose the output and input ports; send the outgoing pane (a file with several F0 ... F7 messages is sent one message at a time, with a configurable delay between them, because many instruments drop data otherwise); listen on the input port and collect the SysEx that arrives in the received pane.
  • Identity Request: sends F0 7E 7F 06 01 F7 to the output port; with "Listen" on, the Identity Reply appears in the received pane and its analysis shows manufacturer, family, member and version.
  • Analysis under each pane: number of messages and their length, Manufacturer ID (one byte, or three when the first is 00), incomplete messages, bytes outside F0 ... F7, and the Roland checksum (11/12 commands, the same rule the website uses).

The outgoing pane is editable: type hexadecimal byte pairs separated by spaces or line breaks (F0 43 10 ... F7). The message must start with F0 and end with F7 to be sent.

The app works with no MIDI ports at all (the combo boxes then say "No MIDI output ports" / "No MIDI input ports"): the API part is still fully usable.

Requirements and build

  • Windows, .NET 10 SDK (the folder has a global.json that selects SDK 10.0.202 or a later patch).
  • NuGet package NAudio.Midi 2.2.1 for MIDI. DPAPI (System.Security.Cryptography.ProtectedData) comes with the Windows Desktop runtime, so no extra package is needed.
dotnet build SyxLibEd.Next.sln
dotnet test SyxLibEd.Next.sln
dotnet run --project src\SyxLibEd.Next

The executable is src\SyxLibEd.Next\bin\<Configuration>\net10.0-windows\SyxLibEd.Next.exe. It needs the .NET 10 Desktop Runtime on the PC where it runs. To get a single executable that carries .NET with it (about 50 MB, nothing to install):

dotnet publish src\SyxLibEd.Next -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=none

The result is in src\SyxLibEd.Next\bin\Release\net10.0-windows\win-x64\publish: copy SyxLibEd.Next.exe together with appsettings.json.

Windows 11 and Smart App Control

The program is not code-signed. On a Windows 11 PC where Smart App Control is on, Windows refuses to start it, and there is no "run anyway" button: this also happens when you build it yourself. To use it there, turn Smart App Control off (Windows Security → App & browser control → Smart App Control settings); read what that screen says first, because Windows may not let you turn it back on. Where Smart App Control is off, Windows may only show the usual SmartScreen warning for unsigned programs.

Configuration

Settings are read from appsettings.json next to the executable (the build copies it there from src\SyxLibEd.Next\appsettings.json):

{
  "SiteAddress": "https://www.sysexdb.com",
  "ClientId": "syxlibed-next",
  "DelayBetweenMessagesInMilliseconds": 50
}
  • SiteAddress: the SysexDB site the app talks to.
  • ClientId: the client_id the SysexDB staff registered for this app. It is sent in the SysexDB-Client-Id header on calls without a user and used for the OAuth device flow. There is no client secret: this is a public client. syxlibed-next belongs to this program: an app of your own needs its own client_id; how to ask for one is explained in Getting a client_id.
  • DelayBetweenMessagesInMilliseconds: the starting value of the delay between messages when sending; it can be changed in the window.

Using another site

If you run your own copy of the SysexDB site (for example a development site at http://localhost:5175), point the app to it by editing the appsettings.json next to the executable (or the one in src\SyxLibEd.Next and rebuild):

{
  "SiteAddress": "http://localhost:5175",
  "ClientId": "syxlibed-next"
}

The ClientId must be registered on that site (Staff → Apps). Sign-ins are stored per site address, so switching between the development and the production site does not mix tokens.

Code layout

Folder Content
src\SyxLibEd.Next\Sysex Pure SysEx logic: hex formatting and parsing, splitting a byte stream into messages, Manufacturer ID, Identity Request/Reply, Roland checksum, analysis
src\SyxLibEd.Next\Midi NAudio wrappers: port lists, sending, receiving
src\SyxLibEd.Next\Api SysexDbApiClient and the API response types
src\SyxLibEd.Next\Authentication OAuth device flow, token refresh and revocation, DPAPI token store
src\SyxLibEd.Next\Ui The main window and its panels; they only call the classes above
src\SyxLibEd.Next\Ui\Theme The SysexDB look: colors, fonts and spacing, the same values as the CSS variables of the website
src\SyxLibEd.Next\Ui\Controls Controls drawn with that look: buttons, lists, combo box, LED, panels, logo
src\SyxLibEd.Next\Assets The program icon (the SysexDB logo); regenerate it with python tools\icon\generate_app_icon.py (needs Pillow)
tests\SyxLibEd.Next.Tests xUnit tests for the SysEx logic, the API client and the device flow (with a fake site)

Coding rules: readability first. Full descriptive names, short methods with early returns, one type per file, no abstractions "for the future", and comments that explain why, not what.

API reference

The public specification of the API (OpenAPI) is on GitHub: gasand/sysexdb-api-spec.

License

MIT. The MIDI code uses NAudio, also under the MIT license.

About

SyxLibEd.Next: a Windows SysEx test tool and example client of the SysexDB.com public API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages