Rhythm
public struct Rhythm<Element>
Undocumented
-
Hierarchical representation of metrical durations.
Declaration
Swift
public let durationTree: DurationTree -
Leaf items containing metrical context.
Declaration
Swift
public var leaves: [Leaf]
-
The metrical identity of a given rhythmic leaf item.
tied
: if a leaf istied
over from the previous event (.continuation)rest
: if a leaf is arest
, a measured silence (.instance(.rest))event
: if a leaf is a measured non-silence (.instance(.event(Element)))
Declaration
Swift
public typealias Context = ContinuationOrInstance<AbsenceOrEvent<Element>>
-
Create a
Rhythmwith a givendurationTreeand givenleaves.Declaration
Swift
public init(_ durationTree: DurationTree, _ leaves: [Context])
-
Declaration
Swift
public var events: [Element] { get }Return Value
An array of the
eventvalues contained herein. -
Declaration
Swift
public var eventOffsets: [Duration] { get }Return Value
The durational offsets of the event-containing leaves.
-
Declaration
Swift
@inlinable public var lengths: [Duration] { get }Return Value
The effective duration of each
event. -
Declaration
Swift
public var eventIndices: [Int] { get }Return Value
The indices within
leaveswhich contain events (not ties or rests).
-
Each
.continuationremains as suchEach
.instance(.rest)remains as suchEach
.instance(.event(T))is transformed to a.instance(.event(U))
Declaration
Swift
public func map <U> (_ transform: @escaping (Element) -> U) -> Rhythm<U>Return Value
Rhythmwith each of itsevent(i.e.,.instance(.event(Element))) values updated by the giventransform. -
Declaration
Swift
public func mapEvents<U>(_ transforms: [(Element) -> U]) -> Rhythm<U>Return Value
Rhythmwith each of the transforms applied to each of the event-containing leaves contained herein. -
Declaration
Swift
public func replaceEvents<U>(_ events: [U]) -> Rhythm<U>Return Value
Rhythmwith the equivalentdurationTreebut withevent-holding leaves replaced by the values contained in the givenleaves.
View on GitHub
Install in Dash
Rhythm Structure Reference