Synthesizer V Pro Scripting API typing definitions (for TypeScript)

I have started porting the official scripting API documentation to TypeScript type declarations, hoping it can assist others with plugin development. https://github.com/iluminar-yi/svstudio-scripts-typing

I was wondering if it would be possible to add this initiative to the Dreamtonics GitHub repos? I think that way, the quality of documentation can also improve because now you can define interfaces. Or I can simply request to add it to DefinitelyTyped.

Also, while going through the documentation, I have found some errors that needs attention:

  1. NoteGroup#getParameter contains a typo (it appears as NoteGroup#getParamter)
  2. The argument to NoteGroup#getParameter capitalizes the first letter, which is different from "the table shown in Automation#getDefinition", which starts with lower case letters. Which one is correct?
  3. TrackMixer seems missing (referenced by SV#create)?
  4. SV#getPlayback refers to PlayBackControl but in the class documentation it’s called PlaybackControl (lowercase “b”)
  5. Some “x2y” methods do not have consistent capitalization (e.g. pitch2freq vs quarter2Blick). Is that a typo or the API is really so?
  6. Some methods, such as NoteGroup#getNote, takes in an index and return a non-null object. What would happen if the index is out of bound?

Besides the problems I see, I also have a question:

  1. The attributes object referenced by Note#setAttributes and Note#getAttributes has dur and alt properties. Why are they arrays of numbers? What do they mean?
「いいね!」 2

Another issue I saw:
SV#pitch2freq is actually SV#pitch2Freq (capital “F”). The method name is incorrectly documented in the API doc.

You can see these values in the Note Properties panel under Timing and Phonemes, Duration.

dur refers to the relative duration of the phoneme in the syllable, and is the value displayed on the slider.

alt is the alternative phoneme, and is displayed to the right of the slider. DFLT is the default (0), 1 is the first alternate (ALT1), and 2 is the second alternate (ALT2).

But there’s a big problem. SynthV uses null to indicate values are at their defaults. So (at least under Lua), the following doesn’t work:

  • The alt and dur tables are null, if the phonemes have not been manually changed by the users. So you can’t get the size of the table this way, either.

  • Indexing the alt and dur tables returns null for the value is the values have not been manually changed by the users.

  • The function getPhonemes() returns an empty string if the user hasn’t changed the default phonemes. So there’s no way to get the phonemes from SynthV.

So returning null/nil makes a lot of this stuff unusable. :roll_eyes:

「いいね!」 1