feat: adjust drop-out parameters

This commit is contained in:
xtex 2023-07-30 10:38:29 +08:00
parent 421f80c9a1
commit eb772916dc
Signed by: xtex
GPG Key ID: B918086ED8045B91

View File

@ -25,8 +25,8 @@ class Composer(val noteRandom: Random, val rhythmRandom: Random, val instrument:
fun composeMusic(): List<Note> { fun composeMusic(): List<Note> {
var note = (0..rhythmRandom.nextInt(4)).flatMap { composeSection() } var note = (0..rhythmRandom.nextInt(4)).flatMap { composeSection() }
note = decorate(note) note = decorate(note)
if (mayDropOut && rhythmRandom.nextInt(3) != 0) { if (mayDropOut && rhythmRandom.nextInt(6) != 0) {
val dropRate = rhythmRandom.nextInt(2..4) val dropRate = arrayOf(2, 3, 3, 4, 4, 4, 4, 6).random(rhythmRandom)
note = note.chunked(dropRate).map { note = note.chunked(dropRate).map {
val first = it.first() val first = it.first()
Note(first.note, first.volume, it.sumOf { note -> note.time }) Note(first.note, first.volume, it.sumOf { note -> note.time })