-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7009045
commit 9633577
Showing
24 changed files
with
1,236 additions
and
1,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/main/kotlin/org/harris/collectionExtensions/Collections.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package org.harris | ||
|
||
inline fun <T> Array<T>.rotate(n: Int) = | ||
let { sliceArray(n until size) + sliceArray(0 until n) } | ||
inline fun <T> Array<T>.rotate(n: Int) = let { sliceArray(n until size) + sliceArray(0 until n) } | ||
|
||
inline fun <reified T> Array<T>.moveElement(fromIndex: Int, toIndex: Int): Array<T> = | ||
toMutableList().apply { add(toIndex, removeAt(fromIndex)) }.toTypedArray() | ||
inline fun <reified T> Array<T>.moveElement( | ||
fromIndex: Int, | ||
toIndex: Int, | ||
): Array<T> = toMutableList().apply { add(toIndex, removeAt(fromIndex)) }.toTypedArray() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
package org.harris.notes | ||
|
||
import org.harris.notes.NoteDuration.Whole | ||
import org.harris.scales.Scale | ||
import org.harris.scales.ScaleDegree | ||
import org.harris.scales.ScalePattern | ||
|
||
data class Note( | ||
private val pitch: Pitch, | ||
private val noteInScale: NoteInScale = NoteInScale.chromaticNote(pitch), | ||
private val duration: NoteDuration = Whole | ||
) { | ||
|
||
fun flat(): Note = Note(pitch.flat(), NoteInScale.chromaticNote(pitch), duration) | ||
|
||
fun sharp(): Note = Note(pitch.sharp(), NoteInScale.chromaticNote(pitch), duration) | ||
|
||
fun above(): Note = Note(noteInScale.abovePitch(), noteInScale.above(), duration) | ||
|
||
fun below(): Note = Note(noteInScale.belowPitch(), noteInScale.below(), duration) | ||
} | ||
|
||
data class NoteInScale(val scalePattern: ScalePattern, val root: Pitch, val degree: ScaleDegree) { | ||
|
||
fun root(): Pitch = root | ||
|
||
fun above(): NoteInScale = NoteInScale(scalePattern, root, degree.above()) | ||
fun below(): NoteInScale = NoteInScale(scalePattern, root, degree.below()) | ||
|
||
fun abovePitch(): Pitch = Scale(scalePattern, root).pitch(degree.above()) | ||
fun belowPitch(): Pitch = Scale(scalePattern, root).pitch(degree.below()) | ||
|
||
companion object { | ||
fun chromaticNote(pitch: Pitch): NoteInScale { | ||
return NoteInScale(ScalePattern.Chromatic, pitch, ScaleDegree.I) | ||
} | ||
} | ||
} | ||
package org.harris.notes | ||
|
||
import org.harris.notes.NoteDuration.Whole | ||
import org.harris.scales.Scale | ||
import org.harris.scales.ScaleDegree | ||
import org.harris.scales.ScalePattern | ||
|
||
data class Note( | ||
private val pitch: Pitch, | ||
private val noteInScale: NoteInScale = NoteInScale.chromaticNote(pitch), | ||
private val duration: NoteDuration = Whole, | ||
) { | ||
fun flat(): Note = Note(pitch.flat(), NoteInScale.chromaticNote(pitch), duration) | ||
|
||
fun sharp(): Note = Note(pitch.sharp(), NoteInScale.chromaticNote(pitch), duration) | ||
|
||
fun above(): Note = Note(noteInScale.abovePitch(), noteInScale.above(), duration) | ||
|
||
fun below(): Note = Note(noteInScale.belowPitch(), noteInScale.below(), duration) | ||
} | ||
|
||
data class NoteInScale(val scalePattern: ScalePattern, val root: Pitch, val degree: ScaleDegree) { | ||
fun root(): Pitch = root | ||
|
||
fun above(): NoteInScale = NoteInScale(scalePattern, root, degree.above()) | ||
|
||
fun below(): NoteInScale = NoteInScale(scalePattern, root, degree.below()) | ||
|
||
fun abovePitch(): Pitch = Scale(scalePattern, root).pitch(degree.above()) | ||
|
||
fun belowPitch(): Pitch = Scale(scalePattern, root).pitch(degree.below()) | ||
|
||
companion object { | ||
fun chromaticNote(pitch: Pitch): NoteInScale { | ||
return NoteInScale(ScalePattern.Chromatic, pitch, ScaleDegree.I) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.