https://github.com/andy671/musictheory
Music Theory Library for Java and Android apps
https://github.com/andy671/musictheory
android chords java music-theory notes scale
Last synced: 3 months ago
JSON representation
Music Theory Library for Java and Android apps
- Host: GitHub
- URL: https://github.com/andy671/musictheory
- Owner: Andy671
- License: mit
- Created: 2017-01-27T08:23:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-08T09:53:44.000Z (about 8 years ago)
- Last Synced: 2023-10-20T09:24:55.739Z (almost 2 years ago)
- Topics: android, chords, java, music-theory, notes, scale
- Language: Java
- Homepage:
- Size: 1.3 MB
- Stars: 25
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Music Theory
[](https://opensource.org/licenses/MIT)
[](https://www.oracle.com/index.html)## Introduction
Java music theory library inspired by the [Music Theory Library for Swift OS X and iOS apps.](https://github.com/danielbreves/MusicTheory).
I am still working on it, so it will become better eventually.
Project uses Java 1.7, so you can use it in your Android projects without any problems.## Installation
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
```gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Step 2. Add the dependency
```gradle
dependencies {
compile 'com.github.Andy671:MusicTheory:v0.6.4'
}
```## Usage
```java
Note dSharpNote = new Note("D#");
System.out.println(dSharpNote); // D#4[63]dSharpNote = new Note("D#", 5);
System.out.println(dSharpNote); // D#5[75]Chord dSharpm7Chord = dSharpNote.chord("m7");
System.out.println(dSharpm7Chord); // D#m7 inversion[0] {D#5[75], F#5[78], A#5[82], C#6[85]}Scale dSharpScale = dSharpNote.scale("minor");
System.out.println(dSharpScale); // D# minor scale {D#5[75], E#5[77], F#5[78], G#5[80], A#5[82], B5[83], C#6[85]}Key cFlatMajorKey = new Key("Cb", "major");
System.out.println(cFlatMajorKey); // Cb major keyChord thirdFlatDegreeAugChord = cFlatMajorKey.chord("bIII", "aug");
System.out.println(thirdFlatDegreeAugChord); // Ebbaug inversion[0] {Ebb4[62], Gb4[66], Bb4[70]}thirdFlatDegreeAugChord.setPosition(1);
System.out.println(thirdFlatDegreeAugChord); // Ebbaug inversion[1] {Bb5[82], Ebb4[62], Gb4[66]}thirdFlatDegreeAugChord.sort();
System.out.println(thirdFlatDegreeAugChord); // Ebbaug inversion[1] {Ebb4[62], Gb4[66], Bb5[82]}```
For more info check out JavaDoc in the source code
## Contribution
* Feel free to fork the repo, make pull requests or fix existing bug
* Feel free to open issues if you find some bug or unexpected behaviour