Skip to content

Commit

Permalink
MIDI generator adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Jul 3, 2024
1 parent 5637d51 commit b0af6a0
Show file tree
Hide file tree
Showing 6 changed files with 736 additions and 72 deletions.
2 changes: 1 addition & 1 deletion libraries/steve/src/Steve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void steve::add_note(Notes &notes, uint8_t channel, uint8_t tone, size_t start,
Note note;
note.channel = channel;
note.tone = tone;
note.velocity = clamp(velocity + Rand::next_velocity_jitter(), 0, 127);
note.velocity = clamp(velocity + Rand::next_velocity_jitter(), 0, 96);
note.duration = length;
notes.insert(make_pair(start, note));
}
Expand Down
9 changes: 5 additions & 4 deletions libraries/steve/src/creator/Drums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ Notes Drums::get(size_t, size_t size) const
uint32_t layers(Rand::next(2, 5));
for (uint32_t i(0); i < layers; i++)
{
uint8_t tone(Rand::next(35, 59));
NoteValue period_value = Rand::next(NoteValue::eighth, max_period);
//uint8_t tone(Rand::next(35, 59));
uint8_t tone(Rand::next(35, 36));
NoteValue period_value = (max_period <= NoteValue::half) ? max_period : Rand::next(NoteValue::half, max_period);
uintptr_t period = ticks_for(period_value);
uintptr_t offset = ticks_for(Rand::next(NoteValue::eighth, period_value));
uintptr_t offset = ticks_for((period_value <= NoteValue::half) ? period_value : Rand::next(NoteValue::half, period_value));
if (i == 0 || Rand::next(0, 3) > 0)
{
offset = 0;
Expand All @@ -44,7 +45,7 @@ Notes Drums::get(size_t, size_t size) const
{
if (_music->is_beat(j))
{
add_note(notes, _channel, tone, j, 1, 100);
add_note(notes, _channel, tone, j, 1, 64);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/midi_generation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MIDI_CONFIG = {}
MIDI_CONFIG.CHOICES =
{
"safe", _("Safe Defaults"),
"all", _("Relaxed (May Sound Weird)")
"relaxed", _("Relaxed (May Sound Weird)")
}

function MIDI_CONFIG.setup(self)
Expand Down
File renamed without changes.
Loading

0 comments on commit b0af6a0

Please sign in to comment.