Cantabile dot NET library

Hi @brad and all :smile:

It’s a long time I’m coding myself utilities in VB.Net interacting with Cantabile via Midi.
I recently, tried a few simple Network API interactions like asking Cantabile for States list or Song List.

So the idea came to have a .NET library somewhat mimicking the JavaScript API behaviour.

As you can guess from VB.net, I’m not a skilled programmer. My business is music.

In fact this is already a pretty advanced project and Claude helped a lot (Sorry @brad :downcast_face_with_sweat:) . Library is built with all documented functions available in Cantabile API, events etc…
Tests with a local Cantabile instance basically works

At the moment it’s an internal VB.net Nuget ready.library.

The idea after deep testing is to share a C# source version and a Nuget Package.

@brad tell me your thoughts about idea, sharing and naming.
.

1 Like

Here is a vb.net usage example:


Imports Cantabile

’ Create and connect a session
Dim session = New CantabileSession(“localhost”, 35007)
Await session.ConnectAsync()

’ Read current state
Console.WriteLine($“Song : {session.Song.Name}”)
Console.WriteLine($“Transport : {session.Transport.State} @ {session.Transport.Tempo} BPM”)

’ Event subscription
AddHandler session.Transport.StateChanged, Sub(s, e)
Console.WriteLine($“New State : {session.Transport.State}”)
End Sub

’ Control
Await session.Transport.PlayAsync()

’ Disconnection
Await session.DisconnectAsync()
Await session.DisposeAsync()


Available Endpoints

session.Transport
session.Song
session.SetList
session.SongStates
session.Application
session.Variables
session.Commands
session.Bindings
session.ShowNotes
session.KeyRanges
session.OnscreenKeyboard
session.Engine

1 Like

Very nice. Some thoughts:

  • While I had no plans for a .net library I’m not opposed to it.
  • It’s been a long time since I’ve done any VB so I’m not too familiar with its current state. That said while a C# port would be nice it’s probably not necessary as shouldn’t the lib work in c# as is anyway?
  • probably the biggest argument for port to c# is if you want to get help from others maintaining the library itself. C# seems to be the better known more standard .Net language.
  • do you know if the library works on other .net platforms (Linux, mobile etc)? If not that might be something worth addressing. Or, perhaps not, not sure

I’m curious… what are you building with this?

These days I tend to lean pretty heavily towards JavaScript because it runs pretty much everywhere with little dependencies and you can build pretty sophisticated UI in a browser - again same language, runs everywhere.

One more thing to be aware of. I can foresee some significant updates to the netapi coming soon. In fact I’ve just made some changes last night. Nothing that should break what’s already there but if you want to keep it complete there’s going to be ongoing work.

Anyway, thanks for this and look forward to seeing where it goes and who might use it for what.

Brad