# LV2 Units

http://lv2plug.in/ns/extensions/units
Units for LV2 values.

Version | 5.10
Date | 2018-03-16
Discuss | devel@lists.lv2plug.in (subscribe)
Developer | Steve Harris
Maintainer | David Robillard

- Index
- Reference
- History
- API

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:datatype lv2:Float ;
        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:datatype lv2:Float ;
        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.

## Index

Classes | Properties | Instances | Files
--- | --- | --- | ---
Conversion Unit | conversion factor prefixConversion render symbol to unit | bar beat bpm cent cm coef db degree frame hz inch khz km m mhz midiNote mile min mm ms oct pc s semitone12TET | lv2-units.doap.ttl units.h units.ttl

## Reference

### Class units:Conversion

Conversion

A conversion from one unit to another.

Restriction on units:to |
owl:cardinality | 1
A conversion MUST have exactly 1 units:to property.
In domain of | units:to
| units:factor
In range of | units:conversion
| units:prefixConversion

### Class units:Unit

Unit

A unit for LV2 port data

In domain of | units:prefixConversion
| units:symbol
| units:conversion
| units:render
In range of | units:unit
| units:to

### Property units:conversion

conversion

A conversion from this unit to another.

OWL Type | Object Property
Domain | units:Unit
Range | units:Conversion

### Property units:factor

conversion factor

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

OWL Type | Datatype Property
Domain | units:Conversion

### Property units:prefixConversion

prefix conversion

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

OWL Type | Object Property
Sub-property of | units:conversion
Domain | units:Unit
Range | units:Conversion

### Property units:render

unit format string

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

OWL Type | Datatype Property
Domain | units:Unit
Range | xsd:string

### Property units:symbol

unit symbol

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

OWL Type | Datatype Property
Domain | units:Unit
Range | xsd:string

### Property units:to

conversion target

The target unit this conversion converts to.

OWL Type | Object Property
Domain | units:Conversion
Range | units:Unit

### Property units:unit

unit

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

OWL Type | Object Property
Domain | lv2:Port
| lv2:Parameter
Range | units:Unit

### Instance units:bar

bars

Type | units:Unit
units:render | %f bars
units:symbol | bars

### Instance units:beat

beats

Type | units:Unit
units:render | %f beats
units:symbol | beats

### Instance units:bpm

beats per minute

Type | units:Unit
units:prefixConversion |
units:factor | 0.0166666666
units:to | units:hz
units:render | %f BPM
units:symbol | BPM

### Instance units:cent

cents

Type | units:Unit
units:conversion |
units:factor | 0.01
units:to | units:semitone12TET
units:render | %f ct
units:symbol | ct

### Instance units:cm

centimetres

Type | units:Unit
units:conversion |
units:factor | 0.3937
units:to | units:inch
units:prefixConversion |
units:factor | 0.01
units:to | units:m
units:prefixConversion |
units:factor | 10
units:to | units:mm
units:prefixConversion |
units:factor | 0.00001
units:to | units:km
units:render | %f cm
units:symbol | cm

### Instance units:coef

coefficient

Type | units:Unit
units:conversion |
units:factor | 100
units:to | units:pc
units:render | * %f
units:symbol |

### Instance units:db

decibels

Type | units:Unit
units:render | %f dB
units:symbol | dB

### Instance units:degree

degrees

Type | units:Unit
units:render | %f deg
units:symbol | deg

### Instance units:frame

audio frames

Type | units:Unit
units:render | %f frames
units:symbol | frames

### Instance units:hz

hertz

Type | units:Unit
units:prefixConversion |
units:factor | 0.001
units:to | units:khz
units:prefixConversion |
units:factor | 0.000001
units:to | units:mhz
units:render | %f Hz
units:symbol | Hz

### Instance units:inch

inches

Type | units:Unit
units:conversion |
units:factor | 2.54
units:to | units:cm
units:render | %f"
units:symbol | in

### Instance units:khz

kilohertz

Type | units:Unit
units:prefixConversion |
units:factor | 1000
units:to | units:hz
units:prefixConversion |
units:factor | 0.001
units:to | units:mhz
units:render | %f kHz
units:symbol | kHz

### Instance units:km

kilometres

Type | units:Unit
units:conversion |
units:factor | 0.62138818
units:to | units:mile
units:prefixConversion |
units:factor | 1000
units:to | units:m
units:prefixConversion |
units:factor | 100000
units:to | units:cm
units:prefixConversion |
units:factor | 1000000
units:to | units:mm
units:render | %f km
units:symbol | km

### Instance units:m

metres

Type | units:Unit
units:conversion |
units:factor | 39.37
units:to | units:inch
units:prefixConversion |
units:factor | 100
units:to | units:cm
units:prefixConversion |
units:factor | 1000
units:to | units:mm
units:prefixConversion |
units:factor | 0.001
units:to | units:km
units:render | %f m
units:symbol | m

### Instance units:mhz

megahertz

Type | units:Unit
units:prefixConversion |
units:factor | 1000000
units:to | units:hz
units:prefixConversion |
units:factor | 0.001
units:to | units:khz
units:render | %f MHz
units:symbol | MHz

### Instance units:midiNote

MIDI note

Type | units:Unit
units:render | MIDI note %d
units:symbol | note

### Instance units:mile

miles

Type | units:Unit
units:conversion |
units:factor | 1.6093
units:to | units:km
units:render | %f mi
units:symbol | mi

### Instance units:min

minutes

Type | units:Unit
units:conversion |
units:factor | 60.0
units:to | units:s
units:render | %f mins
units:symbol | min

### Instance units:mm

millimetres

Type | units:Unit
units:conversion |
units:factor | 0.03937
units:to | units:inch
units:prefixConversion |
units:factor | 0.001
units:to | units:m
units:prefixConversion |
units:factor | 0.1
units:to | units:cm
units:prefixConversion |
units:factor | 0.000001
units:to | units:km
units:render | %f mm
units:symbol | mm

### Instance units:ms

milliseconds

Type | units:Unit
units:prefixConversion |
units:factor | 0.001
units:to | units:s
units:render | %f ms
units:symbol | ms

### Instance units:oct

octaves

Type | units:Unit
units:conversion |
units:factor | 12.0
units:to | units:semitone12TET
units:render | %f octaves
units:symbol | oct

### Instance units:pc

percent

Type | units:Unit
units:conversion |
units:factor | 0.01
units:to | units:coef
units:render | %f%%
units:symbol | %

### Instance units:s

seconds

Type | units:Unit
units:conversion |
units:factor | 0.0166666666
units:to | units:min
units:prefixConversion |
units:factor | 1000
units:to | units:ms
units:render | %f s
units:symbol | s

### Instance units:semitone12TET

semitones

Type | units:Unit
units:conversion |
units:factor | 0.083333333
units:to | units:oct
units:render | %f semi
units:symbol | semi

## History

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)
  - Merge with unified LV2 package.
  - Add unit for audio frames.
  - Add header of URI defines.
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)
  - Initial release.
  - Improve documentation.
  - Define used but undefined resources (units:name, units:render, units:symbol, units:Conversion, units:conversion, units:prefixConversion, units:to, and units:factor).
  - Update packaging.