Latest 0.0.4
Homepage https://github.com/shingt/HarmonyKit
License MIT
Platforms ios 10.0
Authors

CI Status
Xcode 10.0+
iOS 11.0+
Swift 4.2

Tool to generate audio frequencies.

Synopsis

First you need to define a tuning setting

let setting = HarmonyKit.Setting(
    pitch: 442,
    scaleType: .equal,
    rootTone: .C,
    transpositionTone: .C,
    octaveRange: 1..<2
)

and then

let harmonies = HarmonyKit.tune(setting: setting)
let sortedHarmonies = harmonies.sorted()
sortedHarmonies.forEach { print($0) }
// =>
// tone: A, octave: 1, frequency: 55.25
// tone: Bb, octave: 1, frequency: 58.5353
// tone: B, octave: 1, frequency: 62.016
// tone: C, octave: 1, frequency: 32.8518
// tone: Db, octave: 1, frequency: 34.8053
// tone: D, octave: 1, frequency: 36.875
// tone: Eb, octave: 1, frequency: 39.0676
// tone: E, octave: 1, frequency: 41.3907
// tone: F, octave: 1, frequency: 43.852
// tone: Gb, octave: 1, frequency: 46.4595
// tone: G, octave: 1, frequency: 49.2222
// tone: Ab, octave: 1, frequency: 52.1491

If you specify .pureMajor for scaleType:

sortedHarmonies.forEach { print($0) }
// =>
// tone: A, octave: 1, frequency: 54.7544
// tone: Bb, octave: 1, frequency: 59.1335
// tone: B, octave: 1, frequency: 61.5983
// tone: C, octave: 1, frequency: 32.8518
// tone: Db, octave: 1, frequency: 34.2212
// tone: D, octave: 1, frequency: 36.9581
// tone: Eb, octave: 1, frequency: 39.4213
// tone: E, octave: 1, frequency: 41.0645
// tone: F, octave: 1, frequency: 43.8013
// tone: Gb, octave: 1, frequency: 45.6271
// tone: G, octave: 1, frequency: 49.2791
// tone: Ab, octave: 1, frequency: 51.3302

.pureMinor:

sortedHarmonies.forEach { print($0) }
// =>
// tone: A, octave: 1, frequency: 54.7544
// tone: Bb, octave: 1, frequency: 59.1335
// tone: B, octave: 1, frequency: 61.5983
// tone: C, octave: 1, frequency: 32.8518
// tone: Db, octave: 1, frequency: 35.4792
// tone: D, octave: 1, frequency: 36.9581
// tone: Eb, octave: 1, frequency: 39.4213
// tone: E, octave: 1, frequency: 41.0645
// tone: F, octave: 1, frequency: 43.8013
// tone: Gb, octave: 1, frequency: 47.3071
// tone: G, octave: 1, frequency: 49.2791
// tone: Ab, octave: 1, frequency: 52.5634

Installation

HarmonyKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "HarmonyKit"

Example

See Tests/HarmonyKitTests/HarmonyKitTests.swift.

Author

shingt

License

HarmonyKit is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "HarmonyKit",
    "version": "0.0.4",
    "summary": "Tool to generate harmony in audio frequencies in Swift.",
    "description": "HarmonyKit helps you to generate generate harmony audio frequencies in Swift. Just like Hamony Director.",
    "homepage": "https://github.com/shingt/HarmonyKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "shingt": "[email protected]"
    },
    "source": {
        "git": "https://github.com/shingt/HarmonyKit.git",
        "tag": "0.0.4"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "Sources/**/*.{swift,h,m}",
    "pushed_with_swift_version": "4.2"
}

Pin It on Pinterest

Share This