I’m building a new piece, and while I was starting to write some Ndef
I realised this was not that obvious to decide when to go for Ndef
and when to go for SynthDef
, which were the use cases they were best suited for, what were their strengths and their limitations.
I tried to make this quick review of my knowledge and experience of both concepts on the following axes:
- Amount of Synth instances possible
- Composition/reusability of the definition
- Live modification
- Triggering (e.g. pattern, …)
- Routing and organisation
Comparison
SynthDef
Amount of Synth instances:
∞, but Risk of loosing the reference to the running Synth’s if not stored correctly in variables
Composition/reusability:
No.
A SynthDef is a finite piece. One cannot use a SynthDef neither within a SynthDef nor within an Ndef.
Mitigation: work with functions and build SynthDef by wrapping these functions.
Live modification:
Yes/No
The SynthDef source can be modified live but the modification won’t apply to already playing Synth occurrences deriving from this SynthDef.
Triggering (e.g. pattern, …):
Can be controlled by a Pbind
triggering as many Synth as required by the pattern
Routing and organisation:
The routing of the Synth’s is managed by the groups to which the Synth’s are added and the different addAction
(\addToTail
, …)
Ndef
Amount of Synth instances:
1
More can be made by “duplicating” the Ndef (Ndef(\x).copy(\y)
)
SynthDef composition/reusability:
Yes.
One can build one Ndef composed of different Ndef using Ndef(\x).ar
All the Ndef are running independently. Playing the “composed” Ndef does not start playing the “composing” Ndef’s. They must started independently.
Live modification:
Yes
Triggering (e.g. pattern, …):
Cannot be controlled by an external Pbind
as a valid \instrument
.
But can be controlled by an internal pattern defined as part of the Ndef, that controls its parameters, but not when it is playing or not.
Rem : a Ndef is more or less always running in background
Routing and organisation:
The routing of the Ndef can managed in different ways :
-
by the groups and the
addAction’s
-
by chaining them with
<<>
-
by stacking up different SynthDef in the same Ndef and by using NodeProxy roles
Conclusion
I would say SynthDef are more suited when/for
- multiple occurrences are of a same definition are required
- the Synths have explicit start and releases
- fine and changing control by Patterns (e.g.) is required
I would say Ndef are more suited when/for
- Live modification of the Synth definition is required
- Complex routing or Synth organisation
What do you think of this overview ?
Have I not missed too many things ?