Skip to content

Commit

Permalink
M-OSC/Waveforms: chord_stack - fixed root offset #117
Browse files Browse the repository at this point in the history
  • Loading branch information
eh2k committed Dec 26, 2024
1 parent 38ab43a commit 63799c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 43 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<summary><b>ChangeLog</b></summary>

````
== 2024-12-28
* Bugfix
* M-OSC/Waveforms: Braids Renaissance Chords - fixed root offset #117
== 2024-12-23
* Bugifx
* Crash / parameter modulations wrap around #120
Expand Down
Binary file modified app/M-OSC/Waveforms.bin
Binary file not shown.
44 changes: 2 additions & 42 deletions app/M-OSC/Waveforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ Envelope envelope;
VcoJitterSource jitter_source;
braids::Quantizer quantizer;

static int8_t notes[6] = {};

#ifndef MACHINE_INTERNAL

void Quantizer::Init()
{
}
Expand All @@ -62,31 +58,14 @@ bool Quantizer::enabled()

int32_t Quantizer::Process(int32_t pitch, int32_t root, int8_t *note)
{
memset(notes, 0, sizeof(notes));
if (note == nullptr)
note = &notes[0];

pitch -= root + (PITCH_PER_OCTAVE * 8);
auto ret = engine::qz_process(pitch, note);
ret += root + (PITCH_PER_OCTAVE * 8);
notes[0] = *note;
return ret;
return engine::qz_process(pitch - (PITCH_PER_OCTAVE * 8), note) + (PITCH_PER_OCTAVE * 8);
}

int16_t Quantizer::Lookup(uint8_t index)
{
for (auto &note : notes)
{
if (note == 0)
{
note = index - notes[0];
break;
}
}

return engine::qz_lookup(index) + (PITCH_PER_OCTAVE * 8);
}
#endif

uint8_t sync_samples[FRAME_BUFFER_SIZE] = {};

int32_t _pitch = 0;
Expand Down Expand Up @@ -122,7 +101,6 @@ void engine::setup()

void engine::process()
{
memset(notes, 0, sizeof(notes));
envelope.Update(_attack / 512, _decay / 512);

if (engine::trig())
Expand Down Expand Up @@ -205,24 +183,6 @@ void engine::process()

void engine::draw()
{
if (_shape >= 48)
{
char tmp[8];
for (int i = 0; i < LEN_OF(notes); i++)
{
if (notes[i] != 0)
{
int slen = 0;
if (i == 0)
slen = sprintf(tmp, "%d", notes[i]);
else
slen = sprintf(tmp, "%+d", notes[i]);

gfx::drawString(128 - slen * 5, 10 + 6 * i, tmp, 0);
}
}
}

if (!__io->tr)
{
setParamName(&_decay, "Level");
Expand Down
3 changes: 2 additions & 1 deletion lib/braids/chords_stack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ void DigitalOscillator::renderChord(
if (quantizer.enabled()) {
int8_t index = 0;
int8_t root = 0;
fm = pitch_ - quantizer.Process(pitch_, 0, &root);
quantizer.Process(pitch_, 0, &root);
fm = pitch_ - quantizer.Lookup(root);

phase_increment[0] = phase_increment_;
for (size_t i = 1; i < noteCount; i++) {
Expand Down

0 comments on commit 63799c4

Please sign in to comment.