Harmonex

logo

Travis CI build status Hex release

This is a collection of tools for music theory called Harmonex (pronounced “harmonics”).

See what’s changed lately by reading the project history.

Usage

What can you do with Harmonex? Its functions can answer textbook music theory questions such as:

  • [x] Are C♯ and D♭ enharmonically equivalent pitches?
    Answer: Harmonex.Pitch.enharmonic?(:c_sharp, :d_flat) == true
  • [x] What are the enharmonic equivalents of F𝄪?
    Answer: Harmonex.Pitch.enharmonics(:f_double_sharp) == [:g_natural, :a_double_flat]
  • [x] How far apart, in semitones, are the pitches A♭ and D♯?
    Answer: Harmonex.Pitch.semitones(:a_flat, :d_sharp) == 7
  • [x] What is the quality and number of the interval between the pitches F♮ and B𝄫?
    Answer: Harmonex.Pitch.interval_diatonic(:f, :b_double_flat) == {:diminished, 4}
  • [ ] What is the key signature of the modal key G Locrian?
    Answer: four flats — B♭, E♭, A♭, and D♭.
  • [ ] What keys and modes have the signature of three sharps?
    Answer: A major/Ionian, B Dorian, C♯ Phrygian, D Lydian, E Mixolydian, F♯ minor/Aeolian, and G♯ Locrian.
  • [ ] Does A♮ occur diatonically in the key of E♭ minor?
    Answer: no.
  • [ ] What are the pitches of the simplest voicing of a D♭ minor triad in second inversion?
    Answer: A♭, D♭, and F♭.
  • [ ] What is the name and inversion of the chord described by the pitches C♮, F♯, and A♮?
    Answer: F♯ diminished triad in second inversion.
    of the chord described by A♭, C, and F♯?
    Answer: A♭ Italian sixth.
    of the chord described by B, D♯, E, and G♯?
    Answer: E major seventh in second inversion.
  • [ ] What are the jazz chart symbols of the chords just mentioned?
    Answer: FO/A♭, A♭7(no 5), and E△7/B.
  • [ ] What is the functional-harmonic symbol of the chord described by the pitches C♮, F♯, and A♮ in C major?
    Answer: viiO/V.
    of the chord described by A♭, C, and F♯ in C minor?
    Answer: It6.
    of the chord described by B, D♯, E, and G♯ in E major?
    Answer: I7.

Harmonex also will have functions for exploring compositional questions such as:

  • [ ] What is the set of triads and seventh chords, including enharmonic equivalents of same, that the keys of B Mixolydian and D Lydian have in common?
  • [ ] What is the set of seventh chords, including enharmonic equivalents, that are within one degree of difference (by shifting one note by a half or whole step) from an F major seventh chord? within two degrees? three? four?
  • [ ] What are sets of three-chord changes for modulating from the key of D minor to F♯ major? sets of four-chord changes? sets of five-chord changes?

Installation

Install the Hex package by adding :harmonex to the list of dependencies in your project’s mix.exs file:

# mix.exs

# ...
def deps do
  [{:harmonex, "~> 0.1.0"}]
end
# ...

Contributing

To submit a patch to the project:

  1. Fork the official repository.
  2. Create your feature branch: git checkout -b my-new-feature.
  3. Commit your changes: git commit -am 'Add some feature'.
  4. Push to the branch: git push origin my-new-feature.
  5. Create a new pull request.

After cloning the repository, mix deps.get to install dependencies. Then mix test to run the tests. You can also iex to get an interactive prompt that will allow you to experiment. To build this package, mix hex.build.

To release a new version:

  1. Update the “Installation” section of this readme to reference the new version, and commit.
  2. Update the project history in History.md, and commit.
  3. Update the version number in mix.exs, and commit.
  4. Tag the commit and push commits and tags.
  5. Build and publish the Hex package with mix hex.publish.

License

Released under the MIT License.