Skip to content

Repaired a broken preset in the tracker.#230

Merged
vsariola merged 4 commits into
vsariola:masterfrom
LeStahL:bugfix/broken-preset
Mar 19, 2026
Merged

Repaired a broken preset in the tracker.#230
vsariola merged 4 commits into
vsariola:masterfrom
LeStahL:bugfix/broken-preset

Conversation

@LeStahL
Copy link
Copy Markdown
Contributor

@LeStahL LeStahL commented Mar 18, 2026

This took me a while to figure out :) Steps to reproduce:

  • Create a patch
  • Add "Hihat gen" and "DR kickedm" preset instruments
  • select "reverb" preset in the global delay
  • sointu-compile and compile into a binary
  • observe brutal sound bugs

reproducing minimal example:
testbug.yml

The mechanism was essentially an unconnected "send" which somehow only affected the x86 asm player, not the native synth in the tracker.

@vsariola vsariola added the bug Something isn't working label Mar 19, 2026
@vsariola
Copy link
Copy Markdown
Owner

Able to replicate. I have a hunch what is going on: the unconnected send manages to write to the section of the memory reserved for the delay buffers? Fortunately, not a major bug, as normally user would optimize away unconnected sends anyway, but I'll make this handling more robust, deleting the disabled units, unconnected sends, and sends targeting disabled units, from the patch altogether before compiling it.

@vsariola
Copy link
Copy Markdown
Owner

vsariola commented Mar 19, 2026

So, I found this comment and line in the code (LOL):

// if no target will be found, the send will trash some of
// the last values of the last port of the last voice, which
// is unlikely to cause issues. We still honor the POP bit.
addr = 0xFFF7

// if no target will be found, the send will trash some of

That address there has the most significant bit set, so it should be "global send" aka cross-instrument send aka address relative to the start of the synth object. And, in the uncompiled version, nothing bad happens, cause the functionality for global sends is included.

HOWEVER, during compilation, due to some "clever logic", it detects that global sends are not used (cause the send was unconnected), and thus we can optimize the functionality for global sends away, and all sends are relative to the start of the voice.

Now, in your test patch, the send is in the second instrument, and it's now a relative send. So, the send address now targets an address just beyond all the synth workspace. And what's lurking beyond the synth workspace? That's right, the delay buffers!

The "brutal" sound you hear is a sudden spike like value in the delay buffer.

Oh well, this is probably an easy fix, and fortunately not terrible bug, cause normally user would optimize away all the unconnected sends.

@LeStahL
Copy link
Copy Markdown
Contributor Author

LeStahL commented Mar 19, 2026

Checked the graph theory on all presets; those are the remaining unconnected sends.

@vsariola vsariola merged commit 11977a5 into vsariola:master Mar 19, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants