Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ The internal Q14 stages use `i64` products and saturate at the `i32`
limits. Decrease `output_gain` to prevent `-32767..=32767` clipping on
multi-voice mixes.

`resynthesis.correction.humanize` sets the relaxation on sustained notes, in
`0..=1`. The default is 0. `resynthesis.correction.flex_tune` sets the outer
fraction of each half-bin where pull toward the target decreases, in `0..=1`.
The default is 0, which applies full pull across the whole bin.

`resynthesis.dry_mix` sets the dry fraction at the resynthesis stage. The
dry path starts after Warm and has a delay of 1,593 frames. All six reverb
modes keep the stereo dry signal.
Expand Down Expand Up @@ -465,8 +470,10 @@ and show enums as string literals. To change the configuration, do these steps:
3. Call `setConfig()`.

If a required field is absent or a value is not valid, the call throws a
JavaScript `Error`. The optional `resynthesis.harmony.voices` field defaults
to 4 if it is absent or `undefined`. The conversion ignores extra object
JavaScript `Error`. If an optional field is absent or `undefined`, it gets its
default. `resynthesis.correction.humanize` and
`resynthesis.correction.flexTune` default to 0, and
`resynthesis.harmony.voices` defaults to 4. The conversion ignores extra object
properties. The generated declarations contain the parameter documentation from
the Rust types.

Expand Down
32 changes: 32 additions & 0 deletions scripts/verify-pack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,13 @@ function verifyRuntimeImport(consumerDir, packageName) {
"assert.ok(wasmExports);",
"",
"const initialConfig = rootModule.defaultConfig();",
"initialConfig.resynthesis.correction.humanize = undefined;",
"initialConfig.resynthesis.correction.flexTune = undefined;",
"initialConfig.resynthesis.harmony.voices = undefined;",
"const processor = new rootModule.Tunelet(48000, 128, initialConfig);",
"try {",
" assert.equal(processor.config().resynthesis.correction.humanize, 0);",
" assert.equal(processor.config().resynthesis.correction.flexTune, 0);",
" assert.equal(processor.config().resynthesis.harmony.voices, 4);",
"",
" const twoVoiceConfig = processor.config();",
Expand All @@ -305,12 +309,30 @@ function verifyRuntimeImport(consumerDir, packageName) {
" processor.setConfig(oneVoiceConfig);",
" assert.equal(processor.config().resynthesis.harmony.voices, 1);",
"",
" const tunedCorrectionConfig = processor.config();",
" tunedCorrectionConfig.resynthesis.correction.humanize = 0.5;",
" tunedCorrectionConfig.resynthesis.correction.flexTune = 0.25;",
" processor.setConfig(tunedCorrectionConfig);",
" assert.equal(processor.config().resynthesis.correction.humanize, 0.5);",
" assert.equal(processor.config().resynthesis.correction.flexTune, 0.25);",
"",
" const omittedCorrectionConfig = processor.config();",
" delete omittedCorrectionConfig.resynthesis.correction.humanize;",
" delete omittedCorrectionConfig.resynthesis.correction.flexTune;",
" processor.setConfig(omittedCorrectionConfig);",
" assert.equal(processor.config().resynthesis.correction.humanize, 0);",
" assert.equal(processor.config().resynthesis.correction.flexTune, 0);",
"",
" const mono = new Int16Array(128);",
" const eventResynthesis = processor.config().resynthesis;",
" eventResynthesis.correction.humanize = undefined;",
" eventResynthesis.correction.flexTune = undefined;",
" eventResynthesis.harmony.voices = undefined;",
" processor.processMono(mono, [",
' { offset: 0, event: { type: "resynthesis", value: eventResynthesis } },',
" ]);",
" assert.equal(processor.config().resynthesis.correction.humanize, 0);",
" assert.equal(processor.config().resynthesis.correction.flexTune, 0);",
" assert.equal(processor.config().resynthesis.harmony.voices, 4);",
"",
" const input = new Int16Array(128);",
Expand Down Expand Up @@ -533,6 +555,11 @@ function verifyTypeDeclarations(consumerDir, packageName) {
" ...baseConfig,",
" resynthesis: {",
" ...baseConfig.resynthesis,",
" correction: {",
" ...baseConfig.resynthesis.correction,",
" humanize: optionalVoices,",
" flexTune: optionalVoices,",
" },",
" harmony: {",
" ...baseConfig.resynthesis.harmony,",
" voices: optionalVoices,",
Expand All @@ -551,6 +578,11 @@ function verifyTypeDeclarations(consumerDir, packageName) {
" processor.setConfig(configWithUndefined);",
" const resynthesisUpdate: ResynthesisConfig = {",
" ...configWithUndefined.resynthesis,",
" correction: {",
" enabled: configWithUndefined.resynthesis.correction.enabled,",
" notes: configWithUndefined.resynthesis.correction.notes,",
" retuneMs: configWithUndefined.resynthesis.correction.retuneMs,",
" },",
" harmony: {",
" ...configWithUndefined.resynthesis.harmony,",
" voices: undefined,",
Expand Down
Loading