This vocabulary defines a number of units for use in audio processing.

For example, to say that a gain port's value is in decibels (units:db)

@prefix units: <http://lv2plug.in/ns/extensions/units#> .
@prefix eg:    <http://example.org/> .

eg:plugin lv2:port [
    a            lv2:ControlPort , lv2:InputPort ;
    lv2:index    0 ;
    lv2:symbol   "gain" ;
    lv2:name     "gain" ;
    units:unit   units:db
] .

Using the same form, plugins may also specify one-off units inline, to give better display hints to hosts:

eg:plugin lv2:port [
    a            lv2:ControlPort , lv2:InputPort ;
    lv2:index    0 ;
    lv2:symbol   "frob" ;
    lv2:name     "frob level" ;
    units:unit [
        a            units:Unit ;
        rdfs:label   "frobnication" ;
        units:symbol "fr" ;
        units:render "%f f"
    ]
] .

It is also possible to define conversions between various units, which makes it possible for hosts to automatically and generically convert from a given unit to a desired unit. The units defined in this extension include conversion definitions where it makes sense to do so.

Reference

ClassesPropertiesInstances

Classes

Conversion

In domain offactor
to
In range ofconversion
prefixConversion
Conversion

A conversion from one unit to another.

Restriction on to
owl:cardinality 1
A conversion MUST have exactly 1 units:to property.

Unit

In domain ofconversion
prefixConversion
render
symbol
In range ofto
unit
Unit

A unit for LV2 port data

Properties

conversion

TypeObject Property
DomainUnit
RangeConversion
conversion

A conversion from this unit to another.

factor

TypeDatatype Property
DomainConversion
conversion factor

The factor to multiply the source value by in order to convert to the target unit.

prefixConversion

TypeObject Property
Sub-property ofconversion
DomainUnit
RangeConversion
prefix conversion

A conversion from this unit to the same unit but with a different SI prefix (e.g. Hz to kHz).

render

TypeDatatype Property
DomainUnit
Rangexsd:string
unit format string

A printf format string for rendering a value (eg. "%f dB").

symbol

TypeDatatype Property
DomainUnit
Rangexsd:string
unit symbol

The abbreviated symbol for the unit (e.g. dB).

to

TypeObject Property
DomainConversion
RangeUnit
conversion target

The target unit this conversion converts to.

unit

TypeObject Property
RangeUnit
unit

The unit used by the value of a port or parameter.

Instances

bar

TypeUnit
render %f bars
symbol bars
bars

beat

TypeUnit
render %f beats
symbol beats
beats

bpm

TypeUnit
prefixConversion
factor 0.0166666666
to hz
render %f BPM
symbol BPM
beats per minute

coef

TypeUnit
conversion
factor 100
to pc
render * %f
symbol
coefficient

db

TypeUnit
render %f dB
symbol dB
decibels

degree

TypeUnit
render %f deg
symbol deg
degrees

frame

TypeUnit
render %f frames
symbol frames
audio frames

inch

TypeUnit
conversion
factor 2.54
to cm
render %f"
symbol in
inches

khz

TypeUnit
prefixConversion
factor 1000
to hz
prefixConversion
factor 0.001
to mhz
render %f kHz
symbol kHz
kilohertz

mhz

TypeUnit
prefixConversion
factor 1000000
to hz
prefixConversion
factor 0.001
to khz
render %f MHz
symbol MHz
megahertz

midiNote

TypeUnit
render MIDI note %d
symbol note
MIDI note

mile

TypeUnit
conversion
factor 1.6093
to km
render %f mi
symbol mi
miles

min

TypeUnit
conversion
factor 60.0
to s
render %f mins
symbol min
minutes

ms

TypeUnit
prefixConversion
factor 0.001
to s
render %f ms
symbol ms
milliseconds

oct

TypeUnit
conversion
factor 12.0
to semitone12TET
render %f octaves
symbol oct
octaves

pc

TypeUnit
conversion
factor 0.01
to coef
render %f%%
symbol %
percent

s

TypeUnit
conversion
factor 0.0166666666
to min
prefixConversion
factor 1000
to ms
render %f s
symbol s
seconds

semitone12TET

TypeUnit
conversion
factor 0.083333333
to oct
render %f semi
symbol semi
semitones

History

Version 5.12 (2019-02-03)
  • Fix outdated port description in documentation.
  • Remove overly restrictive domain from units:unit.
Version 5.10 (2015-04-07)
  • Fix non-existent port type in examples.
  • Add lv2:Parameter to domain of units:unit.
Version 5.8 (2012-10-14)
  • Remove units:name in favour of rdfs:label.
  • Use consistent label style.
Version 5.6 (2012-04-17)
  • Add unit for audio frames.
  • Add header of URI defines.
  • Merge with unified LV2 package.
Version 5.4 (2011-11-21)
  • Make units.ttl a valid OWL 2 DL ontology.
  • Define used but undefined resources (units:name, units:render, units:symbol, units:Conversion, units:conversion, units:prefixConversion, units:to, and units:factor).
  • Update packaging.
  • Improve documentation.
Version 5.2 (2010-10-05)
  • Add build system (for installation).
  • Convert documentation to HTML and use lv2:documentation.
Version 5.0 (2010-10-05)
  • Update packaging.
  • Improve documentation.
  • Initial release.
  • Define used but undefined resources (units:name, units:render, units:symbol, units:Conversion, units:conversion, units:prefixConversion, units:to, and units:factor).