Basic Types
-
Type used to represent beat values in a metrical organization of time.
Declaration
Swift
public typealias Beats = Int
-
Type used to represent subdivision values in a metrical organization of time.
Declaration
Swift
public typealias Subdivision = Int
-
A unit of hierarchically-divided symbolic time.
Example Usage
You can create a
Duration
value with an amount ofbeats
at a givensubdivision
level.let _ = Duration(1,4) // => one quarter note let _ = Duration(3,32) // => three thirty-second notes
You can also create a
Duration
value with an infix operator:let _ = 3/>32 let _ = 31/>4
The
subdivision
value must be a power-of-two, otherwise your program will crash!
See morelet _ = Duration(3,13) // boom
Declaration
Swift
public struct Duration
-
Abstract structure of beats which are concretely represented in a measure.
To create a basic meter, it is a simple as:
let common = Meter(4,4) let waltz = Meter(3,4) let ferneyhough = Meter(3,12)
A fractional meter can be created like so:
let fractional = Meter(Fraction(3,5),16)
Any number of meters can be combined into an additive meter:
let blueRondo = Meter(2,8) + Meter(2,8) + Meter(2,8) + Meter(3,8) let czernowinSQm5 = Meter(Meter(1,4),Meter(3,16))
Basic and fractional meters can also be combined:
See morelet czernowinSQm7 = Meter(Meter(1,4),Meter(Fraction(2,3),4))
Declaration
Swift
public struct Meter