Skip to content

Instantly share code, notes, and snippets.

@jaredrummler
Created April 4, 2024 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredrummler/9e7e1a6b30e335b1e2f196c2a8e1310e to your computer and use it in GitHub Desktop.
Save jaredrummler/9e7e1a6b30e335b1e2f196c2a8e1310e to your computer and use it in GitHub Desktop.
Just playing around with music and didn't want to throw this away
// Add all chord types as properties to the MelodyDSL class with customizable durations
class MelodyDSL : DurationDSL {
// Define major chords as properties with customizable duration
fun chordMajor(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CMajor get() = chordMajor("CMajor", q, C4, E4, G4)
val DMajor get() = chordMajor("DMajor", q, D4, Fs4, A4)
val EMajor get() = chordMajor("EMajor", q, E4, Gs4, B4)
val FMajor get() = chordMajor("FMajor", q, F4, A4, C5)
val GMajor get() = chordMajor("GMajor", q, G4, B4, D5)
val AMajor get() = chordMajor("AMajor", q, A4, Cs5, E5)
val BMajor get() = chordMajor("BMajor", q, B4, Ds5, Fs5)
// Define minor chords as properties with customizable duration
fun chordMinor(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CMinor get() = chordMinor("CMinor", q, C4, Eb4, G4)
val DMinor get() = chordMinor("DMinor", q, D4, F4, A4)
val EMinor get() = chordMinor("EMinor", q, E4, G4, B4)
val FMinor get() = chordMinor("FMinor", q, F4, Ab4, C5)
val GMinor get() = chordMinor("GMinor", q, G4, Bb4, D5)
val AMinor get() = chordMinor("AMinor", q, A4, C5, E5)
val BMinor get() = chordMinor("BMinor", q, B4, D5, Fs5)
// Define diminished chords as properties with customizable duration
fun chordDiminished(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CDiminished get() = chordDiminished("CDiminished", q, C4, Eb4, Gb4)
val DDiminished get() = chordDiminished("DDiminished", q, D4, F4, Gs4)
val EDiminished get() = chordDiminished("EDiminished", q, E4, G4, Bb4)
val FDiminished get() = chordDiminished("FDiminished", q, F4, Ab4, B4)
val GDiminished get() = chordDiminished("GDiminished", q, G4, Bb4, Db5)
val ADiminished get() = chordDiminished("ADiminished", q, A4, C5, Eb5)
val BDiminished get() = chordDiminished("BDiminished", q, B4, D5, F5)
// Define augmented chords as properties with customizable duration
fun chordAugmented(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CAugmented get() = chordAugmented("CAugmented", q, C4, E4, Gs4)
val DAugmented get() = chordAugmented("DAugmented", q, D4, Fs4, A4)
val EAugmented get() = chordAugmented("EAugmented", q, E4, Gs4, B4)
val FAugmented get() = chordAugmented("FAugmented", q, F4, A4, C5)
val GAugmented get() = chordAugmented("GAugmented", q, G4, B4, Ds5)
val AAugmented get() = chordAugmented("AAugmented", q, A4, Cs5, E5)
val BAugmented get() = chordAugmented("BAugmented", q, B4, Ds5, Fs5)
// Define dominant seventh chords as properties with customizable duration
fun chordDominant7(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CDominant7 get() = chordDominant7("CDominant7", q, C4, E4, G4, Bb4)
val DDominant7 get() = chordDominant7("DDominant7", q, D4, Fs4, A4, C5)
val EDominant7 get() = chordDominant7("EDominant7", q, E4, Gs4, B4, D5)
val FDominant7 get() = chordDominant7("FDominant7", q, F4, A4, C5, Eb5)
val GDominant7 get() = chordDominant7("GDominant7", q, G4, B4, D5, F5)
val ADominant7 get() = chordDominant7("ADominant7", q, A4, Cs5, E5, G5)
val BDominant7 get() = chordDominant7("BDominant7", q, B4, Ds5, Fs5, A5)
// Define minor seventh chords as properties with customizable duration
fun chordMinor7(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CMinor7 get() = chordMinor7("CMinor7", q, C4, Eb4, G4, Bb4)
val DMinor7 get() = chordMinor7("DMinor7", q, D4, F4, A4, C5)
val EMinor7 get() = chordMinor7("EMinor7", q, E4, G4, B4, D5)
val FMinor7 get() = chordMinor7("FMinor7", q, F4, Ab4, C5, Eb5)
val GMinor7 get() = chordMinor7("GMinor7", q, G4, Bb4, D5, F5)
val AMinor7 get() = chordMinor7("AMinor7", q, A4, C5, E5, G5)
val BMinor7 get() = chordMinor7("BMinor7", q, B4, D5, Fs5, A5)
// Define suspended chords as properties with customizable duration
fun chordSuspended(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val CSuspended get() = chordSuspended("CSuspended", q, C4, F4, G4)
val DSuspended get() = chordSuspended("DSuspended", q, D4, G4, A4)
val ESuspended get() = chordSuspended("ESuspended", q, E4, A4, B4)
val FSuspended get() = chordSuspended("FSuspended", q, F4, Bb4, C5)
val GSuspended get() = chordSuspended("GSuspended", q, G4, C5, D5)
val ASuspended get() = chordSuspended("ASuspended", q, A4, D5, E5)
val BSuspended get() = chordSuspended("BSuspended", q, B4, E5, Fs5)
// Define extended chords as properties with customizable duration
fun chordExtended(name: String, duration: Duration, vararg notes: Note) =
chord(name) { notes.forEach { it.duration = duration }; notes.toList() }
val C9 get() = chordExtended("C9", q, C4, E4, G4, Bb4, D5)
val D9 get() = chordExtended("D9", q, D4, Fs4, A4, C5, E5)
val E9 get() = chordExtended("E9", q, E4, Gs4, B4, D5, Fs5)
val F9 get() = chordExtended("F9", q, F4, A4, C5, Eb5, G4)
val G9 get() = chordExtended("G9", q, G4, B4, D5, F4, A4)
val A9 get() = chordExtended("A9", q, A4, Cs5, E5, G5, C5)
val B9 get() = chordExtended("B9", q, B4, Ds5, Fs5, A5, D5)
// Rest of the chord properties...
}
// Define minor seventh chords as properties with customizable duration
val CMinor7 get() = chordMinor7("CMinor7", q, C4, Eb4, G4, Bb4)
val DMinor7 get() = chordMinor7("DMinor7", q, D4, F4, A4, C5)
val EMinor7 get() = chordMinor7("EMinor7", q, E4, G4, B4, D5)
val FMinor7 get() = chordMinor7("FMinor7", q, F4, Ab4, C5, Eb5)
val GMinor7 get() = chordMinor7("GMinor7", q, G4, Bb4, D5, F5)
val AMinor7 get() = chordMinor7("AMinor7", q, A4, C5, E5, G5)
val BMinor7 get() = chordMinor7("BMinor7", q, B4, D5, Fs5, A5)
// Define suspended chords as properties with customizable duration
val CSuspended get() = chordSuspended("CSuspended", q, C4, F4, G4)
val DSuspended get() = chordSuspended("DSuspended", q, D4, G4, A4)
val ESuspended get() = chordSuspended("ESuspended", q, E4, A4, B4)
val FSuspended get() = chordSuspended("FSuspended", q, F4, Bb4, C5)
val GSuspended get() = chordSuspended("GSuspended", q, G4, C5, D5)
val ASuspended get() = chordSuspended("ASuspended", q, A4, D5, E5)
val BSuspended get() = chordSuspended("BSuspended", q, B4, E5, Fs5)
// Define extended chords as properties with customizable duration
val C9 get() = chordExtended("C9", q, C4, E4, G4, Bb4, D5)
val D9 get() = chordExtended("D9", q, D4, Fs4, A4, C5, E5)
val E9 get() = chordExtended("E9", q, E4, Gs4, B4, D5, Fs5)
val F9 get() = chordExtended("F9", q, F4, A4, C5, Eb5, G4)
val G9 get() = chordExtended("G9", q, G4, B4, D5, F4, A4)
val A9 get() = chordExtended("A9", q, A4, Cs5, E5, G5, C5)
val B9 get() = chordExtended("B9", q, B4, Ds5, Fs5, A5, D5)
// Define minor ninth chords as properties with customizable duration
val CMinor9 get() = chordExtended("CMinor9", q, C4, Eb4, G4, Bb4, D5)
val DMinor9 get() = chordExtended("DMinor9", q, D4, F4, A4, C5, E5)
val EMinor9 get() = chordExtended("EMinor9", q, E4, G4, B4, D5, Fs5)
val FMinor9 get() = chordExtended("FMinor9", q, F4, Ab4, C5, Eb5, G5)
val GMinor9 get() = chordExtended("GMinor9", q, G4, Bb4, D5, F5, A5)
val AMinor9 get() = chordExtended("AMinor9", q, A4, C5, E5, G5, B5)
val BMinor9 get() = chordExtended("BMinor9", q, B4, D5, Fs5, A5, C6)
// Define augmented seventh chords as properties with customizable duration
val CAugmented7 get() = chordAugmented("CAugmented7", q, C4, E4, Gs4, Bb4)
val DAugmented7 get() = chordAugmented("DAugmented7", q, D4, Fs4, A4, C5)
val EAugmented7 get() = chordAugmented("EAugmented7", q, E4, Gs4, B4, Ds5)
val FAugmented7 get() = chordAugmented("FAugmented7", q, F4, A4, C5, E5)
val GAugmented7 get() = chordAugmented("GAugmented7", q, G4, B4, Ds5, F5)
val AAugmented7 get() = chordAugmented("AAugmented7", q, A4, Cs5, E5, G5)
val BAugmented7 get() = chordAugmented("BAugmented7", q, B4, Ds5, F5, A5)
// Define dominant seventh chords as properties with customizable duration
val C7 get() = chordDominant7("C7", q, C4, E4, G4, Bb4)
val D7 get() = chordDominant7("D7", q, D4, Fs4, A4, C5)
val E7 get() = chordDominant7("E7", q, E4, Gs4, B4, D5)
val F7 get() = chordDominant7("F7", q, F4, A4, C5, Eb5)
val G7 get() = chordDominant7("G7", q, G4, B4, D5, F5)
val A7 get() = chordDominant7("A7", q, A4, Cs5, E5, G5)
val B7 get() = chordDominant7("B7", q, B4, Ds5, Fs5, A5)
// Define half-diminished seventh chords as properties with customizable duration
val CHalfDiminished7 get() = chordHalfDiminished7("CHalfDiminished7", q, C4, Eb4, Gb4, Bb4)
val DHalfDiminished7 get() = chordHalfDiminished7("DHalfDiminished7", q, D4, F4, G4, C5)
val EHalfDiminished7 get() = chordHalfDiminished7("EHalfDiminished7", q, E4, G4, Bb4, D5)
val FHalfDiminished7 get() = chordHalfDiminished7("FHalfDiminished7", q, F4, Ab4, B4, Eb5)
val GHalfDiminished7 get() = chordHalfDiminished7("GHalfDiminished7", q, G4, Bb4, Db5, F5)
val AHalfDiminished7 get() = chordHalfDiminished7("AHalfDiminished7", q, A4, C5, Eb5, G5)
val BHalfDiminished7 get() = chordHalfDiminished7("BHalfDiminished7", q, B4, D5, F5, A5)
// Define diminished seventh chords as properties with customizable duration
val CDiminished7 get() = chordDiminished7("CDiminished7", q, C4, Eb4, Gb4, A4)
val DDiminished7 get() = chordDiminished7("DDiminished7", q, D4, F4, Ab4, B4)
val EDiminished7 get() = chordDiminished7("EDiminished7", q, E4, G4, Bb4, C5)
val FDiminished7 get() = chordDiminished7("FDiminished7", q, F4, Ab4, B4, D4)
val GDiminished7 get() = chordDiminished7("GDiminished7", q, G4, Bb4, Db5, D5)
val ADiminished7 get() = chordDiminished7("ADiminished7", q, A4, C5, Eb5, Gb5)
val BDiminished7 get() = chordDiminished7("BDiminished7", q, B4, D5, F5, Ab5)
// 160ed11c-c2c1-4ca1-b920-d9be32cbb791
package melody.dsl.v2
import kotlin.math.pow
import kotlin.time.DurationUnit
fun melody(block: MelodyDSL.() -> Unit) = MelodyDSL().also(block).melody()
data class Melody(
val tempo: PureTempo,
val meter: TimeSignature,
val elements: List<MelodyElement>
)
interface DurationDSL {
val w get() = Durations.WHOLE
val h get() = Durations.HALF
val q get() = Durations.QUARTER
val d get() = Durations.EIGHTH
}
class MelodyDSL : DurationDSL {
private val melody = mutableListOf<MelodyElement>()
val elements: List<MelodyElement> get() = melody.toList()
var tempo: PureTempo = PureTempo.default
var meter: TimeSignature = TimeSignature.default
fun melody() = Melody(tempo, meter, elements)
fun tempo(tempo: PureTempo) = apply {
this.tempo = tempo
}
fun meter(numerator: Int, denominator: Int) = meter(TimeSignature(numerator, denominator))
fun meter(meter: TimeSignature) = apply {
this.meter = meter
}
fun notes(block: NoteDSL.() -> Unit) = apply {
object : NoteDSL {
override fun defaultDuration(): Duration = inferredDuration
override fun collect(note: Note) {
melody.add(note)
}
}.apply(block)
}
fun chord(block: NoteDSL.() -> Unit) = chord(inferredDuration, block)
fun chord(duration: Duration = inferredDuration, block: NoteDSL.() -> Unit) = apply {
val notes = mutableListOf<Note>()
object : NoteDSL {
override fun defaultDuration(): Duration = inferredDuration
override fun collect(note: Note) {
notes.add(note)
}
}.apply(block)
melody.add(Chord(notes, duration))
}
private val inferredDuration by lazy {
when (meter.denominator) {
4 -> Durations.QUARTER
8 -> Durations.EIGHTH
16 -> Durations.SIXTEENTH
else -> Durations.QUARTER
}
}
}
interface Duration {
val quarters: Double
operator fun get(
unit: DurationUnit,
tempo: PureTempo = PureTempo.default,
meter: TimeSignature = TimeSignature.default
): Double {
val seconds = (60.0 / (tempo.bpm * meter.numerator)) * quarters
return when (unit) {
DurationUnit.MILLISECONDS -> seconds * 1000.0
DurationUnit.SECONDS -> seconds
DurationUnit.MINUTES -> seconds / 60.0
DurationUnit.HOURS -> seconds / (60.0 * 60.0)
DurationUnit.DAYS -> seconds / (60.0 * 60.0 * 24.0)
DurationUnit.NANOSECONDS -> seconds * 1_000_000_000.0
DurationUnit.MICROSECONDS -> seconds * 1_000_000.0
else -> throw IllegalArgumentException("Unsupported time unit: $unit")
}
}
fun millis(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return this[DurationUnit.MILLISECONDS, tempo, meter]
}
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return this[DurationUnit.SECONDS, tempo, meter]
}
}
enum class Durations(override val quarters: Double) : Duration {
WHOLE(4.0),
HALF(2.0),
QUARTER(1.0),
EIGHTH(0.5),
SIXTEENTH(0.25);
}
interface MelodyElement {
val duration: Duration
}
interface TonedPitch {
val pitch: Pitch
val octave: Int
operator fun get(octave: Int) = pitch[octave]
companion object {
fun create(pitch: Pitch, octave: Int) = object : TonedPitch {
override val pitch = pitch
override val octave = octave
}
}
}
data class Note(
override val pitch: Pitch,
override val duration: Duration,
override val octave: Int = DEFAULT_OCTAVE,
val tied: Duration? = null
) : TonedPitch, MelodyElement {
val frequency get() = pitch[octave]
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return duration.seconds(tempo, meter) + (tied?.seconds(tempo, meter) ?: 0.0)
}
companion object {
const val DEFAULT_OCTAVE = 4
}
}
data class Chord(val notes: List<Note>, override val duration: Duration) : MelodyElement {
fun contains(pitch: Pitch): Boolean {
return notes.any { it.pitch == pitch }
}
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return duration.seconds(tempo, meter)
}
override fun toString(): String {
return notes.joinToString(",") { it.pitch.symbol }
}
}
data class MeasureSeparator(override val duration: Durations = Durations.QUARTER) : MelodyElement {
override fun toString() = "|"
}
enum class Clef(val line: Int) {
TREBLE(2), // G Clef on the second line
BASS(4), // F Clef on the fourth line
}
data class TimeSignature(val numerator: Int, val denominator: Int) {
override fun toString(): String {
return "$numerator/$denominator"
}
companion object {
val default by lazy { TimeSignature(4, 4) }
}
}
sealed class Rest { // No inheritance from MelodyElement
abstract val duration: Durations
}
data class BasicRest(override val duration: Durations) : Rest()
//data class RepeatRest(val times: Int, val rest: Rest) : Rest() {
// override val duration: Duration
// get() = rest.duration * times
//}
interface PureTempo {
val bpm: Int
val seconds get() = 60.0 / bpm
val millis get() = 60000L / bpm
companion object {
val default by lazy {
object : PureTempo {
override val bpm = 100
}
}
}
}
interface Tempo : PureTempo {
val beatUnit: Durations
fun wholeNoteInMilliseconds(): Double {
return beatUnit.millis(this) * 4.0
}
}
enum class Tempos(override val bpm: Int, val range: IntRange) : PureTempo {
LARGHISSIMO(24, Int.MIN_VALUE..40), // Extremely Slow
GRAVE(40, 24..40), // Very Slow, Solemn
LARGO(44, 40..66), // Broad, Slow
LARGHETTO(60, 60..80), // Rather Slow, Broad
ADAGIO(70, 55..76), // Slow and Expressive
ADAGIETTO(75, 66..80), // Slower than Andante, Slightly Faster than Adagio
LENTO(72, 40..108), // Slowly
ANDANTE(90, 70..100), // Moderately Slow
MODERATO(112, 100..120), // Moderate
ALLEGRO(132, 120..156), // Fast
PRESTO(176, 160..200), // Very Fast
PRESTOSSIMO(200, 200..Int.MAX_VALUE); // Extremely Fast
}
enum class Pitch(
val symbol: String,
private val semitone: Int,
private val accidental: Accidental? = null
) {
C("C", 0),
C_SHARP("C#", 1, Accidental.SHARP),
D_FLAT("Db", 1, Accidental.FLAT),
D("D", 2),
D_SHARP("D#", 3, Accidental.SHARP),
E_FLAT("Eb", 3, Accidental.FLAT),
E("E", 4),
F("F", 5),
F_SHARP("F#", 6, Accidental.SHARP),
G_FLAT("Gb", 6, Accidental.FLAT),
G("G", 7),
G_SHARP("G#", 8, Accidental.SHARP),
A_FLAT("Ab", 8, Accidental.FLAT),
A("A", 9),
A_SHARP("A#", 10, Accidental.SHARP),
B_FLAT("Bb", 10, Accidental.FLAT),
B("B", 11);
enum class Accidental {
SHARP, FLAT
}
/**
* Gets the frequency of the pitch at the specified octave.
*
* @param octave The octave number.
* @return The frequency of the note at the specified octave.
*/
operator fun get(octave: Int): Double =
frequency(this, octave, accidental)
/**
* Component function to access the frequency at octave 0.
* @return The frequency of the note at octave 0.
*/
operator fun component0() = this[0]
/**
* Component function to access the frequency at octave 1.
* @return The frequency of the note at octave 1.
*/
operator fun component1() = this[1]
/**
* Component function to access the frequency at octave 2.
* @return The frequency of the note at octave 2.
*/
operator fun component2() = this[2]
/**
* Component function to access the frequency at octave 3.
* @return The frequency of the note at octave 3.
*/
operator fun component3() = this[3]
/**
* Component function to access the frequency at octave 4.
* @return The frequency of the note at octave 4.
*/
operator fun component4() = this[4]
/**
* Component function to access the frequency at octave 5.
* @return The frequency of the note at octave 5.
*/
operator fun component5() = this[5]
/**
* Component function to access the frequency at octave 6.
* @return The frequency of the note at octave 6.
*/
operator fun component6() = this[6]
/**
* Component function to access the frequency at octave 7.
* @return The frequency of the note at octave 7.
*/
operator fun component7() = this[7]
companion object {
private val cache = mutableMapOf<Triple<Int, Int, Accidental?>, Double>()
private const val OCTAVE_SIZE = 12
private const val A4_FREQUENCY = 440.0
private const val A_VALUE = 9
fun frequency(semitone: Int, octave: Int = 4, accidental: Accidental? = null): Double {
val key = Triple(semitone, octave, accidental)
return cache.getOrPut(key) {
val semitoneValue = when (accidental) {
Accidental.SHARP -> semitone + 1
Accidental.FLAT -> semitone - 1
else -> semitone
}
val semitoneDifference = (octave * OCTAVE_SIZE) + semitoneValue - A_VALUE
A4_FREQUENCY * 2.0.pow(semitoneDifference.toDouble() / OCTAVE_SIZE)
}
}
fun frequency(pitch: Pitch, octave: Int = 4, accidental: Accidental? = null): Double {
val adjustedSemitoneDifference = when (accidental) {
Accidental.SHARP -> pitch.semitone + 1
Accidental.FLAT -> pitch.semitone - 1
else -> pitch.semitone
}
val semitoneDifference = (octave * OCTAVE_SIZE) + adjustedSemitoneDifference - A_VALUE
return A4_FREQUENCY * 2.0.pow(semitoneDifference.toDouble() / OCTAVE_SIZE)
}
}
}
interface NoteDSL : DurationDSL {
companion object {
operator fun get(pitch: Pitch, duration: Duration, octave: Int, tied: Duration? = null) =
Note(pitch, duration, octave, tied)
operator fun get(tone: TonedPitch, duration: Duration) =
Note(tone.pitch, duration, tone.octave)
}
fun defaultDuration(): Duration
fun collect(note: Note)
fun C(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.C, duration, octave, tied]) }
fun Csharp(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.C_SHARP, duration, octave, tied]) }
fun Db(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.D_FLAT, duration, octave, tied]) }
fun D(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.D, duration, octave, tied]) }
fun Dsharp(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.D_SHARP, duration, octave, tied]) }
fun Eb(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.E_FLAT, duration, octave, tied]) }
fun E(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.E, duration, octave, tied]) }
fun F(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.F, duration, octave, tied]) }
fun Fsharp(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.F_SHARP, duration, octave, tied]) }
fun Gb(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.G_FLAT, duration, octave, tied]) }
fun G(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.G, duration, octave, tied]) }
fun Gsharp(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.G_SHARP, duration, octave, tied]) }
fun Ab(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.A_FLAT, duration, octave, tied]) }
fun A(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.A, duration, octave, tied]) }
fun Asharp(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.A_SHARP, duration, octave, tied]) }
fun Bb(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.B_FLAT, duration, octave, tied]) }
fun B(octave: Int, duration: Duration = defaultDuration(), tied: Duration? = null) =
apply { collect(NoteDSL[Pitch.B, duration, octave, tied]) }
val C get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 4]) }
val Csharp get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 4]) }
val Db get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 4]) }
val D get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 4]) }
val Dsharp get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 4]) }
val Eb get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 4]) }
val E get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 4]) }
val F get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 4]) }
val Fsharp get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 4]) }
val Gb get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 4]) }
val G get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 4]) }
val Gsharp get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 4]) }
val Ab get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 4]) }
val A get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 4]) }
val Asharp get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 4]) }
val Bb get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 4]) }
val B get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 4]) }
val C0 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 0]) }
val C1 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 1]) }
val C2 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 2]) }
val C3 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 3]) }
val C4 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 4]) }
val C5 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 5]) }
val C6 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 6]) }
val C7 get() = apply { collect(NoteDSL[Pitch.C, defaultDuration(), 7]) }
val Csharp0 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 0]) }
val Csharp1 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 1]) }
val Csharp2 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 2]) }
val Csharp3 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 3]) }
val Csharp4 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 4]) }
val Csharp5 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 5]) }
val Csharp6 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 6]) }
val Csharp7 get() = apply { collect(NoteDSL[Pitch.C_SHARP, defaultDuration(), 7]) }
val Db0 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 0]) }
val Db1 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 1]) }
val Db2 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 2]) }
val Db3 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 3]) }
val Db4 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 4]) }
val Db5 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 5]) }
val Db6 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 6]) }
val Db7 get() = apply { collect(NoteDSL[Pitch.D_FLAT, defaultDuration(), 7]) }
val D0 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 0]) }
val D1 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 1]) }
val D2 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 2]) }
val D3 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 3]) }
val D4 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 4]) }
val D5 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 5]) }
val D6 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 6]) }
val D7 get() = apply { collect(NoteDSL[Pitch.D, defaultDuration(), 7]) }
val Dsharp0 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 0]) }
val Dsharp1 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 1]) }
val Dsharp2 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 2]) }
val Dsharp3 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 3]) }
val Dsharp4 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 4]) }
val Dsharp5 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 5]) }
val Dsharp6 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 6]) }
val Dsharp7 get() = apply { collect(NoteDSL[Pitch.D_SHARP, defaultDuration(), 7]) }
val Eb0 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 0]) }
val Eb1 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 1]) }
val Eb2 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 2]) }
val Eb3 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 3]) }
val Eb4 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 4]) }
val Eb5 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 5]) }
val Eb6 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 6]) }
val Eb7 get() = apply { collect(NoteDSL[Pitch.E_FLAT, defaultDuration(), 7]) }
val E0 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 0]) }
val E1 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 1]) }
val E2 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 2]) }
val E3 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 3]) }
val E4 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 4]) }
val E5 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 5]) }
val E6 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 6]) }
val E7 get() = apply { collect(NoteDSL[Pitch.E, defaultDuration(), 7]) }
val F0 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 0]) }
val F1 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 1]) }
val F2 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 2]) }
val F3 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 3]) }
val F4 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 4]) }
val F5 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 5]) }
val F6 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 6]) }
val F7 get() = apply { collect(NoteDSL[Pitch.F, defaultDuration(), 7]) }
val Fsharp0 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 0]) }
val Fsharp1 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 1]) }
val Fsharp2 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 2]) }
val Fsharp3 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 3]) }
val Fsharp4 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 4]) }
val Fsharp5 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 5]) }
val Fsharp6 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 6]) }
val Fsharp7 get() = apply { collect(NoteDSL[Pitch.F_SHARP, defaultDuration(), 7]) }
val Gb0 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 0]) }
val Gb1 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 1]) }
val Gb2 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 2]) }
val Gb3 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 3]) }
val Gb4 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 4]) }
val Gb5 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 5]) }
val Gb6 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 6]) }
val Gb7 get() = apply { collect(NoteDSL[Pitch.G_FLAT, defaultDuration(), 7]) }
val G0 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 0]) }
val G1 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 1]) }
val G2 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 2]) }
val G3 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 3]) }
val G4 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 4]) }
val G5 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 5]) }
val G6 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 6]) }
val G7 get() = apply { collect(NoteDSL[Pitch.G, defaultDuration(), 7]) }
val Gsharp0 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 0]) }
val Gsharp1 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 1]) }
val Gsharp2 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 2]) }
val Gsharp3 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 3]) }
val Gsharp4 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 4]) }
val Gsharp5 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 5]) }
val Gsharp6 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 6]) }
val Gsharp7 get() = apply { collect(NoteDSL[Pitch.G_SHARP, defaultDuration(), 7]) }
val Ab0 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 0]) }
val Ab1 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 1]) }
val Ab2 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 2]) }
val Ab3 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 3]) }
val Ab4 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 4]) }
val Ab5 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 5]) }
val Ab6 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 6]) }
val Ab7 get() = apply { collect(NoteDSL[Pitch.A_FLAT, defaultDuration(), 7]) }
val A0 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 0]) }
val A1 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 1]) }
val A2 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 2]) }
val A3 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 3]) }
val A4 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 4]) }
val A5 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 5]) }
val A6 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 6]) }
val A7 get() = apply { collect(NoteDSL[Pitch.A, defaultDuration(), 7]) }
val Asharp0 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 0]) }
val Asharp1 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 1]) }
val Asharp2 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 2]) }
val Asharp3 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 3]) }
val Asharp4 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 4]) }
val Asharp5 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 5]) }
val Asharp6 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 6]) }
val Asharp7 get() = apply { collect(NoteDSL[Pitch.A_SHARP, defaultDuration(), 7]) }
val Bb0 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 0]) }
val Bb1 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 1]) }
val Bb2 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 2]) }
val Bb3 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 3]) }
val Bb4 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 4]) }
val Bb5 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 5]) }
val Bb6 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 6]) }
val Bb7 get() = apply { collect(NoteDSL[Pitch.B_FLAT, defaultDuration(), 7]) }
val B0 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 0]) }
val B1 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 1]) }
val B2 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 2]) }
val B3 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 3]) }
val B4 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 4]) }
val B5 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 5]) }
val B6 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 6]) }
val B7 get() = apply { collect(NoteDSL[Pitch.B, defaultDuration(), 7]) }
val Cw get() = apply { collect(NoteDSL[Pitch.C, w, 4]) }
val Csharpw get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 4]) }
val Dbw get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 4]) }
val Dw get() = apply { collect(NoteDSL[Pitch.D, w, 4]) }
val Dsharpw get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 4]) }
val Ebw get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 4]) }
val Ew get() = apply { collect(NoteDSL[Pitch.E, w, 4]) }
val Fw get() = apply { collect(NoteDSL[Pitch.F, w, 4]) }
val Fsharpw get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 4]) }
val Gbw get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 4]) }
val Gw get() = apply { collect(NoteDSL[Pitch.G, w, 4]) }
val Gsharpw get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 4]) }
val Abw get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 4]) }
val Aw get() = apply { collect(NoteDSL[Pitch.A, w, 4]) }
val Asharpw get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 4]) }
val Bbw get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 4]) }
val Bw get() = apply { collect(NoteDSL[Pitch.B, w, 4]) }
val C0w get() = apply { collect(NoteDSL[Pitch.C, w, 0]) }
val C1w get() = apply { collect(NoteDSL[Pitch.C, w, 1]) }
val C2w get() = apply { collect(NoteDSL[Pitch.C, w, 2]) }
val C3w get() = apply { collect(NoteDSL[Pitch.C, w, 3]) }
val C4w get() = apply { collect(NoteDSL[Pitch.C, w, 4]) }
val C5w get() = apply { collect(NoteDSL[Pitch.C, w, 5]) }
val C6w get() = apply { collect(NoteDSL[Pitch.C, w, 6]) }
val C7w get() = apply { collect(NoteDSL[Pitch.C, w, 7]) }
val Csharp0w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 0]) }
val Csharp1w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 1]) }
val Csharp2w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 2]) }
val Csharp3w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 3]) }
val Csharp4w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 4]) }
val Csharp5w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 5]) }
val Csharp6w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 6]) }
val Csharp7w get() = apply { collect(NoteDSL[Pitch.C_SHARP, w, 7]) }
val Db0w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 0]) }
val Db1w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 1]) }
val Db2w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 2]) }
val Db3w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 3]) }
val Db4w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 4]) }
val Db5w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 5]) }
val Db6w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 6]) }
val Db7w get() = apply { collect(NoteDSL[Pitch.D_FLAT, w, 7]) }
val D0w get() = apply { collect(NoteDSL[Pitch.D, w, 0]) }
val D1w get() = apply { collect(NoteDSL[Pitch.D, w, 1]) }
val D2w get() = apply { collect(NoteDSL[Pitch.D, w, 2]) }
val D3w get() = apply { collect(NoteDSL[Pitch.D, w, 3]) }
val D4w get() = apply { collect(NoteDSL[Pitch.D, w, 4]) }
val D5w get() = apply { collect(NoteDSL[Pitch.D, w, 5]) }
val D6w get() = apply { collect(NoteDSL[Pitch.D, w, 6]) }
val D7w get() = apply { collect(NoteDSL[Pitch.D, w, 7]) }
val Dsharp0w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 0]) }
val Dsharp1w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 1]) }
val Dsharp2w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 2]) }
val Dsharp3w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 3]) }
val Dsharp4w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 4]) }
val Dsharp5w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 5]) }
val Dsharp6w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 6]) }
val Dsharp7w get() = apply { collect(NoteDSL[Pitch.D_SHARP, w, 7]) }
val Eb0w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 0]) }
val Eb1w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 1]) }
val Eb2w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 2]) }
val Eb3w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 3]) }
val Eb4w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 4]) }
val Eb5w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 5]) }
val Eb6w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 6]) }
val Eb7w get() = apply { collect(NoteDSL[Pitch.E_FLAT, w, 7]) }
val E0w get() = apply { collect(NoteDSL[Pitch.E, w, 0]) }
val E1w get() = apply { collect(NoteDSL[Pitch.E, w, 1]) }
val E2w get() = apply { collect(NoteDSL[Pitch.E, w, 2]) }
val E3w get() = apply { collect(NoteDSL[Pitch.E, w, 3]) }
val E4w get() = apply { collect(NoteDSL[Pitch.E, w, 4]) }
val E5w get() = apply { collect(NoteDSL[Pitch.E, w, 5]) }
val E6w get() = apply { collect(NoteDSL[Pitch.E, w, 6]) }
val E7w get() = apply { collect(NoteDSL[Pitch.E, w, 7]) }
val F0w get() = apply { collect(NoteDSL[Pitch.F, w, 0]) }
val F1w get() = apply { collect(NoteDSL[Pitch.F, w, 1]) }
val F2w get() = apply { collect(NoteDSL[Pitch.F, w, 2]) }
val F3w get() = apply { collect(NoteDSL[Pitch.F, w, 3]) }
val F4w get() = apply { collect(NoteDSL[Pitch.F, w, 4]) }
val F5w get() = apply { collect(NoteDSL[Pitch.F, w, 5]) }
val F6w get() = apply { collect(NoteDSL[Pitch.F, w, 6]) }
val F7w get() = apply { collect(NoteDSL[Pitch.F, w, 7]) }
val Fsharp0w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 0]) }
val Fsharp1w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 1]) }
val Fsharp2w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 2]) }
val Fsharp3w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 3]) }
val Fsharp4w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 4]) }
val Fsharp5w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 5]) }
val Fsharp6w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 6]) }
val Fsharp7w get() = apply { collect(NoteDSL[Pitch.F_SHARP, w, 7]) }
val Gb0w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 0]) }
val Gb1w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 1]) }
val Gb2w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 2]) }
val Gb3w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 3]) }
val Gb4w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 4]) }
val Gb5w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 5]) }
val Gb6w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 6]) }
val Gb7w get() = apply { collect(NoteDSL[Pitch.G_FLAT, w, 7]) }
val G0w get() = apply { collect(NoteDSL[Pitch.G, w, 0]) }
val G1w get() = apply { collect(NoteDSL[Pitch.G, w, 1]) }
val G2w get() = apply { collect(NoteDSL[Pitch.G, w, 2]) }
val G3w get() = apply { collect(NoteDSL[Pitch.G, w, 3]) }
val G4w get() = apply { collect(NoteDSL[Pitch.G, w, 4]) }
val G5w get() = apply { collect(NoteDSL[Pitch.G, w, 5]) }
val G6w get() = apply { collect(NoteDSL[Pitch.G, w, 6]) }
val G7w get() = apply { collect(NoteDSL[Pitch.G, w, 7]) }
val Gsharp0w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 0]) }
val Gsharp1w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 1]) }
val Gsharp2w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 2]) }
val Gsharp3w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 3]) }
val Gsharp4w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 4]) }
val Gsharp5w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 5]) }
val Gsharp6w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 6]) }
val Gsharp7w get() = apply { collect(NoteDSL[Pitch.G_SHARP, w, 7]) }
val Ab0w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 0]) }
val Ab1w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 1]) }
val Ab2w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 2]) }
val Ab3w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 3]) }
val Ab4w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 4]) }
val Ab5w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 5]) }
val Ab6w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 6]) }
val Ab7w get() = apply { collect(NoteDSL[Pitch.A_FLAT, w, 7]) }
val A0w get() = apply { collect(NoteDSL[Pitch.A, w, 0]) }
val A1w get() = apply { collect(NoteDSL[Pitch.A, w, 1]) }
val A2w get() = apply { collect(NoteDSL[Pitch.A, w, 2]) }
val A3w get() = apply { collect(NoteDSL[Pitch.A, w, 3]) }
val A4w get() = apply { collect(NoteDSL[Pitch.A, w, 4]) }
val A5w get() = apply { collect(NoteDSL[Pitch.A, w, 5]) }
val A6w get() = apply { collect(NoteDSL[Pitch.A, w, 6]) }
val A7w get() = apply { collect(NoteDSL[Pitch.A, w, 7]) }
val Asharp0w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 0]) }
val Asharp1w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 1]) }
val Asharp2w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 2]) }
val Asharp3w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 3]) }
val Asharp4w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 4]) }
val Asharp5w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 5]) }
val Asharp6w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 6]) }
val Asharp7w get() = apply { collect(NoteDSL[Pitch.A_SHARP, w, 7]) }
val Bb0w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 0]) }
val Bb1w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 1]) }
val Bb2w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 2]) }
val Bb3w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 3]) }
val Bb4w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 4]) }
val Bb5w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 5]) }
val Bb6w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 6]) }
val Bb7w get() = apply { collect(NoteDSL[Pitch.B_FLAT, w, 7]) }
val B0w get() = apply { collect(NoteDSL[Pitch.B, w, 0]) }
val B1w get() = apply { collect(NoteDSL[Pitch.B, w, 1]) }
val B2w get() = apply { collect(NoteDSL[Pitch.B, w, 2]) }
val B3w get() = apply { collect(NoteDSL[Pitch.B, w, 3]) }
val B4w get() = apply { collect(NoteDSL[Pitch.B, w, 4]) }
val B5w get() = apply { collect(NoteDSL[Pitch.B, w, 5]) }
val B6w get() = apply { collect(NoteDSL[Pitch.B, w, 6]) }
val B7w get() = apply { collect(NoteDSL[Pitch.B, w, 7]) }
val Cq get() = apply { collect(NoteDSL[Pitch.C, q, 4]) }
val Csharpq get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 4]) }
val Dbq get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 4]) }
val Dq get() = apply { collect(NoteDSL[Pitch.D, q, 4]) }
val Dsharpq get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 4]) }
val Ebq get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 4]) }
val Eq get() = apply { collect(NoteDSL[Pitch.E, q, 4]) }
val Fq get() = apply { collect(NoteDSL[Pitch.F, q, 4]) }
val Fsharpq get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 4]) }
val Gbq get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 4]) }
val Gq get() = apply { collect(NoteDSL[Pitch.G, q, 4]) }
val Gsharpq get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 4]) }
val Abq get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 4]) }
val Aq get() = apply { collect(NoteDSL[Pitch.A, q, 4]) }
val Asharpq get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 4]) }
val Bbq get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 4]) }
val Bq get() = apply { collect(NoteDSL[Pitch.B, q, 4]) }
val C0q get() = apply { collect(NoteDSL[Pitch.C, q, 0]) }
val C1q get() = apply { collect(NoteDSL[Pitch.C, q, 1]) }
val C2q get() = apply { collect(NoteDSL[Pitch.C, q, 2]) }
val C3q get() = apply { collect(NoteDSL[Pitch.C, q, 3]) }
val C4q get() = apply { collect(NoteDSL[Pitch.C, q, 4]) }
val C5q get() = apply { collect(NoteDSL[Pitch.C, q, 5]) }
val C6q get() = apply { collect(NoteDSL[Pitch.C, q, 6]) }
val C7q get() = apply { collect(NoteDSL[Pitch.C, q, 7]) }
val Csharp0q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 0]) }
val Csharp1q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 1]) }
val Csharp2q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 2]) }
val Csharp3q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 3]) }
val Csharp4q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 4]) }
val Csharp5q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 5]) }
val Csharp6q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 6]) }
val Csharp7q get() = apply { collect(NoteDSL[Pitch.C_SHARP, q, 7]) }
val Db0q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 0]) }
val Db1q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 1]) }
val Db2q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 2]) }
val Db3q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 3]) }
val Db4q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 4]) }
val Db5q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 5]) }
val Db6q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 6]) }
val Db7q get() = apply { collect(NoteDSL[Pitch.D_FLAT, q, 7]) }
val D0q get() = apply { collect(NoteDSL[Pitch.D, q, 0]) }
val D1q get() = apply { collect(NoteDSL[Pitch.D, q, 1]) }
val D2q get() = apply { collect(NoteDSL[Pitch.D, q, 2]) }
val D3q get() = apply { collect(NoteDSL[Pitch.D, q, 3]) }
val D4q get() = apply { collect(NoteDSL[Pitch.D, q, 4]) }
val D5q get() = apply { collect(NoteDSL[Pitch.D, q, 5]) }
val D6q get() = apply { collect(NoteDSL[Pitch.D, q, 6]) }
val D7q get() = apply { collect(NoteDSL[Pitch.D, q, 7]) }
val Dsharp0q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 0]) }
val Dsharp1q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 1]) }
val Dsharp2q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 2]) }
val Dsharp3q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 3]) }
val Dsharp4q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 4]) }
val Dsharp5q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 5]) }
val Dsharp6q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 6]) }
val Dsharp7q get() = apply { collect(NoteDSL[Pitch.D_SHARP, q, 7]) }
val Eb0q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 0]) }
val Eb1q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 1]) }
val Eb2q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 2]) }
val Eb3q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 3]) }
val Eb4q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 4]) }
val Eb5q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 5]) }
val Eb6q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 6]) }
val Eb7q get() = apply { collect(NoteDSL[Pitch.E_FLAT, q, 7]) }
val E0q get() = apply { collect(NoteDSL[Pitch.E, q, 0]) }
val E1q get() = apply { collect(NoteDSL[Pitch.E, q, 1]) }
val E2q get() = apply { collect(NoteDSL[Pitch.E, q, 2]) }
val E3q get() = apply { collect(NoteDSL[Pitch.E, q, 3]) }
val E4q get() = apply { collect(NoteDSL[Pitch.E, q, 4]) }
val E5q get() = apply { collect(NoteDSL[Pitch.E, q, 5]) }
val E6q get() = apply { collect(NoteDSL[Pitch.E, q, 6]) }
val E7q get() = apply { collect(NoteDSL[Pitch.E, q, 7]) }
val F0q get() = apply { collect(NoteDSL[Pitch.F, q, 0]) }
val F1q get() = apply { collect(NoteDSL[Pitch.F, q, 1]) }
val F2q get() = apply { collect(NoteDSL[Pitch.F, q, 2]) }
val F3q get() = apply { collect(NoteDSL[Pitch.F, q, 3]) }
val F4q get() = apply { collect(NoteDSL[Pitch.F, q, 4]) }
val F5q get() = apply { collect(NoteDSL[Pitch.F, q, 5]) }
val F6q get() = apply { collect(NoteDSL[Pitch.F, q, 6]) }
val F7q get() = apply { collect(NoteDSL[Pitch.F, q, 7]) }
val Fsharp0q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 0]) }
val Fsharp1q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 1]) }
val Fsharp2q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 2]) }
val Fsharp3q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 3]) }
val Fsharp4q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 4]) }
val Fsharp5q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 5]) }
val Fsharp6q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 6]) }
val Fsharp7q get() = apply { collect(NoteDSL[Pitch.F_SHARP, q, 7]) }
val Gb0q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 0]) }
val Gb1q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 1]) }
val Gb2q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 2]) }
val Gb3q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 3]) }
val Gb4q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 4]) }
val Gb5q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 5]) }
val Gb6q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 6]) }
val Gb7q get() = apply { collect(NoteDSL[Pitch.G_FLAT, q, 7]) }
val G0q get() = apply { collect(NoteDSL[Pitch.G, q, 0]) }
val G1q get() = apply { collect(NoteDSL[Pitch.G, q, 1]) }
val G2q get() = apply { collect(NoteDSL[Pitch.G, q, 2]) }
val G3q get() = apply { collect(NoteDSL[Pitch.G, q, 3]) }
val G4q get() = apply { collect(NoteDSL[Pitch.G, q, 4]) }
val G5q get() = apply { collect(NoteDSL[Pitch.G, q, 5]) }
val G6q get() = apply { collect(NoteDSL[Pitch.G, q, 6]) }
val G7q get() = apply { collect(NoteDSL[Pitch.G, q, 7]) }
val Gsharp0q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 0]) }
val Gsharp1q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 1]) }
val Gsharp2q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 2]) }
val Gsharp3q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 3]) }
val Gsharp4q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 4]) }
val Gsharp5q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 5]) }
val Gsharp6q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 6]) }
val Gsharp7q get() = apply { collect(NoteDSL[Pitch.G_SHARP, q, 7]) }
val Ab0q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 0]) }
val Ab1q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 1]) }
val Ab2q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 2]) }
val Ab3q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 3]) }
val Ab4q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 4]) }
val Ab5q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 5]) }
val Ab6q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 6]) }
val Ab7q get() = apply { collect(NoteDSL[Pitch.A_FLAT, q, 7]) }
val A0q get() = apply { collect(NoteDSL[Pitch.A, q, 0]) }
val A1q get() = apply { collect(NoteDSL[Pitch.A, q, 1]) }
val A2q get() = apply { collect(NoteDSL[Pitch.A, q, 2]) }
val A3q get() = apply { collect(NoteDSL[Pitch.A, q, 3]) }
val A4q get() = apply { collect(NoteDSL[Pitch.A, q, 4]) }
val A5q get() = apply { collect(NoteDSL[Pitch.A, q, 5]) }
val A6q get() = apply { collect(NoteDSL[Pitch.A, q, 6]) }
val A7q get() = apply { collect(NoteDSL[Pitch.A, q, 7]) }
val Asharp0q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 0]) }
val Asharp1q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 1]) }
val Asharp2q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 2]) }
val Asharp3q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 3]) }
val Asharp4q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 4]) }
val Asharp5q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 5]) }
val Asharp6q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 6]) }
val Asharp7q get() = apply { collect(NoteDSL[Pitch.A_SHARP, q, 7]) }
val Bb0q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 0]) }
val Bb1q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 1]) }
val Bb2q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 2]) }
val Bb3q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 3]) }
val Bb4q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 4]) }
val Bb5q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 5]) }
val Bb6q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 6]) }
val Bb7q get() = apply { collect(NoteDSL[Pitch.B_FLAT, q, 7]) }
val B0q get() = apply { collect(NoteDSL[Pitch.B, q, 0]) }
val B1q get() = apply { collect(NoteDSL[Pitch.B, q, 1]) }
val B2q get() = apply { collect(NoteDSL[Pitch.B, q, 2]) }
val B3q get() = apply { collect(NoteDSL[Pitch.B, q, 3]) }
val B4q get() = apply { collect(NoteDSL[Pitch.B, q, 4]) }
val B5q get() = apply { collect(NoteDSL[Pitch.B, q, 5]) }
val B6q get() = apply { collect(NoteDSL[Pitch.B, q, 6]) }
val B7q get() = apply { collect(NoteDSL[Pitch.B, q, 7]) }
val Ch get() = apply { collect(NoteDSL[Pitch.C, h, 4]) }
val Csharph get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 4]) }
val Dbh get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 4]) }
val Dh get() = apply { collect(NoteDSL[Pitch.D, h, 4]) }
val Dsharph get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 4]) }
val Ebh get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 4]) }
val Eh get() = apply { collect(NoteDSL[Pitch.E, h, 4]) }
val Fh get() = apply { collect(NoteDSL[Pitch.F, h, 4]) }
val Fsharph get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 4]) }
val Gbh get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 4]) }
val Gh get() = apply { collect(NoteDSL[Pitch.G, h, 4]) }
val Gsharph get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 4]) }
val Abh get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 4]) }
val Ah get() = apply { collect(NoteDSL[Pitch.A, h, 4]) }
val Asharph get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 4]) }
val Bbh get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 4]) }
val Bh get() = apply { collect(NoteDSL[Pitch.B, h, 4]) }
val C0h get() = apply { collect(NoteDSL[Pitch.C, h, 0]) }
val C1h get() = apply { collect(NoteDSL[Pitch.C, h, 1]) }
val C2h get() = apply { collect(NoteDSL[Pitch.C, h, 2]) }
val C3h get() = apply { collect(NoteDSL[Pitch.C, h, 3]) }
val C4h get() = apply { collect(NoteDSL[Pitch.C, h, 4]) }
val C5h get() = apply { collect(NoteDSL[Pitch.C, h, 5]) }
val C6h get() = apply { collect(NoteDSL[Pitch.C, h, 6]) }
val C7h get() = apply { collect(NoteDSL[Pitch.C, h, 7]) }
val Csharp0h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 0]) }
val Csharp1h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 1]) }
val Csharp2h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 2]) }
val Csharp3h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 3]) }
val Csharp4h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 4]) }
val Csharp5h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 5]) }
val Csharp6h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 6]) }
val Csharp7h get() = apply { collect(NoteDSL[Pitch.C_SHARP, h, 7]) }
val Db0h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 0]) }
val Db1h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 1]) }
val Db2h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 2]) }
val Db3h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 3]) }
val Db4h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 4]) }
val Db5h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 5]) }
val Db6h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 6]) }
val Db7h get() = apply { collect(NoteDSL[Pitch.D_FLAT, h, 7]) }
val D0h get() = apply { collect(NoteDSL[Pitch.D, h, 0]) }
val D1h get() = apply { collect(NoteDSL[Pitch.D, h, 1]) }
val D2h get() = apply { collect(NoteDSL[Pitch.D, h, 2]) }
val D3h get() = apply { collect(NoteDSL[Pitch.D, h, 3]) }
val D4h get() = apply { collect(NoteDSL[Pitch.D, h, 4]) }
val D5h get() = apply { collect(NoteDSL[Pitch.D, h, 5]) }
val D6h get() = apply { collect(NoteDSL[Pitch.D, h, 6]) }
val D7h get() = apply { collect(NoteDSL[Pitch.D, h, 7]) }
val Dsharp0h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 0]) }
val Dsharp1h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 1]) }
val Dsharp2h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 2]) }
val Dsharp3h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 3]) }
val Dsharp4h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 4]) }
val Dsharp5h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 5]) }
val Dsharp6h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 6]) }
val Dsharp7h get() = apply { collect(NoteDSL[Pitch.D_SHARP, h, 7]) }
val Eb0h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 0]) }
val Eb1h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 1]) }
val Eb2h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 2]) }
val Eb3h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 3]) }
val Eb4h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 4]) }
val Eb5h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 5]) }
val Eb6h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 6]) }
val Eb7h get() = apply { collect(NoteDSL[Pitch.E_FLAT, h, 7]) }
val E0h get() = apply { collect(NoteDSL[Pitch.E, h, 0]) }
val E1h get() = apply { collect(NoteDSL[Pitch.E, h, 1]) }
val E2h get() = apply { collect(NoteDSL[Pitch.E, h, 2]) }
val E3h get() = apply { collect(NoteDSL[Pitch.E, h, 3]) }
val E4h get() = apply { collect(NoteDSL[Pitch.E, h, 4]) }
val E5h get() = apply { collect(NoteDSL[Pitch.E, h, 5]) }
val E6h get() = apply { collect(NoteDSL[Pitch.E, h, 6]) }
val E7h get() = apply { collect(NoteDSL[Pitch.E, h, 7]) }
val F0h get() = apply { collect(NoteDSL[Pitch.F, h, 0]) }
val F1h get() = apply { collect(NoteDSL[Pitch.F, h, 1]) }
val F2h get() = apply { collect(NoteDSL[Pitch.F, h, 2]) }
val F3h get() = apply { collect(NoteDSL[Pitch.F, h, 3]) }
val F4h get() = apply { collect(NoteDSL[Pitch.F, h, 4]) }
val F5h get() = apply { collect(NoteDSL[Pitch.F, h, 5]) }
val F6h get() = apply { collect(NoteDSL[Pitch.F, h, 6]) }
val F7h get() = apply { collect(NoteDSL[Pitch.F, h, 7]) }
val Fsharp0h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 0]) }
val Fsharp1h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 1]) }
val Fsharp2h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 2]) }
val Fsharp3h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 3]) }
val Fsharp4h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 4]) }
val Fsharp5h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 5]) }
val Fsharp6h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 6]) }
val Fsharp7h get() = apply { collect(NoteDSL[Pitch.F_SHARP, h, 7]) }
val Gb0h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 0]) }
val Gb1h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 1]) }
val Gb2h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 2]) }
val Gb3h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 3]) }
val Gb4h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 4]) }
val Gb5h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 5]) }
val Gb6h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 6]) }
val Gb7h get() = apply { collect(NoteDSL[Pitch.G_FLAT, h, 7]) }
val G0h get() = apply { collect(NoteDSL[Pitch.G, h, 0]) }
val G1h get() = apply { collect(NoteDSL[Pitch.G, h, 1]) }
val G2h get() = apply { collect(NoteDSL[Pitch.G, h, 2]) }
val G3h get() = apply { collect(NoteDSL[Pitch.G, h, 3]) }
val G4h get() = apply { collect(NoteDSL[Pitch.G, h, 4]) }
val G5h get() = apply { collect(NoteDSL[Pitch.G, h, 5]) }
val G6h get() = apply { collect(NoteDSL[Pitch.G, h, 6]) }
val G7h get() = apply { collect(NoteDSL[Pitch.G, h, 7]) }
val Gsharp0h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 0]) }
val Gsharp1h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 1]) }
val Gsharp2h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 2]) }
val Gsharp3h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 3]) }
val Gsharp4h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 4]) }
val Gsharp5h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 5]) }
val Gsharp6h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 6]) }
val Gsharp7h get() = apply { collect(NoteDSL[Pitch.G_SHARP, h, 7]) }
val Ab0h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 0]) }
val Ab1h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 1]) }
val Ab2h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 2]) }
val Ab3h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 3]) }
val Ab4h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 4]) }
val Ab5h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 5]) }
val Ab6h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 6]) }
val Ab7h get() = apply { collect(NoteDSL[Pitch.A_FLAT, h, 7]) }
val A0h get() = apply { collect(NoteDSL[Pitch.A, h, 0]) }
val A1h get() = apply { collect(NoteDSL[Pitch.A, h, 1]) }
val A2h get() = apply { collect(NoteDSL[Pitch.A, h, 2]) }
val A3h get() = apply { collect(NoteDSL[Pitch.A, h, 3]) }
val A4h get() = apply { collect(NoteDSL[Pitch.A, h, 4]) }
val A5h get() = apply { collect(NoteDSL[Pitch.A, h, 5]) }
val A6h get() = apply { collect(NoteDSL[Pitch.A, h, 6]) }
val A7h get() = apply { collect(NoteDSL[Pitch.A, h, 7]) }
val Asharp0h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 0]) }
val Asharp1h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 1]) }
val Asharp2h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 2]) }
val Asharp3h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 3]) }
val Asharp4h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 4]) }
val Asharp5h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 5]) }
val Asharp6h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 6]) }
val Asharp7h get() = apply { collect(NoteDSL[Pitch.A_SHARP, h, 7]) }
val Bb0h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 0]) }
val Bb1h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 1]) }
val Bb2h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 2]) }
val Bb3h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 3]) }
val Bb4h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 4]) }
val Bb5h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 5]) }
val Bb6h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 6]) }
val Bb7h get() = apply { collect(NoteDSL[Pitch.B_FLAT, h, 7]) }
val B0h get() = apply { collect(NoteDSL[Pitch.B, h, 0]) }
val B1h get() = apply { collect(NoteDSL[Pitch.B, h, 1]) }
val B2h get() = apply { collect(NoteDSL[Pitch.B, h, 2]) }
val B3h get() = apply { collect(NoteDSL[Pitch.B, h, 3]) }
val B4h get() = apply { collect(NoteDSL[Pitch.B, h, 4]) }
val B5h get() = apply { collect(NoteDSL[Pitch.B, h, 5]) }
val B6h get() = apply { collect(NoteDSL[Pitch.B, h, 6]) }
val B7h get() = apply { collect(NoteDSL[Pitch.B, h, 7]) }
val Cd get() = apply { collect(NoteDSL[Pitch.C, d, 4]) }
val Csharpd get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 4]) }
val Dbd get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 4]) }
val Dd get() = apply { collect(NoteDSL[Pitch.D, d, 4]) }
val Dsharpd get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 4]) }
val Ebd get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 4]) }
val Ed get() = apply { collect(NoteDSL[Pitch.E, d, 4]) }
val Fd get() = apply { collect(NoteDSL[Pitch.F, d, 4]) }
val Fsharpd get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 4]) }
val Gbd get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 4]) }
val Gd get() = apply { collect(NoteDSL[Pitch.G, d, 4]) }
val Gsharpd get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 4]) }
val Abd get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 4]) }
val Ad get() = apply { collect(NoteDSL[Pitch.A, d, 4]) }
val Asharpd get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 4]) }
val Bbd get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 4]) }
val Bd get() = apply { collect(NoteDSL[Pitch.B, d, 4]) }
val C0d get() = apply { collect(NoteDSL[Pitch.C, d, 0]) }
val C1d get() = apply { collect(NoteDSL[Pitch.C, d, 1]) }
val C2d get() = apply { collect(NoteDSL[Pitch.C, d, 2]) }
val C3d get() = apply { collect(NoteDSL[Pitch.C, d, 3]) }
val C4d get() = apply { collect(NoteDSL[Pitch.C, d, 4]) }
val C5d get() = apply { collect(NoteDSL[Pitch.C, d, 5]) }
val C6d get() = apply { collect(NoteDSL[Pitch.C, d, 6]) }
val C7d get() = apply { collect(NoteDSL[Pitch.C, d, 7]) }
val Csharp0d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 0]) }
val Csharp1d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 1]) }
val Csharp2d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 2]) }
val Csharp3d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 3]) }
val Csharp4d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 4]) }
val Csharp5d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 5]) }
val Csharp6d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 6]) }
val Csharp7d get() = apply { collect(NoteDSL[Pitch.C_SHARP, d, 7]) }
val Db0d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 0]) }
val Db1d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 1]) }
val Db2d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 2]) }
val Db3d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 3]) }
val Db4d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 4]) }
val Db5d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 5]) }
val Db6d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 6]) }
val Db7d get() = apply { collect(NoteDSL[Pitch.D_FLAT, d, 7]) }
val D0d get() = apply { collect(NoteDSL[Pitch.D, d, 0]) }
val D1d get() = apply { collect(NoteDSL[Pitch.D, d, 1]) }
val D2d get() = apply { collect(NoteDSL[Pitch.D, d, 2]) }
val D3d get() = apply { collect(NoteDSL[Pitch.D, d, 3]) }
val D4d get() = apply { collect(NoteDSL[Pitch.D, d, 4]) }
val D5d get() = apply { collect(NoteDSL[Pitch.D, d, 5]) }
val D6d get() = apply { collect(NoteDSL[Pitch.D, d, 6]) }
val D7d get() = apply { collect(NoteDSL[Pitch.D, d, 7]) }
val Dsharp0d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 0]) }
val Dsharp1d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 1]) }
val Dsharp2d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 2]) }
val Dsharp3d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 3]) }
val Dsharp4d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 4]) }
val Dsharp5d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 5]) }
val Dsharp6d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 6]) }
val Dsharp7d get() = apply { collect(NoteDSL[Pitch.D_SHARP, d, 7]) }
val Eb0d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 0]) }
val Eb1d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 1]) }
val Eb2d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 2]) }
val Eb3d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 3]) }
val Eb4d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 4]) }
val Eb5d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 5]) }
val Eb6d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 6]) }
val Eb7d get() = apply { collect(NoteDSL[Pitch.E_FLAT, d, 7]) }
val E0d get() = apply { collect(NoteDSL[Pitch.E, d, 0]) }
val E1d get() = apply { collect(NoteDSL[Pitch.E, d, 1]) }
val E2d get() = apply { collect(NoteDSL[Pitch.E, d, 2]) }
val E3d get() = apply { collect(NoteDSL[Pitch.E, d, 3]) }
val E4d get() = apply { collect(NoteDSL[Pitch.E, d, 4]) }
val E5d get() = apply { collect(NoteDSL[Pitch.E, d, 5]) }
val E6d get() = apply { collect(NoteDSL[Pitch.E, d, 6]) }
val E7d get() = apply { collect(NoteDSL[Pitch.E, d, 7]) }
val F0d get() = apply { collect(NoteDSL[Pitch.F, d, 0]) }
val F1d get() = apply { collect(NoteDSL[Pitch.F, d, 1]) }
val F2d get() = apply { collect(NoteDSL[Pitch.F, d, 2]) }
val F3d get() = apply { collect(NoteDSL[Pitch.F, d, 3]) }
val F4d get() = apply { collect(NoteDSL[Pitch.F, d, 4]) }
val F5d get() = apply { collect(NoteDSL[Pitch.F, d, 5]) }
val F6d get() = apply { collect(NoteDSL[Pitch.F, d, 6]) }
val F7d get() = apply { collect(NoteDSL[Pitch.F, d, 7]) }
val Fsharp0d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 0]) }
val Fsharp1d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 1]) }
val Fsharp2d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 2]) }
val Fsharp3d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 3]) }
val Fsharp4d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 4]) }
val Fsharp5d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 5]) }
val Fsharp6d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 6]) }
val Fsharp7d get() = apply { collect(NoteDSL[Pitch.F_SHARP, d, 7]) }
val Gb0d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 0]) }
val Gb1d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 1]) }
val Gb2d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 2]) }
val Gb3d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 3]) }
val Gb4d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 4]) }
val Gb5d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 5]) }
val Gb6d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 6]) }
val Gb7d get() = apply { collect(NoteDSL[Pitch.G_FLAT, d, 7]) }
val G0d get() = apply { collect(NoteDSL[Pitch.G, d, 0]) }
val G1d get() = apply { collect(NoteDSL[Pitch.G, d, 1]) }
val G2d get() = apply { collect(NoteDSL[Pitch.G, d, 2]) }
val G3d get() = apply { collect(NoteDSL[Pitch.G, d, 3]) }
val G4d get() = apply { collect(NoteDSL[Pitch.G, d, 4]) }
val G5d get() = apply { collect(NoteDSL[Pitch.G, d, 5]) }
val G6d get() = apply { collect(NoteDSL[Pitch.G, d, 6]) }
val G7d get() = apply { collect(NoteDSL[Pitch.G, d, 7]) }
val Gsharp0d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 0]) }
val Gsharp1d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 1]) }
val Gsharp2d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 2]) }
val Gsharp3d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 3]) }
val Gsharp4d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 4]) }
val Gsharp5d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 5]) }
val Gsharp6d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 6]) }
val Gsharp7d get() = apply { collect(NoteDSL[Pitch.G_SHARP, d, 7]) }
val Ab0d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 0]) }
val Ab1d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 1]) }
val Ab2d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 2]) }
val Ab3d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 3]) }
val Ab4d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 4]) }
val Ab5d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 5]) }
val Ab6d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 6]) }
val Ab7d get() = apply { collect(NoteDSL[Pitch.A_FLAT, d, 7]) }
val A0d get() = apply { collect(NoteDSL[Pitch.A, d, 0]) }
val A1d get() = apply { collect(NoteDSL[Pitch.A, d, 1]) }
val A2d get() = apply { collect(NoteDSL[Pitch.A, d, 2]) }
val A3d get() = apply { collect(NoteDSL[Pitch.A, d, 3]) }
val A4d get() = apply { collect(NoteDSL[Pitch.A, d, 4]) }
val A5d get() = apply { collect(NoteDSL[Pitch.A, d, 5]) }
val A6d get() = apply { collect(NoteDSL[Pitch.A, d, 6]) }
val A7d get() = apply { collect(NoteDSL[Pitch.A, d, 7]) }
val Asharp0d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 0]) }
val Asharp1d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 1]) }
val Asharp2d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 2]) }
val Asharp3d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 3]) }
val Asharp4d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 4]) }
val Asharp5d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 5]) }
val Asharp6d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 6]) }
val Asharp7d get() = apply { collect(NoteDSL[Pitch.A_SHARP, d, 7]) }
val Bb0d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 0]) }
val Bb1d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 1]) }
val Bb2d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 2]) }
val Bb3d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 3]) }
val Bb4d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 4]) }
val Bb5d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 5]) }
val Bb6d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 6]) }
val Bb7d get() = apply { collect(NoteDSL[Pitch.B_FLAT, d, 7]) }
val B0d get() = apply { collect(NoteDSL[Pitch.B, d, 0]) }
val B1d get() = apply { collect(NoteDSL[Pitch.B, d, 1]) }
val B2d get() = apply { collect(NoteDSL[Pitch.B, d, 2]) }
val B3d get() = apply { collect(NoteDSL[Pitch.B, d, 3]) }
val B4d get() = apply { collect(NoteDSL[Pitch.B, d, 4]) }
val B5d get() = apply { collect(NoteDSL[Pitch.B, d, 5]) }
val B6d get() = apply { collect(NoteDSL[Pitch.B, d, 6]) }
val B7d get() = apply { collect(NoteDSL[Pitch.B, d, 7]) }
}
package melody.dsl
import kotlin.math.pow
import kotlin.time.DurationUnit
fun melody(block: MelodyDSL.() -> Unit) = MelodyDSL().also(block).melody()
data class Melody(
val tempo: PureTempo,
val meter: TimeSignature,
val elements: List<MelodyElement>
)
interface DurationDSL {
val w get() = Durations.WHOLE
val h get() = Durations.HALF
val q get() = Durations.QUARTER
val d get() = Durations.EIGHTH
}
class MelodyDSL : TonedPitchDSL, DurationDSL {
private val melody = mutableListOf<MelodyElement>()
val elements: List<MelodyElement> get() = melody.toList()
var tempo: PureTempo = PureTempo.default
var meter: TimeSignature = TimeSignature.default
fun melody() = Melody(tempo, meter, elements)
fun tempo(tempo: PureTempo) = apply {
this.tempo = tempo
}
fun meter(numerator: Int, denominator: Int) = meter(TimeSignature(numerator, denominator))
fun meter(meter: TimeSignature) = apply {
this.meter = meter
}
fun notes(vararg tones: TonedPitch, d: Duration = inferredDuration) = apply {
melody.addAll(
tones.map { tone ->
Note(
pitch = tone.pitch,
duration = d,
octave = tone.octave,
tied = null
)
}
)
}
fun note(tone: TonedPitch, duration: Duration = inferredDuration, tied: Duration? = null) =
apply {
melody.add(
Note(
pitch = tone.pitch,
duration = duration,
octave = tone.octave,
tied = tied
)
)
}
fun chord(vararg notes: TonedPitch, d: Duration = inferredDuration) = apply {
melody.add(
Chord(
pitches = notes.toList(),
duration = d
)
)
}
fun n(vararg tones: TonedPitch, d: Duration = inferredDuration) = notes(*tones, d = d)
fun c(vararg n: TonedPitch, d: Duration = inferredDuration) = chord(*n, d = d)
private val inferredDuration by lazy {
when (meter.denominator) {
4 -> Durations.QUARTER
8 -> Durations.EIGHTH
16 -> Durations.SIXTEENTH
else -> Durations.QUARTER
}
}
}
interface Duration {
val quarters: Double
operator fun get(
unit: DurationUnit,
tempo: PureTempo = PureTempo.default,
meter: TimeSignature = TimeSignature.default
): Double {
val seconds = (60.0 / (tempo.bpm * meter.numerator)) * quarters
return when (unit) {
DurationUnit.MILLISECONDS -> seconds * 1000.0
DurationUnit.SECONDS -> seconds
DurationUnit.MINUTES -> seconds / 60.0
DurationUnit.HOURS -> seconds / (60.0 * 60.0)
DurationUnit.DAYS -> seconds / (60.0 * 60.0 * 24.0)
DurationUnit.NANOSECONDS -> seconds * 1_000_000_000.0
DurationUnit.MICROSECONDS -> seconds * 1_000_000.0
else -> throw IllegalArgumentException("Unsupported time unit: $unit")
}
}
fun millis(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return this[DurationUnit.MILLISECONDS, tempo, meter]
}
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return this[DurationUnit.SECONDS, tempo, meter]
}
}
enum class Durations(override val quarters: Double) : Duration {
WHOLE(4.0),
HALF(2.0),
QUARTER(1.0),
EIGHTH(0.5),
SIXTEENTH(0.25);
}
interface MelodyElement {
val duration: Duration
}
interface TonedPitch {
val pitch: Pitch
val octave: Int
operator fun get(octave: Int) = pitch[octave]
companion object {
fun create(pitch: Pitch, octave: Int) = object : TonedPitch {
override val pitch = pitch
override val octave = octave
}
}
}
data class Note(
override val pitch: Pitch,
override val duration: Duration,
override val octave: Int = DEFAULT_OCTAVE,
val tied: Duration? = null
) : TonedPitch, MelodyElement {
val frequency get() = pitch[octave]
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return duration.seconds(tempo, meter) + (tied?.seconds(tempo, meter) ?: 0.0)
}
companion object {
const val DEFAULT_OCTAVE = 4
}
}
data class Chord(val pitches: List<TonedPitch>, override val duration: Duration) : MelodyElement {
constructor(duration: Duration, vararg pitches: Pitch) : this(
pitches.map {
TonedPitch.create(it, 4)
},
duration
)
// constructor(pitches: List<Pair<Pitch, Int>>, duration: Duration) : this(
// pitches.map { (pitch, octave) ->
// TonedPitch.create(pitch, octave)
// },
// duration
// )
fun contains(pitch: Pitch): Boolean {
return pitches.any { it.pitch == pitch }
}
fun seconds(tempo: PureTempo, meter: TimeSignature = TimeSignature.default): Double {
return duration.seconds(tempo, meter)
}
override fun toString(): String {
return pitches.joinToString(",") { it.pitch.symbol }
}
}
data class MeasureSeparator(override val duration: Durations = Durations.QUARTER) : MelodyElement {
override fun toString() = "|"
}
enum class Clef(val line: Int) {
TREBLE(2), // G Clef on the second line
BASS(4), // F Clef on the fourth line
}
data class TimeSignature(val numerator: Int, val denominator: Int) {
override fun toString(): String {
return "$numerator/$denominator"
}
companion object {
val default by lazy { TimeSignature(4, 4) }
}
}
sealed class Rest { // No inheritance from MelodyElement
abstract val duration: Durations
}
data class BasicRest(override val duration: Durations) : Rest()
//data class RepeatRest(val times: Int, val rest: Rest) : Rest() {
// override val duration: Duration
// get() = rest.duration * times
//}
interface PureTempo {
val bpm: Int
val seconds get() = 60.0 / bpm
val millis get() = 60000L / bpm
companion object {
val default by lazy {
object : PureTempo {
override val bpm = 100
}
}
}
}
interface Tempo : PureTempo {
val beatUnit: Durations
fun wholeNoteInMilliseconds(): Double {
return beatUnit.millis(this) * 4.0
}
}
enum class Tempos(override val bpm: Int, val range: IntRange) : PureTempo {
LARGHISSIMO(24, Int.MIN_VALUE..40), // Extremely Slow
GRAVE(40, 24..40), // Very Slow, Solemn
LARGO(44, 40..66), // Broad, Slow
LARGHETTO(60, 60..80), // Rather Slow, Broad
ADAGIO(70, 55..76), // Slow and Expressive
ADAGIETTO(75, 66..80), // Slower than Andante, Slightly Faster than Adagio
LENTO(72, 40..108), // Slowly
ANDANTE(90, 70..100), // Moderately Slow
MODERATO(112, 100..120), // Moderate
ALLEGRO(132, 120..156), // Fast
PRESTO(176, 160..200), // Very Fast
PRESTOSSIMO(200, 200..Int.MAX_VALUE); // Extremely Fast
}
enum class Pitch(
val symbol: String,
private val semitone: Int,
private val accidental: Accidental? = null
) {
C("C", 0),
C_SHARP("C#", 1, Accidental.SHARP),
D_FLAT("Db", 1, Accidental.FLAT),
D("D", 2),
D_SHARP("D#", 3, Accidental.SHARP),
E_FLAT("Eb", 3, Accidental.FLAT),
E("E", 4),
F("F", 5),
F_SHARP("F#", 6, Accidental.SHARP),
G_FLAT("Gb", 6, Accidental.FLAT),
G("G", 7),
G_SHARP("G#", 8, Accidental.SHARP),
A_FLAT("Ab", 8, Accidental.FLAT),
A("A", 9),
A_SHARP("A#", 10, Accidental.SHARP),
B_FLAT("Bb", 10, Accidental.FLAT),
B("B", 11);
enum class Accidental {
SHARP, FLAT
}
/**
* Gets the frequency of the pitch at the specified octave.
*
* @param octave The octave number.
* @return The frequency of the note at the specified octave.
*/
operator fun get(octave: Int): Double =
frequency(this, octave, accidental)
/**
* Component function to access the frequency at octave 0.
* @return The frequency of the note at octave 0.
*/
operator fun component0() = this[0]
/**
* Component function to access the frequency at octave 1.
* @return The frequency of the note at octave 1.
*/
operator fun component1() = this[1]
/**
* Component function to access the frequency at octave 2.
* @return The frequency of the note at octave 2.
*/
operator fun component2() = this[2]
/**
* Component function to access the frequency at octave 3.
* @return The frequency of the note at octave 3.
*/
operator fun component3() = this[3]
/**
* Component function to access the frequency at octave 4.
* @return The frequency of the note at octave 4.
*/
operator fun component4() = this[4]
/**
* Component function to access the frequency at octave 5.
* @return The frequency of the note at octave 5.
*/
operator fun component5() = this[5]
/**
* Component function to access the frequency at octave 6.
* @return The frequency of the note at octave 6.
*/
operator fun component6() = this[6]
/**
* Component function to access the frequency at octave 7.
* @return The frequency of the note at octave 7.
*/
operator fun component7() = this[7]
companion object {
private val cache = mutableMapOf<Triple<Int, Int, Accidental?>, Double>()
private const val OCTAVE_SIZE = 12
private const val A4_FREQUENCY = 440.0
private const val A_VALUE = 9
fun frequency(semitone: Int, octave: Int = 4, accidental: Accidental? = null): Double {
val key = Triple(semitone, octave, accidental)
return cache.getOrPut(key) {
val semitoneValue = when (accidental) {
Accidental.SHARP -> semitone + 1
Accidental.FLAT -> semitone - 1
else -> semitone
}
val semitoneDifference = (octave * OCTAVE_SIZE) + semitoneValue - A_VALUE
A4_FREQUENCY * 2.0.pow(semitoneDifference.toDouble() / OCTAVE_SIZE)
}
}
fun frequency(pitch: Pitch, octave: Int = 4, accidental: Accidental? = null): Double {
val adjustedSemitoneDifference = when (accidental) {
Accidental.SHARP -> pitch.semitone + 1
Accidental.FLAT -> pitch.semitone - 1
else -> pitch.semitone
}
val semitoneDifference = (octave * OCTAVE_SIZE) + adjustedSemitoneDifference - A_VALUE
return A4_FREQUENCY * 2.0.pow(semitoneDifference.toDouble() / OCTAVE_SIZE)
}
}
}
interface TonedPitchDSL {
companion object {
private val cache = mutableMapOf<Pair<Pitch, Int>, TonedPitch>()
operator fun get(pitch: Pitch, octave: Int) = cache.getOrPut(pitch to octave) {
object : TonedPitch {
override val pitch = pitch
override val octave = octave
}
}
}
val C get() = C4
val Csharp get() = Csharp4
val Db get() = Db4
val D get() = D4
val Dsharp get() = Dsharp4
val Eb get() = Eb4
val E get() = E4
val F get() = F4
val Fsharp get() = Fsharp4
val Gb get() = Gb4
val G get() = G4
val Gsharp get() = Gsharp4
val Ab get() = Ab4
val A get() = A4
val Asharp get() = Asharp4
val Bb get() = Bb4
val B get() = B4
val C0 get() = TonedPitchDSL[Pitch.C, 0]
val C1 get() = TonedPitchDSL[Pitch.C, 1]
val C2 get() = TonedPitchDSL[Pitch.C, 2]
val C3 get() = TonedPitchDSL[Pitch.C, 3]
val C4 get() = TonedPitchDSL[Pitch.C, 4]
val C5 get() = TonedPitchDSL[Pitch.C, 5]
val C6 get() = TonedPitchDSL[Pitch.C, 6]
val C7 get() = TonedPitchDSL[Pitch.C, 7]
val Csharp0 get() = TonedPitchDSL[Pitch.C_SHARP, 0]
val Csharp1 get() = TonedPitchDSL[Pitch.C_SHARP, 1]
val Csharp2 get() = TonedPitchDSL[Pitch.C_SHARP, 2]
val Csharp3 get() = TonedPitchDSL[Pitch.C_SHARP, 3]
val Csharp4 get() = TonedPitchDSL[Pitch.C_SHARP, 4]
val Csharp5 get() = TonedPitchDSL[Pitch.C_SHARP, 5]
val Csharp6 get() = TonedPitchDSL[Pitch.C_SHARP, 6]
val Csharp7 get() = TonedPitchDSL[Pitch.C_SHARP, 7]
val Db0 get() = TonedPitchDSL[Pitch.D_FLAT, 0]
val Db1 get() = TonedPitchDSL[Pitch.D_FLAT, 1]
val Db2 get() = TonedPitchDSL[Pitch.D_FLAT, 2]
val Db3 get() = TonedPitchDSL[Pitch.D_FLAT, 3]
val Db4 get() = TonedPitchDSL[Pitch.D_FLAT, 4]
val Db5 get() = TonedPitchDSL[Pitch.D_FLAT, 5]
val Db6 get() = TonedPitchDSL[Pitch.D_FLAT, 6]
val Db7 get() = TonedPitchDSL[Pitch.D_FLAT, 7]
val D0 get() = TonedPitchDSL[Pitch.D, 0]
val D1 get() = TonedPitchDSL[Pitch.D, 1]
val D2 get() = TonedPitchDSL[Pitch.D, 2]
val D3 get() = TonedPitchDSL[Pitch.D, 3]
val D4 get() = TonedPitchDSL[Pitch.D, 4]
val D5 get() = TonedPitchDSL[Pitch.D, 5]
val D6 get() = TonedPitchDSL[Pitch.D, 6]
val D7 get() = TonedPitchDSL[Pitch.D, 7]
val Dsharp0 get() = TonedPitchDSL[Pitch.D_SHARP, 0]
val Dsharp1 get() = TonedPitchDSL[Pitch.D_SHARP, 1]
val Dsharp2 get() = TonedPitchDSL[Pitch.D_SHARP, 2]
val Dsharp3 get() = TonedPitchDSL[Pitch.D_SHARP, 3]
val Dsharp4 get() = TonedPitchDSL[Pitch.D_SHARP, 4]
val Dsharp5 get() = TonedPitchDSL[Pitch.D_SHARP, 5]
val Dsharp6 get() = TonedPitchDSL[Pitch.D_SHARP, 6]
val Dsharp7 get() = TonedPitchDSL[Pitch.D_SHARP, 7]
val Eb0 get() = TonedPitchDSL[Pitch.E_FLAT, 0]
val Eb1 get() = TonedPitchDSL[Pitch.E_FLAT, 1]
val Eb2 get() = TonedPitchDSL[Pitch.E_FLAT, 2]
val Eb3 get() = TonedPitchDSL[Pitch.E_FLAT, 3]
val Eb4 get() = TonedPitchDSL[Pitch.E_FLAT, 4]
val Eb5 get() = TonedPitchDSL[Pitch.E_FLAT, 5]
val Eb6 get() = TonedPitchDSL[Pitch.E_FLAT, 6]
val Eb7 get() = TonedPitchDSL[Pitch.E_FLAT, 7]
val E0 get() = TonedPitchDSL[Pitch.E, 0]
val E1 get() = TonedPitchDSL[Pitch.E, 1]
val E2 get() = TonedPitchDSL[Pitch.E, 2]
val E3 get() = TonedPitchDSL[Pitch.E, 3]
val E4 get() = TonedPitchDSL[Pitch.E, 4]
val E5 get() = TonedPitchDSL[Pitch.E, 5]
val E6 get() = TonedPitchDSL[Pitch.E, 6]
val E7 get() = TonedPitchDSL[Pitch.E, 7]
val F0 get() = TonedPitchDSL[Pitch.F, 0]
val F1 get() = TonedPitchDSL[Pitch.F, 1]
val F2 get() = TonedPitchDSL[Pitch.F, 2]
val F3 get() = TonedPitchDSL[Pitch.F, 3]
val F4 get() = TonedPitchDSL[Pitch.F, 4]
val F5 get() = TonedPitchDSL[Pitch.F, 5]
val F6 get() = TonedPitchDSL[Pitch.F, 6]
val F7 get() = TonedPitchDSL[Pitch.F, 7]
val Fsharp0 get() = TonedPitchDSL[Pitch.F_SHARP, 0]
val Fsharp1 get() = TonedPitchDSL[Pitch.F_SHARP, 1]
val Fsharp2 get() = TonedPitchDSL[Pitch.F_SHARP, 2]
val Fsharp3 get() = TonedPitchDSL[Pitch.F_SHARP, 3]
val Fsharp4 get() = TonedPitchDSL[Pitch.F_SHARP, 4]
val Fsharp5 get() = TonedPitchDSL[Pitch.F_SHARP, 5]
val Fsharp6 get() = TonedPitchDSL[Pitch.F_SHARP, 6]
val Fsharp7 get() = TonedPitchDSL[Pitch.F_SHARP, 7]
val Gb0 get() = TonedPitchDSL[Pitch.G_FLAT, 0]
val Gb1 get() = TonedPitchDSL[Pitch.G_FLAT, 1]
val Gb2 get() = TonedPitchDSL[Pitch.G_FLAT, 2]
val Gb3 get() = TonedPitchDSL[Pitch.G_FLAT, 3]
val Gb4 get() = TonedPitchDSL[Pitch.G_FLAT, 4]
val Gb5 get() = TonedPitchDSL[Pitch.G_FLAT, 5]
val Gb6 get() = TonedPitchDSL[Pitch.G_FLAT, 6]
val Gb7 get() = TonedPitchDSL[Pitch.G_FLAT, 7]
val G0 get() = TonedPitchDSL[Pitch.G, 0]
val G1 get() = TonedPitchDSL[Pitch.G, 1]
val G2 get() = TonedPitchDSL[Pitch.G, 2]
val G3 get() = TonedPitchDSL[Pitch.G, 3]
val G4 get() = TonedPitchDSL[Pitch.G, 4]
val G5 get() = TonedPitchDSL[Pitch.G, 5]
val G6 get() = TonedPitchDSL[Pitch.G, 6]
val G7 get() = TonedPitchDSL[Pitch.G, 7]
val Gsharp0 get() = TonedPitchDSL[Pitch.G_SHARP, 0]
val Gsharp1 get() = TonedPitchDSL[Pitch.G_SHARP, 1]
val Gsharp2 get() = TonedPitchDSL[Pitch.G_SHARP, 2]
val Gsharp3 get() = TonedPitchDSL[Pitch.G_SHARP, 3]
val Gsharp4 get() = TonedPitchDSL[Pitch.G_SHARP, 4]
val Gsharp5 get() = TonedPitchDSL[Pitch.G_SHARP, 5]
val Gsharp6 get() = TonedPitchDSL[Pitch.G_SHARP, 6]
val Gsharp7 get() = TonedPitchDSL[Pitch.G_SHARP, 7]
val Ab0 get() = TonedPitchDSL[Pitch.A_FLAT, 0]
val Ab1 get() = TonedPitchDSL[Pitch.A_FLAT, 1]
val Ab2 get() = TonedPitchDSL[Pitch.A_FLAT, 2]
val Ab3 get() = TonedPitchDSL[Pitch.A_FLAT, 3]
val Ab4 get() = TonedPitchDSL[Pitch.A_FLAT, 4]
val Ab5 get() = TonedPitchDSL[Pitch.A_FLAT, 5]
val Ab6 get() = TonedPitchDSL[Pitch.A_FLAT, 6]
val Ab7 get() = TonedPitchDSL[Pitch.A_FLAT, 7]
val A0 get() = TonedPitchDSL[Pitch.A, 0]
val A1 get() = TonedPitchDSL[Pitch.A, 1]
val A2 get() = TonedPitchDSL[Pitch.A, 2]
val A3 get() = TonedPitchDSL[Pitch.A, 3]
val A4 get() = TonedPitchDSL[Pitch.A, 4]
val A5 get() = TonedPitchDSL[Pitch.A, 5]
val A6 get() = TonedPitchDSL[Pitch.A, 6]
val A7 get() = TonedPitchDSL[Pitch.A, 7]
val Asharp0 get() = TonedPitchDSL[Pitch.A_SHARP, 0]
val Asharp1 get() = TonedPitchDSL[Pitch.A_SHARP, 1]
val Asharp2 get() = TonedPitchDSL[Pitch.A_SHARP, 2]
val Asharp3 get() = TonedPitchDSL[Pitch.A_SHARP, 3]
val Asharp4 get() = TonedPitchDSL[Pitch.A_SHARP, 4]
val Asharp5 get() = TonedPitchDSL[Pitch.A_SHARP, 5]
val Asharp6 get() = TonedPitchDSL[Pitch.A_SHARP, 6]
val Asharp7 get() = TonedPitchDSL[Pitch.A_SHARP, 7]
val Bb0 get() = TonedPitchDSL[Pitch.B_FLAT, 0]
val Bb1 get() = TonedPitchDSL[Pitch.B_FLAT, 1]
val Bb2 get() = TonedPitchDSL[Pitch.B_FLAT, 2]
val Bb3 get() = TonedPitchDSL[Pitch.B_FLAT, 3]
val Bb4 get() = TonedPitchDSL[Pitch.B_FLAT, 4]
val Bb5 get() = TonedPitchDSL[Pitch.B_FLAT, 5]
val Bb6 get() = TonedPitchDSL[Pitch.B_FLAT, 6]
val Bb7 get() = TonedPitchDSL[Pitch.B_FLAT, 7]
val B0 get() = TonedPitchDSL[Pitch.B, 0]
val B1 get() = TonedPitchDSL[Pitch.B, 1]
val B2 get() = TonedPitchDSL[Pitch.B, 2]
val B3 get() = TonedPitchDSL[Pitch.B, 3]
val B4 get() = TonedPitchDSL[Pitch.B, 4]
val B5 get() = TonedPitchDSL[Pitch.B, 5]
val B6 get() = TonedPitchDSL[Pitch.B, 6]
val B7 get() = TonedPitchDSL[Pitch.B, 7]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment