Giter Club home page Giter Club logo

musictheory's Introduction

MusicTheory

A music theory library for Swift OS X and iOS apps.

MusicTheory provides objects to work with musical keys, notes, scales and chords. It can be used to generate a scale from a key or note symbol, or a chord from a key and a chord degree for example. You can also use it to translate a sequence of notes to a sequence of MIDI values.

Installation

CocoaPods

Put this in your Podfile:

pod "MusicTheory", "~> 1.1"

Usage:

let cFlat = Note(name: "C♭")

let cFlatMinorScale = cFlat.scale("minor")

cFlatMinorScale.names // ["C♭", "D♭", "E♭♭", "F♭", "G♭", "A♭♭", "B♭♭"]
cFlatMinorScale.values // [59, 61, 62, 64, 66, 67, 69]

let cFlatMinChord = Chord(root: cFlat, type: "min") // or cFlat.chord("min")

cFlatMinChord.names // ["C♭", "E♭♭", "G♭"]
cFlatMinChord.values // [59, 62, 66]

let cFlatMajor = Key(note: cFlat, quality: "major")
let cFlatV7 = cFlatMajor.chord("V", type: "7")!

cFlatV7.name // "G♭7"
cFlatV7.notes.map { $0.name } // ["G♭", "B♭", "D♭", "F♭"]

For a list of all supported chord types see: Sources/Music.swift

For more usage examples see: Tests/MusicTheoryTests.swift

Contributing

Improvements are always welcome. Please follow these steps to contribute:

  1. Submit a Pull Request with a detailed explanation of changes and tests
  2. Receive a 👍 from a core team member
  3. Core team will merge your changes

License

See LICENSE.

musictheory's People

Contributors

danielbreves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

musictheory's Issues

Structs instead of Dicts?

I'm wondering if it would be beneficial to change the design for mapping scales, chords, etc., from dictionaries to structs. What do you think?

I'm using Xcode 8.1 and Swift 3.

Is your circle of fifths definition correct?

public static let CircleOfFifths = [
"major": ["C", "G", "D", "A", "E", "B", "F♯", "C♯", "F", "B♭", "E♭", "A♭", "D♭", "G♭", "C♭"],
"minor": ["A", "E", "B", "F♯", "C♯", "G♯", "D♯", "A♯", "D", "G", "C", "F", "B♭", "E♭", "A♭"]
]

In your definition, it goes from B to F#, a fifth, F# then moves to C#, a fifth, C# then moves to F, a major third

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.