Add acoustic source transient control
This commit is contained in:
parent
778c9bdd4d
commit
bc371a1c5c
7 changed files with 19 additions and 6 deletions
|
|
@ -803,9 +803,12 @@ public static class FaustEmitter
|
|||
var tension = $"clip01({parameters.Expression(OwnerField(path, "tension"), port.Tension)})";
|
||||
var opening = $"max(0.0, {parameters.Expression(OwnerField(path, "opening"), port.Opening)})";
|
||||
var noise = $"clip01({parameters.Expression(OwnerField(path, "noise"), port.Noise)})";
|
||||
var transient = $"clip01({parameters.Expression(OwnerField(path, "transient"), port.Transient)})";
|
||||
var balance = parameters.Expression(OwnerField(path, "balance"), port.Balance);
|
||||
var detune = port.Kind == AcousticSourceKind.Labial ? $" * (1.0 + ({balance} - 0.5) * 0.018)" : "";
|
||||
var phase = $"os.phasor(1.0, {frequency}{detune})";
|
||||
var closure = $"clip01((0.12 - ({opening})) / 0.12)";
|
||||
var release = $"(max(0.0, (({closure}) : mem) - ({closure})) : + ~ *(0.90))";
|
||||
return port.Kind switch
|
||||
{
|
||||
AcousticSourceKind.Glottal =>
|
||||
|
|
@ -815,9 +818,9 @@ public static class FaustEmitter
|
|||
AcousticSourceKind.Reed =>
|
||||
$"(ma.tanh(sin(2.0 * ma.PI * {phase}) * (1.0 + {pressure} * 8.0)) * {opening} + no.noise * {noise} * 0.2) * {balance}",
|
||||
AcousticSourceKind.TurbulenceJet =>
|
||||
$"(no.noise : fi.highpass(2, 900.0 + 2600.0 * clip01(1.0 - {opening}))) * {noise} * {pressure} * clip01((0.8 - {opening}) / 0.8) * {balance}",
|
||||
$"((no.noise : fi.highpass(2, 900.0 + 2600.0 * clip01(1.0 - {opening}))) * {noise} * {pressure} * clip01((0.8 - {opening}) / 0.8) + (no.noise : fi.highpass(1, 450.0)) * {transient} * {pressure} * {release} * (0.8 + 0.8 * clip01({opening} / 0.8))) * {balance}",
|
||||
AcousticSourceKind.Click =>
|
||||
$"no.noise * {pressure} * {opening} * exp(0.0 - age * 120.0) * {balance}",
|
||||
$"no.noise * {pressure} * max({opening}, {transient}) * exp(0.0 - age * 120.0) * {balance}",
|
||||
AcousticSourceKind.Synthetic =>
|
||||
$"sin(2.0 * ma.PI * {phase}) * {pressure} * {opening} * {balance}",
|
||||
_ => "0.0"
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ public sealed record AcousticSourcePort(
|
|||
float Tension = 0.6f,
|
||||
float Opening = 0.5f,
|
||||
float Noise = 0.08f,
|
||||
float Transient = 0,
|
||||
float Balance = 1,
|
||||
bool Active = true);
|
||||
|
||||
|
|
|
|||
|
|
@ -439,7 +439,8 @@ public static class PatchScript
|
|||
injection.Burst,
|
||||
0,
|
||||
injection.Diameter,
|
||||
injection.Turbulence));
|
||||
injection.Turbulence,
|
||||
injection.Burst));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -572,6 +573,7 @@ public static class PatchScript
|
|||
GetBoundFloat(fields, line, 0.6f, $"/acoustic/sources/{_acousticSourcePorts.Count}/tension", "tension", "tenseness", "tense"),
|
||||
GetBoundFloat(fields, line, 0.5f, $"/acoustic/sources/{_acousticSourcePorts.Count}/opening", "opening", "open"),
|
||||
GetBoundFloat(fields, line, 0.08f, $"/acoustic/sources/{_acousticSourcePorts.Count}/noise", "noise", "aspiration"),
|
||||
GetBoundFloat(fields, line, 0, $"/acoustic/sources/{_acousticSourcePorts.Count}/transient", "transient", "burst"),
|
||||
GetBoundFloat(fields, line, 1, $"/acoustic/sources/{_acousticSourcePorts.Count}/balance", "balance"),
|
||||
TryGetAny(fields, ["active"], out var active) ? ParseBool(active, line) : true);
|
||||
AddAcousticSourcePortRecord(port);
|
||||
|
|
@ -1350,12 +1352,14 @@ public static class PatchScript
|
|||
Math.Max(injection.Turbulence, injection.Burst),
|
||||
0,
|
||||
injection.Diameter,
|
||||
Math.Max(0.001f, injection.Turbulence));
|
||||
Math.Max(0.001f, injection.Turbulence),
|
||||
injection.Burst);
|
||||
var injectionSourceIndex = _acousticSourcePorts.Count;
|
||||
AddAcousticSourcePortRecord(injectionSource);
|
||||
MirrorParameterBinding(OwnerField(tractPath, "turbulence"), $"/acoustic/sources/{injectionSourceIndex}/pressure");
|
||||
MirrorParameterBinding(OwnerField(tractPath, "constriction_diameter"), $"/acoustic/sources/{injectionSourceIndex}/opening");
|
||||
MirrorParameterBinding(OwnerField(tractPath, "turbulence"), $"/acoustic/sources/{injectionSourceIndex}/noise");
|
||||
MirrorParameterBinding(OwnerField(tractPath, "injection/burst"), $"/acoustic/sources/{injectionSourceIndex}/transient");
|
||||
AddAcousticTerminalRecord(new AcousticTerminal(injectionSource.Name, injectionSource.Path, injectionSource.Position, AcousticTerminalKind.Source, injectionSource.Name));
|
||||
sourceNames.Add(injectionName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue