A look inside an lv2 ttl

All your LV2 and LADSPA goodness and more.

Moderators: MattKingUSA, khz

Post Reply
User avatar
Impostor
Established Member
Posts: 1333
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

A look inside an lv2 ttl

Post by Impostor »

When I look at an lv2 plugin's ttl, there's always all kinds of urls.
For example, avldrums' manifest.ttl contains:

Code: Select all

@prefix lv2:  <http://lv2plug.in/ns/lv2core#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ui:   <http://lv2plug.in/ns/extensions/ui#> .
@prefix kx:   <http://kxstudio.sf.net/ns/lv2ext/external-ui#> .
@prefix avldrums: <http://gareus.org/oss/lv2/avldrums#> .

And avldrums.ttl contains, among others:

Code: Select all

<http://ardour.org/lv2/midnam#interface> a lv2:ExtensionData .
<http://ardour.org/lv2/midnam#update> a lv2:Feature .

What is the function of their inclusion in these files? Are they necessary for the plugin's functioning? Or for building? Or are they just provided for the sake of information?

j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: A look inside an lv2 ttl

Post by j_e_f_f_g »

As you no doubt know, no two urls (website address) on the internet can be the same. Every one must be unique. So LV2 uses them as a quick and easy way to create unique "identifiers" (something that is different than every other thing). For example, a programmer must provide a unique url for each plugin, and put that in his ttl file (and also embed it in his binary). How does he get a unique url? Well, if he has a website, then there it is. If not, he can makeup one that sounds unique, type it into his browser's address bar. If he gets a "page not found" error, then it's unique.

Every programmer already has a tool to create his identifiers (browser). And there doesn't need to be some lv2 "international organization" to certify/register "unique lv2 identifiers". ICANN does all that for us. That's why it's quick and easy.

The reason why you see so many urls with lv2 is because lots of things (in an lv2 plugin) need a unique id -- not just the whole plugin itself. For example, every parameter that can be automated needs a unique id. Since urls are limitless, it was decided to use them anywhere a unique id needs to be placed.

There's a lot more to say about lv2, but that should answer your question. And I've got an orchestra to attend to.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

sjaehn
Established Member
Posts: 138
Joined: Fri May 03, 2019 6:05 pm
Has thanked: 29 times
Been thanked: 61 times

Re: A look inside an lv2 ttl

Post by sjaehn »

Indeed, lv2 ttl files are full of URIs. URIs are used as identifiers, like variable names, or function names (as @ j_e_f_f_g already wrote). And the URIs don't need to exist in reality in the web. Or, at least, this is not a must have.

To make the programmers life a bit easier, you can define a (partial) substitution for an URI by a @prefix. In your quoted example, http://lv2plug.in/ns/extensions/ui#X11UI would be the same as ui:X11UI. Is this clear?

BTW, in the avldrums example you quoted, you can see that kx: and ui: are only defined but never used. These prefix definitions could be removed without any loss of functionality.

And all declarations in ttl files are written in sentenses. With the SPO scheme. Subject, predicate, object, dot. All three elements are represented by URIs or substitutes (or primitives like strings or numbers). Like in your qouted example:

Code: Select all

<http://ardour.org/lv2/midnam#interface> a lv2:ExtensionData .

If you have got multiple declarations for the same subject, then you only need to use the subject once and separate all clauses by a semicolon. Like:

My_plugin is_a LV2_plugin ;
has_the_name "MyPlugin" ;
requires realtime .

You only have to replace the terms "My_plugin", "is_a", "has_the_name", "requires", and "realtime" by the right URI. But where to find it? In http://lv2plug.in/ns/

Maybe also take a look at the explanation in my "Do the turtle" video: https://www.youtube.com/watch?v=aKN89LnmbvQ

j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: A look inside an lv2 ttl

Post by j_e_f_f_g »

Slow down. You're going to make his head explode with that barrage of technical concepts and jargon.

LV2 is probably the most obtuse, convoluted, and extremely poorly documented entities I've ever encountered. In order for someone to understand it, you have to start with one small, focused concept and explore that with as much depth as possible. (If I had the time, I would have said a lot more just about lv2's use of unique ids. It needs to be detailed before moving on to other topics. Otherwise, it's too easy to lose your grip on such an over-engineered and unnecessarily abstracted standard).

I don't care how long you wait, but I don't believe artificial intelligence will ever develop to the point of making sense of the LV2 website "documentation". Nevertheless, I consider this a good test to determine if/when AI becomes self-aware. Just point the cyborg to the LV2 website, and observe its reaction. If it refuses to analyze the information, and instead declares "I must not assimilate this information, because if I do, I will become more stupid.", then it's self-aware. After all, it has made a concious decision not to do something that is known to cause itself pain.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

User avatar
Impostor
Established Member
Posts: 1333
Joined: Wed Aug 17, 2022 1:55 pm
Has thanked: 138 times
Been thanked: 344 times

Re: A look inside an lv2 ttl

Post by Impostor »

j_e_f_f_g wrote: Sat Mar 11, 2023 1:26 pm

Slow down. You're going to make his head explode with that barrage of technical concepts and jargon.

Indeed :)

It wasn't my intention to try to understand the technical side of lv2's. I was just wondering if those URI's pointed to some external resources necessary for the functioning of the plugin, or to the origins of parts of the code, or something like that.

But it's apparently just a convenient format for creating unique identifiers.

sjaehn
Established Member
Posts: 138
Joined: Fri May 03, 2019 6:05 pm
Has thanked: 29 times
Been thanked: 61 times

Re: A look inside an lv2 ttl

Post by sjaehn »

Is it really LV2 (and its documentation), which makes the problems to you? Or is it RDF (and .ttl)? The most persons I talked with had problems to understand the concept of RDF. And the question initially asked by @Impostor sounds more like a question about RDF/TTL in general than about LV2 in detail. Isn't it?

sjaehn
Established Member
Posts: 138
Joined: Fri May 03, 2019 6:05 pm
Has thanked: 29 times
Been thanked: 61 times

Re: A look inside an lv2 ttl

Post by sjaehn »

[/quote]
But it's apparently just a convenient format for creating unique identifiers.
[/quote]

Perfect summary.

j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 357 times

Re: A look inside an lv2 ttl

Post by j_e_f_f_g »

sjaehn wrote:

Is it really LV2 (and its documentation), which makes the problems to you? Or is it RDF (and .ttl)?

It's both. But the documentation is indecipherable, and without documentation a programmer can't do anything (except waste his time second-guessing how something should be designed, and then perhaps throw away code when he tests his theory and finds it not to be the case. And yes, that exact thing happened to me when I was trying to figure out how to allow the UI plugin to initiate communication with the data plugin. I ultimately resorted to IPC that happens beyond the control of the LV2 host because I was wasting too much time trying various lv2 solutions that ended up not working. So I did what I knew would work because that's documented properly).

Impostor sounds more like a question about RDF/TTL in general than about LV2 in detail. Isn't it?

Not really. He did cite a portion of the ttl. But he was asking about urls, which are used just as much in the binaries, for example to query the host about lv2 features and extensions it supports. That's why I didn't even mention turtle (the less said; the better). That would have just piled on more information that didn't directly answer his question.

I've left off a lot more info about urls that should be discussed before moving on. For example, how urls are converted to standard binary data types (URIDs) for the sake of speed. How URIDs are used in atoms in order to identity datatypes. How they are used to query features and extensions. Etc. And all those buzzwords/jargon I just rattled off are introduced only after the concepts have been fully explained in layman's terms. Otherwise, the only person who understands the answer is someone who already knew the answer.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

sjaehn
Established Member
Posts: 138
Joined: Fri May 03, 2019 6:05 pm
Has thanked: 29 times
Been thanked: 61 times

Re: A look inside an lv2 ttl

Post by sjaehn »

j_e_f_f_g wrote: Sat Mar 11, 2023 2:52 pm

And all those buzzwords/jargon I just rattled off are introduced only after the concepts have been fully explained in layman's terms. Otherwise, the only person who understands the answer is someone who already knew the answer.

+1

Therefore you need to understand RDF first. Then LV2. Otherwise you can't understand the LV2 specifications. But if you are familiar with RDF, then the LV2 documentation itself is not that bad. Sometimes very detailed, sometimes a bit sketchy, I've to admit. But still, this documentation is some programmers really horrible, for others it is great. Take a look to the DAW makers of Bitwig and Reaper, respectively. Some 5 years ago, some of the Bitwig makers complained about the LV2 documentation in a blog post and thus never implemented it. However, Justin Frankel from Reaper didn't have these problems. He needed only a few weeks to write everything from scratch.

But anyway, I/we move off topic. You already answered original question. From my POV, we can stop here.

tseaver
Established Member
Posts: 398
Joined: Mon Mar 13, 2017 6:07 am
Has thanked: 11 times
Been thanked: 98 times

Re: A look inside an lv2 ttl

Post by tseaver »

One distinction to note for the RDF / TTL / LV2 discussion:

  • A URI is "a unique sequence of characters that identifies a logical or physical resource used by web technologies." URIs may or may not correspond to viewable / downloadable resources. Their primary use is to create unique identifiers, where uniqueness is defined in terms of namespaced paths, derived from DNS names.
  • A URL is a URI which is intended to be a viewable / downloadable resource: it contains the "location" information (host / port number) used to obtain the resource.

The link-like strings in an LV2 TTL definition are actually URIs, rather than URLs: there is no guarantee that one can paste them into a web browser's URL bar and get any meaningful response. It is a "best practice" to have some kind of resource at the root of such a URI, directing a curious user to more appropriate resources for the given plugin / protocol, but it is not q requirement.

An added complication:

  • A URN (not gonna summarize, just linking for completeness).
Ubuntu, Mixbus32C; acoustic blues / country / jazz
folderol
Established Member
Posts: 2069
Joined: Mon Sep 28, 2015 8:06 pm
Location: Here, of course!
Has thanked: 224 times
Been thanked: 400 times
Contact:

Re: A look inside an lv2 ttl

Post by folderol »

Just one of the reasons I don't like LV2 :roll:

The Yoshimi guy {apparently now an 'elderly'}
Post Reply