{"id":14006751,"url":"https://github.com/cemolcay/MusicTheory","last_synced_at":"2025-07-24T00:31:58.809Z","repository":{"id":15141896,"uuid":"77639945","full_name":"cemolcay/MusicTheory","owner":"cemolcay","description":"Universal music theory library for iOS, iPadOS, macOS, tvOS and watchOS in Swift","archived":false,"fork":false,"pushed_at":"2024-11-30T11:48:49.000Z","size":39695,"stargazers_count":461,"open_issues_count":1,"forks_count":51,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-07-19T15:59:27.333Z","etag":null,"topics":["chords","interval","ios","ipados","mac","music-theory","note","scale","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cemolcay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-29T21:06:36.000Z","updated_at":"2025-07-11T06:17:58.000Z","dependencies_parsed_at":"2022-11-28T10:39:14.640Z","dependency_job_id":"8d897dd0-b0cb-494c-8ff5-25ed2353dd14","html_url":"https://github.com/cemolcay/MusicTheory","commit_stats":{"total_commits":215,"total_committers":12,"mean_commits":"17.916666666666668","dds":0.0976744186046512,"last_synced_commit":"e60623793c3918313f23402fc6b94f4071f59465"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/cemolcay/MusicTheory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemolcay%2FMusicTheory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemolcay%2FMusicTheory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemolcay%2FMusicTheory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemolcay%2FMusicTheory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cemolcay","download_url":"https://codeload.github.com/cemolcay/MusicTheory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cemolcay%2FMusicTheory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266774745,"owners_count":23982246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chords","interval","ios","ipados","mac","music-theory","note","scale","swift"],"created_at":"2024-08-10T10:01:37.127Z","updated_at":"2025-07-24T00:31:58.374Z","avatar_url":"https://github.com/cemolcay.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"MusicTheory\n===\n\nA music theory library with `Key`, `Pitch`, `Interval`, `Scale` and `Chord` representations in swift enums.\n\nRequirements\n----\n* Swift 4.0+\n* iOS 8.0+\n* macOS 10.9+\n* tvOS 9.0+\n* watchOS 2.0+\n\nInstall\n----\n\n### CocoaPods\n\n```\npod 'MusicTheorySwift'\n```\n\n### Swift Package Manager\n\n``` swift\nlet package = Package(\n  name: ...\n  dependencies: [\n    .package(url: \"https://github.com/cemolcay/MusicTheory.git\")\n  ],\n  targets: ...\n)\n```\n\nUsage\n----\n\n`MusicTheory` adds a bunch of basic enums and structs that you can define pretty much any music related data. Most importants are `Pitch`, `Key`, `Scale` and `Chord`.   \n\nAll data types conforms `Codable`, `CustomStringConvertable`.  \n`Pitch`, and `Accident` structs are `RawPresentable` with `Int` as well as `ExpressibleByIntegerLiteral` that you can represent them directly with `Int`s.\n\n#### `Pitch` and `Key`\n\n- All keys can be defined with `Key` struct. \n- It has a `KeyType` where you can set the base key like C, D, A, G, and an `Accidental` where it can be `.natural`, `.flat`, `sharp` or more specific like `.sharps(amount: 3)`.\n- You can create `Pitch`es with a `Key` and octave.\n- Also, you can create `Pitch`es with MIDI note number. `rawValue` of a pitch is its MIDI note number.\n- `Pitch`, `Key`, `Accidental` structs are equatable, `+` and `-` custom operators defined for making calculations easier.\n- Also, there are other helper functions or properties like frequency of a note.\n- You can define them with directly string representations as well.\n\n``` swift\nlet dFlat = Key(type: d, accidental: .flat)\nlet c4 = Pitch(key: Key(type: .c), octave: 4)\nlet aSharp: Key = \"a#\" // Key(type: .a, accidental: .sharp)\nlet gFlat3: Pitch = \"gb3\" // or \"g♭3\" or \"Gb3\" is Pitch(key: (type: .g, accidental: .flat), octave: 3)\n```\n\n#### `Interval`\n\n- Intervals are halfsteps between pitches.\n- They are `IntegerLiteral` and you can make add/substract them between themselves, notes or note types.\n- You can build up a custom interval with its quality, degree and semitone properties.\n- You can build scales or chords from intervals.\n- Minor, major, perfect, augmented and diminished intervals up to 2 octaves are predefined.\n\n#### `ScaleType` and `Scale`\n\n- `ScaleType` enum defines a lot of readymade scales.\n- Also, you can create a custom scale type by `ScaleType.custom(intervals: [Interval], description: String)` \n- `Scale` defines a scale with a scale type and root key.\n- You can generate notes of scale in an octave range.\n- Also you can generate `HarmonicField` of a scale.\n- Harmonic field is all possible triad, tetrad or extended chords in a scale.\n\n``` swift\nlet c = Key(type: .c)\nlet maj: ScaleType = .major\nlet cMaj = Scale(type: maj, key: c)\n```\n\n#### `ChordType` and `Chord`\n\n- `ChordType` is a struct with `ChordPart`s which are building blocks of chords.\n- You can define any chord existing with `ChordType`.\n- Thirds, fifths, sixths, sevenths and extensions are parts of the `ChordType`. \n- Each of them also structs which conforms `ChordPart` protocol.\n- `Chord` defines chords with type and a root key.\n- You can generate notes of chord in any octave range.\n- You can generate inversions of any chord.\n\n``` swift\nlet m13 = ChordType(\n  third: .minor,\n  seventh: .dominant,\n  extensions: [\n    ChordExtensionType(type: .thirteenth)\n  ])\nlet cm13 = Chord(type: m13, key: Key(type: .c))\n```\n\n- You can generate chord progressions with `ChordProgression` enum.\n- For any scale, in any harmonic field, for any inversion.\n\n``` swift\nlet progression = ChordProgression.i_ii_vi_iv\nlet cSharpHarmonicMinorTriadsProgression = progression.chords(\n  for: cSharpHarmonicMinor,\n  harmonicField: .triad,\n  inversion: 0)\n```\n\n#### `Tempo` and `TimeSignature`\n\n- Tempo is a helper struct to define timings in your music app.\n- TimeSignature is number of beats in per measure and `NoteValue` of each beat.\n- You can calculate notes duration in any tempo by ther `NoteValue`.\n- Note value defines the note's duration in a beat. It could be whole note, half note, quarter note, 8th, 16th or 32nd note.\n\n\n#### `HarmonicFunctions`\n\n- Harmonic functions is a utility for finding related notes or chords in a scale when composing.\n- You can create recommendation engines or chord generators with that.\n\nPlaygrounds\n----\n\n- You can experiment with the library right away in the Xcode Playgrounds!\n- After cloning the project, build it for the Mac target,\n- Go to playground page in the project,\n- Make sure the macOS platform is selected,\n- And make sure the \"Build Active Scheme\" option is selected in the playground settings.\n- There are some recipes ready in the playground page, you can just run them right away. \n\nDocumentation\n----\n\n[Full documentation is here](https://cemolcay.github.io/MusicTheory/)\n\nUnit Tests\n----\n\nYou can find unit tests in `MusicTheoryTests` target.  \nPress `⌘+U` for running tests.\n\nAppStore\n----\n\nThis library battle tested in my apps for iOS, macOS, watchOS and tvOS, check them out!  \n[KeyBud](https://itunes.apple.com/us/app/keybud-music-theory-app/id1203856335?mt=8) (iOS, watchOS, tvOS, macOS)  \n[FretBud](https://itunes.apple.com/us/app/fretbud-chord-scales-for-guitar-bass-and-more/id1234224249?mt=8) (iOS, watchOS, tvOS)  \n[ChordBud](https://itunes.apple.com/us/app/chordbud-chord-progressions/id1313017378?mt=8) (iOS)  \n[ArpBud](https://itunes.apple.com/us/app/arpbud-midi-sequencer-more/id1349342326?ls=1\u0026mt=8) (iOS)  \n[ScaleBud](https://itunes.apple.com/us/app/scalebud-auv3-midi-keyboard/id1409125865?ls=1\u0026mt=8) (iOS, AUv3, M1)  \n[StepBud](https://itunes.apple.com/us/app/stepbud-auv3-midi-sequencer/id1453104408?mt=8) (iOS, AUv3, M1)  \n[RhythmBud](https://apps.apple.com/us/app/rhythmbud-auv3-midi-fx/id1484320891#) (iOS, AUv3, M1)  \n[ArpBud 2](https://apps.apple.com/us/app/arpbud-2-auv3-midi-arpeggiator/id1500403326) (iOS, AUv3, M1)  \n[ChordBud 2](https://apps.apple.com/us/app/chordbud-2-auv3-midi-sequencer/id1526221230) (iOS, AUv3, M1)  \n[LoopBud](https://apps.apple.com/us/app/loopbud-auv3-midi-recorder/id1554773709) (iOS, AUv3, M1)  \n[Euclid Goes to Party](https://apps.apple.com/us/app/euclid-goes-to-party-auv3-bass/id1565732327) (iOS, AUv3, M1)  \n[SnakeBud](https://apps.apple.com/us/app/snakebud-auv3-midi-sequencer/id1568600625) (iOS, AUv3, M1)  \n[MelodyBud](https://apps.apple.com/us/app/melodybud-auv3-midi-sequencer/id1601357369) (iOS, AUv3, M1)  \n[ScaleBud 2](https://apps.apple.com/us/app/scalebud-2-auv3-midi-keyboard/id1605842538) (iOS, AUv3, M1)  \n[ShiftBud](https://apps.apple.com/us/app/shiftbud-generative-midi-auv3/id1616169031) (iOS, AUv3, M1)  \n[PolyBud](https://apps.apple.com/us/app/polybud-polyrhythmic-sequencer/id1624211288) (iOS, AUv3, M1)  \n[PatternBud](https://apps.apple.com/us/app/patternbud-midi-cc-sequencer/id1608966928) (iOS, AUv3, M1)  \n[MIDI Motion](https://apps.apple.com/us/app/midi-motion-for-apple-watch/id6444314230) (iOS, watchOS)  \n[Textquencer](https://apps.apple.com/us/app/textquencer-auv3-midi/id1661316322) (iOS, AUv3, M1)  \n[In Theory](https://apps.apple.com/us/app/in-theory-interval-keyboard/id1667984658) (iOS, AUv3, M1)  \n[BrainBud](https://apps.apple.com/us/app/brainbud-bud-app-controller/id6446066258) (iOS, AUv3, M1)  \n[Binarhythmic](https://apps.apple.com/us/app/binarhythmic-rhythm-generator/id6447797078) (iOS, AUv3, M1)  \n[Auto Bass](https://apps.apple.com/us/app/auto-bass-auv3-midi-generator/id6450610419) (iOS, AUv3, M1)  \n[BounceBud](https://apps.apple.com/us/app/bouncebud-physics-based-midi/id6464171933) (iOS, AUv3, M1)  \n[MuseBud](https://apps.apple.com/us/app/musebud-auv3-midi-generator/id6472487197) (iOS, AUv3, M1)  \n[Auto Fills](https://apps.apple.com/us/app/auto-fills-drum-fill-generator/id6476319733) (iOS, AUv3, M1)  \n[Kebarp](https://apps.apple.com/us/app/kebarp-auv3-midi-arpeggiator/id6479562640) (iOS, AUv3, M1)  \n[FuncBud](https://apps.apple.com/us/app/funcbud-generative-sequencer/id6502771916) (iOS, AUv3, M1)  \n[Note to Be](https://apps.apple.com/us/app/note-to-be-midi-quantizer/id6596771972) (iOS, AUv3, M1)  \n[Harmonicc](https://apps.apple.com/us/app/harmonicc-chord-sequencer-auv3/id6692624491) (iOS, AUv3, M1)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemolcay%2FMusicTheory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcemolcay%2FMusicTheory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcemolcay%2FMusicTheory/lists"}