Double

struct Double
  • Get basic value as a double

    Declaration

    Swift

    public func value() -> Double
  • Return a value on [minimum, maximum] to a [0, 1] range, according to a taper

    • Parameters:
      • minimum: Minimum of the source range (cannot be zero if taper is not positive)
      • maximum: Maximum of the source range
      • taper: For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

    Declaration

    Swift

    public func normalized(
            minimum: Double,
                    maximum: Double,
                    taper: Double) -> Double

    Parameters

    minimum

    Minimum of the source range (cannot be zero if taper is not positive)

    maximum

    Maximum of the source range

    taper

    For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

  • Convert a value on [minimum, maximum] to a [0, 1] range, according to a taper

    • Parameters:
      • minimum: Minimum of the source range (cannot be zero if taper is not positive)
      • maximum: Maximum of the source range
      • taper: For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

    Declaration

    Swift

    public mutating func normalize(_ minimum: Double, maximum: Double, taper: Double)

    Parameters

    minimum

    Minimum of the source range (cannot be zero if taper is not positive)

    maximum

    Maximum of the source range

    taper

    For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

  • Return a value on [0, 1] to a [minimum, maximum] range, according to a taper

    • Parameters:
      • minimum: Minimum of the target range (cannot be zero if taper is not positive)
      • maximum: Maximum of the target range
      • taper: For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

    Declaration

    Swift

    public func denormalized(minimum: Double,
                                 maximum: Double,
                                 taper: Double) -> Double

    Parameters

    minimum

    Minimum of the target range (cannot be zero if taper is not positive)

    maximum

    Maximum of the target range

    taper

    For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

  • Convert a value on [0, 1] to a [min, max] range, according to a taper

    • Parameters:
      • minimum: Minimum of the target range (cannot be zero if taper is not positive)
      • maximum: Maximum of the target range
      • taper: For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

    Declaration

    Swift

    public mutating func denormalize(minimum: Double, maximum: Double, taper: Double)

    Parameters

    minimum

    Minimum of the target range (cannot be zero if taper is not positive)

    maximum

    Maximum of the target range

    taper

    For taper > 0, there is an algebraic curve, taper = 1 is linear, and taper < 0 is exponential

  • Calculate frequency from a floating point MIDI Note Number

    Declaration

    Swift

    public func midiNoteToFrequency(_ aRef: Double = 440.0) -> Double

    Parameters

    aRef

    Reference frequency of A Note (Default: 440Hz)

  • Calculate MIDI Note Number from a frequency in Hz

    Declaration

    Swift

    public func frequencyToMIDINote(_ aRef: Double = 440.0) -> Double

    Parameters

    aRef

    Reference frequency of A Note (Default: 440Hz)