Tempo
public struct Tempo: Codable
Defines the tempo of the music with beats per second and time signature.
-
Time signature of music.
Declaration
Swift
public var timeSignature: TimeSignature -
Beats per minutes.
Declaration
Swift
public var bpm: Double -
Initilizes tempo with time signature and BPM.
Declaration
Swift
public init(timeSignature: TimeSignature = TimeSignature(), bpm: Double = 120.0)Parameters
timeSignatureTime Signature.
bpmBeats per minute.
-
Caluclates the duration of a note value in seconds.
Declaration
Swift
public func duration(of noteValue: NoteValue) -> TimeInterval -
Calculates the note length in samples. Useful for sequencing notes sample accurate in the DSP.
Declaration
Swift
public func sampleLength(of noteValue: NoteValue, sampleRate: Double = 44100.0) -> DoubleParameters
noteValueRate of the note you want to calculate sample length.
sampleRateNumber of samples in a second. Defaults to 44100.
Return Value
Returns the sample length of a note value.
-
Calculates the LFO speed of a note vaule in hertz.
Declaration
Swift
public func hertz(of noteValue: NoteValue) -> Double
View on GitHub
Tempo Structure Reference