AKTuningTable

@objc
open class AKTuningTable : AKTuningTableBase

AKTuningTable provides high-level methods to create musically useful tuning tables

  • Declaration

    Swift

    @objc
    private(set) public var masterSet: [AKTuningTable.Frequency]
  • Note number for standard reference note

    Declaration

    Swift

    @objc
    public var middleCNoteNumber: MIDINoteNumber { get set }
  • Frequency of standard reference note equivalent to noteToHz: return 440. * exp2((60 - 69)/12.)

    Declaration

    Swift

    @objc
    public var middleCFrequency: AKTuningTable.Frequency { get set }
  • Octave number for standard reference note. Can be negative …, -2, -1, 0, 1, 2, …

    Declaration

    Swift

    @objc
    public var middleCOctave: Int { get set }
  • Range of downwards Pitch Bend used in etNN calculation. Must match your synthesizer’s pitch bend DOWN range etNNPitchBendRangeDown and etNNPitchBendRangeUp must cover a spread that is greater than the maximum distance between two notes in your octave.

    Declaration

    Swift

    @objc
    public var etNNPitchBendRangeDown: AKTuningTable.Cents { get set }
  • Range of upwards Pitch Bend used in etNN calculation. Must match your synthesizer’s pitch bend UP range etNNPitchBendRangeDown and etNNPitchBendRangeUp must cover a spread that is greater than the maximum distance between two notes in your octave.

    Declaration

    Swift

    @objc
    public var etNNPitchBendRangeUp: AKTuningTable.Cents { get set }
  • Given the tuning table’s MIDINoteNumber NN return an AKTuningTableETNN of the equivalent 12ET MIDINoteNumber plus Pitch Bend Returns nil if the tuning table’s MIDINoteNumber cannot be mapped to 12ET

    Declaration

    Swift

    @objc
    public func etNNPitchBend(NN nn: MIDINoteNumber) -> AKTuningTableETNN?

    Parameters

    nn

    The tuning table’s Note Number

  • Given the tuning table’s MIDINoteNumber NN return an AKTuningTableETNN of the equivalent 12ET MIDINoteNumber plus Pitch Bend Returns nil if the tuning table’s MIDINoteNumber cannot be mapped to 12ET

    Declaration

    Swift

    @objc
    public func delta12ET(NN nn: MIDINoteNumber) -> AKTuningTableDelta12ET?

    Parameters

    nn

    The tuning table’s Note Number

  • npo

    Notes Per Octave: The count of the masterSet array

    Declaration

    Swift

    @objc
    override public var npo: Int { get }
  • Initialization for standard default 12 tone equal temperament

    Declaration

    Swift

    @objc
    public override init()
  • Create the tuning using the input masterSet

    Declaration

    Swift

    @discardableResult
    @objc
    public func tuningTable(fromFrequencies inputMasterSet: [Frequency]) -> Int

    Parameters

    inputMasterSet

    An array of frequencies, i.e., the masterSet

  • Renders and returns the masterSet values as an array of cents

    Declaration

    Swift

    @objc
    public func masterSetInCents() -> [Cents]
  • Creates a Nested 2-interval pattern, or Moment of Symmetry From Erv Wilson. See http://anaphoria.com/wilsonintroMOS.html

    Declaration

    Swift

    @objc
    public func momentOfSymmetry(generator gInput: Double = 7.0 / 12.0,
                                 level lInput: Int = 5,
                                 murchana mInput: Int = 0) -> Int

    Parameters

    gInput

    A Double on [0, 1]

    lInput

    An Int on [0, 7]

    mInput

    The mode of the scale…degrees are normalized by the frequency at this index

    Return Value

    Number of notes per octave

  • Create a hexany from 4 frequencies (4 choose 2) From Erv Wilson. See http://anaphoria.com/dal.pdf and http://anaphoria.com/hexany.pdf

    Declaration

    Swift

    @discardableResult
    @objc
    public func hexany(_ A: Frequency, _ B: Frequency, _ C: Frequency, _ D: Frequency) -> Int

    Parameters

    A

    First of the master set of frequencies

    B

    Second of the master set of frequencies

    C

    Third of the master set of frequencies

    D

    Fourth of the master set of frequencies

  • Create a major tetrany from 4 frequencies (4 choose 1)

    Declaration

    Swift

    @discardableResult
    @objc
    public func majorTetrany(_ A: Frequency, _ B: Frequency, _ C: Frequency, _ D: Frequency) -> Int

    Parameters

    A

    First of the master set of frequencies

    B

    Second of the master set of frequencies

    C

    Third of the master set of frequencies

    D

    Fourth of the master set of frequencies

  • Create a hexany from 4 frequencies (4 choose 3)

    Declaration

    Swift

    @discardableResult
    @objc
    public func minorTetrany(_ A: Frequency, _ B: Frequency, _ C: Frequency, _ D: Frequency) -> Int

    Parameters

    A

    First of the master set of frequencies

    B

    Second of the master set of frequencies

    C

    Third of the master set of frequencies

    D

    Fourth of the master set of frequencies

  • Default tuning table is 12ET.

    Declaration

    Swift

    public func defaultTuning() -> Int
  • Create 12-tone equal temperament

    Declaration

    Swift

    public func twelveToneEqualTemperament() -> Int
  • Create 31-tone equal temperament

    Declaration

    Swift

    public func thirtyOneEqualTemperament() -> Int
  • Create an equal temperament with notesPerOctave

    Declaration

    Swift

    public func equalTemperament(notesPerOctave npo: Int) -> Int
  • Use a Scala file to write the tuning table. Returns notes per octave or nil when file couldn’t be read.

    Declaration

    Swift

    public func scalaFile(_ filePath: String) -> Int?
  • Get frequencies from a Scala string

    Declaration

    Swift

    open func frequencies(fromScalaString rawStr: String?) -> [Frequency]?