# Superdirt SynthDef timing and envelopes

**URL:** <https://uzu.lurk.org/t/superdirt-synthdef-timing-and-envelopes/6210>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [31 August 2026 20:45 UTC](https://uzu.lurk.org/t/superdirt-synthdef-timing-and-envelopes/6210 "2026-08-31T20:45:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [31 August 2026 20:45 UTC](https://uzu.lurk.org/t/superdirt-synthdef-timing-and-envelopes/6210/1 "2026-08-31T20:45:36Z")

</div>

Continuing the discussion from [What is tidal doing with SynthDef envelopes?](https://uzu.lurk.org/t/what-is-tidal-doing-with-synthdef-envelopes/2904):

I have also noticed the same thing: it can be hard to get the sustain to ring out nicely on note events, and it _feels like_ the synth instance gets freed before its `doneAction` if the `doneAction` would come _after_ the end of an event's arc.

Coming back to TidalCycles from Strudel, I also realized this is part of the reason that I (subjectively) prefer the sound of Strudel.

Compare something like this pattern in strudel where the notes resonate nicely

```js
note("<g [d,a] <d!5 g> - <- <g f e>@2>>*8").sound("piano")
.off(3/8, x=>x.add(note("7")).fast(2).gain(0.25).color('red'))

```

To this in tidal cycles, where the notes don't resonate out:

```hs
d1
  $ off (3/8) ((# gain 0.8) . (fast 2) . (+ note 7))
  $ note "<g [d,a] <d!5 g> - <- <g f e>@2>>*8"
  # sound "superpiano"

```

Of course, it is possible to add `# sustain 2`, but then how would I go about writing a synthdef  
which uses an ADSR envelope? I'd like for legato/sustain to control the S part of the ADSR,  
but still let the release play out.

I could maybe do some math on the `begin` and `end` arguments in the `SynthDef`, but this feels awkward compared to just doing the natural thing and letting the event's arc/time act  
like a gate, with a different parameter for the release.

* * *

I started digging around in SuperDirt to try to understand what the exact behavior is, but I haven't quite figured out what I would need to change if I wanted to customize this behavior.

I see where events get their parameters here:

> **[SuperDirt/classes/DirtOrbit.sc at a3046d1e693eb1c7f5502fb1d0a27d59099737f8](https://codeberg.org/musikinformatik/SuperDirt/src/commit/a3046d1e693eb1c7f5502fb1d0a27d59099737f8/classes/DirtOrbit.sc#L170-L215)**
>
> SuperDirt - Tidal Audio Engine

And how an event calculates its duration here:

> **[SuperDirt/classes/DirtEvent.sc at develop](https://codeberg.org/musikinformatik/SuperDirt/src/branch/develop/classes/DirtEvent.sc#L68-L132)**
>
> SuperDirt - Tidal Audio Engine

But it's not immediately clear to me how this frees/ends sounds that might play out longer.

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [1 September 2026 12:42 UTC](https://uzu.lurk.org/t/superdirt-synthdef-timing-and-envelopes/6210/2 "2026-09-01T12:42:52Z")

</div>

Hmm, this is the behavior of the `dirt_gate` synth defined here:

> **[SuperDirt/synths/core-synths.scd at develop](https://codeberg.org/musikinformatik/SuperDirt/src/branch/develop/synths/core-synths.scd#L179-L189)**
>
> SuperDirt - Tidal Audio Engine

And used here:

> **[SuperDirt/classes/DirtEvent.sc at develop](https://codeberg.org/musikinformatik/SuperDirt/src/branch/develop/classes/DirtEvent.sc#L160-L179)**
>
> SuperDirt - Tidal Audio Engine

If I understand this correctly it limits the sound to the sustain period of the event by explicitly freeing and silencing the output, while also supporting control over the overall gain and amplitude of sounds on a specific orbit.

---

<div class="post-metadata">

**Author:** ![ludens](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ludens/32/3028_2.png) [@ludens](https://uzu.lurk.org/u/ludens)\
**Post date:** [1 September 2026 12:52 UTC](https://uzu.lurk.org/t/superdirt-synthdef-timing-and-envelopes/6210/3 "2026-09-01T12:52:57Z")

</div>

I see an effort to [integrate some of the behaviors from strudel back into superdirt by Jade](https://codeberg.org/musikinformatik/SuperDirt/pulls/303), and [an issue which discusses the differences](https://codeberg.org/musikinformatik/SuperDirt/pulls/302).

The difference in how superdirt's sustain works is mentioned in the issue, and it seems that adding a dedicated release parameter, changing the name of `sustain` to `sus`, and calculating it from the `sustain+release`(`+attack`?) could be a decent solution.
