AKTuningTable

@objc open class AKTuningTable: NSObject

Tuning table stores frequencies at which to play MIDI notes

  • For clarity, typealias Frequency as a Double

    Declaration

    Swift

    public typealias Frequency = Double
  • Total number of MIDI Notes available to play

    Declaration

    Swift

    public static let midiNoteCount = 128
  • Note number for standard reference note

    Declaration

    Swift

    public var middleCNoteNumber: MIDINoteNumber = 60
  • Frequency of standard reference note equivalent to noteToHz: return 440. * exp2((60 - 69)/12.)

    Declaration

    Swift

    public var middleCFrequency: Frequency = 261.625_565_300_6
  • Octave number for standard reference note. Can be negative …, -2, -1, 0, 1, 2, …

    Declaration

    Swift

    public var middleCOctave: Int = 0
  • Initialization for standard default 12 tone equal temperament

    Declaration

    Swift

    public override init()
  • Pull out frequency information for a given note number

    Declaration

    Swift

    public func frequency(forNoteNumber noteNumber: MIDINoteNumber) -> Frequency
  • Set frequency of a given note number

    Declaration

    Swift

    public func setFrequency(_ frequency: Frequency, at noteNumber: MIDINoteNumber)
  • Create the tuning using the input frequencies

    Declaration

    Swift

    public func tuningTable(fromFrequencies inputFrequencies: [Frequency])

    Parameters

    inputFrequencies

    An array of frequencies

  • 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

    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

    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

    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

  • Creates a Nested 2-interval pattern, or Moment of Symmetry From Erv Wilson. See http://anaphoria.com/wilsonintroMOS.html

    Declaration

    Swift

    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

  • Use a Scala file to write the tuning table

    Declaration

    Swift

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

    Declaration

    Swift

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