Skip to content

Envelopes: gain inlet reads 1 when nothing is connected - #47

Merged
zeyuyang42 merged 1 commit into
mainfrom
envelopes-gain-default
Oct 16, 2026
Merged

zeyuyang42 merged 1 commit into
mainfrom
envelopes-gain-default

Conversation

@zeyuyang42

@zeyuyang42 zeyuyang42 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

An unconnected signal inlet reads 0 in both hosts, so a plain zerr.envelopes~ / zerr_envelopes~ with only a control signal multiplied every envelope by 0 and was silent. Found while writing the Max examples, all of which needed a sig~ 1 on the third inlet.

Max (zerr_envelopes.hpp, zerr.envelopes_tilde.cpp): dsp64 reads count[2] and tells the wrapper whether the gain inlet has a cord; perform() fills the gain block with 1.0 when it has none. Atomic flag, set at DSP setup, read per block; no change to the core.

Pd (zerr_envelopes~.cpp): the gain inlet is created with signalinlet_new(&x->x_obj, 1.0f), so it reads 1 unconnected and a float sent to it sets a constant gain, as for any Pd signal inlet.

User-visible effect (rule 7)

  • Max: zerr.envelopes~ plays at full level without a gain signal. Assist text and README inlet line updated. Line added to docs/releases/max-v0.3.0.md.
  • Pd: zerr_envelopes~ likewise. Line added under a new Changed heading in docs/releases/pd-next.md.

Verified: both hosts build from this branch. Headless Pd (pd -nogui -batch): [sig~ 0.5] into a plain [zerr_envelopes~ trajectory circulation_8], nothing on the gain inlet, snapshot~ of outlets 4 and 5 after 300 ms.

  • this branch: sp4: 0 sp5: 1
  • build from main before this change: sp4: 0 sp5: 0

Max needs a listening check: open any example without its sig~ 1 and the sound must play.

🤖 Generated with Claude Code

Max hands an unconnected signal inlet zeros, so a plain zerr.envelopes~
with only a control signal multiplied every envelope by 0 and was silent;
every example patch needed a [sig~ 1]. dsp64's count[] now tells the
wrapper whether the gain inlet has a cord and perform() fills the block
with 1.0 when it has none.

Pd: zerr_envelopes~ creates the gain inlet with signalinlet_new(1.0), so
it reads 1 unconnected and a float sent to it sets a constant gain.

Max: zerr.envelopes~ plays at full level without a gain signal.
Pd: zerr_envelopes~ likewise. Notes in max-v0.3.0.md and pd-next.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@zeyuyang42
zeyuyang42 merged commit ede46b9 into main Oct 16, 2026
8 checks passed
@zeyuyang42
zeyuyang42 deleted the envelopes-gain-default branch October 16, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant