tunelet 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -12
- package/package.json +1 -1
- package/pkg/tunelet.d.ts +0 -1084
- package/pkg/tunelet.js +0 -870
- package/pkg/tunelet_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ allocate memory, acquire locks or do I/O:
|
|
|
68
68
|
- Configuration
|
|
69
69
|
- MIDI
|
|
70
70
|
- Feedback
|
|
71
|
+
- Telemetry
|
|
71
72
|
- Reset
|
|
72
73
|
- Drain
|
|
73
74
|
|
|
@@ -89,6 +90,32 @@ peak window. `latency_frames()` gives 1,593 frames of nominal resynthesis
|
|
|
89
90
|
latency at both sample rates. Dry mixes, resampled voices and effects have
|
|
90
91
|
different timing.
|
|
91
92
|
|
|
93
|
+
`telemetry()` reads data for meters and displays. It does not change the
|
|
94
|
+
audio. The data includes these items:
|
|
95
|
+
|
|
96
|
+
- The pitch ratio and the gain of each voice.
|
|
97
|
+
- The peaks of the input, of the two output channels and of the reverb wet
|
|
98
|
+
signal.
|
|
99
|
+
- The pitch clarity, which is a confidence score from 0 to 1.
|
|
100
|
+
- The current gains of Punch and Warm, and the position in the Alien loop.
|
|
101
|
+
|
|
102
|
+
`take_telemetry()` also clears the three peak windows of the telemetry. These
|
|
103
|
+
windows are independent of the peak window of the feedback.
|
|
104
|
+
|
|
105
|
+
`formant_envelope()` writes two LPC envelopes into slices of equal length:
|
|
106
|
+
the vocal-tract envelope from the analysis, and the envelope after the width
|
|
107
|
+
and stretch controls. The values are linear and have no absolute level. The
|
|
108
|
+
formant stage must be enabled. The envelopes are those of the model that the
|
|
109
|
+
audio used for the last frame. The Rust method returns `Result<bool, Error>`.
|
|
110
|
+
If an argument is not valid, the method returns an error and does not change
|
|
111
|
+
the slices. If no model is available, the method returns `Ok(false)` and
|
|
112
|
+
fills both slices with zeros. Valid envelopes return `Ok(true)`.
|
|
113
|
+
|
|
114
|
+
`resynthesis.harmony.voices` sets the number of interval voices, in `0..=4`.
|
|
115
|
+
The default is 4. `FixedInterval` and `SmartInterval` use the first `voices`
|
|
116
|
+
voices. The other voices release with the usual gain envelope. The chord
|
|
117
|
+
and MIDI sources ignore this field.
|
|
118
|
+
|
|
92
119
|
`reset()` keeps the configuration, the random stream and some controller and
|
|
93
120
|
filter state. If you need a fully new state, construct a new processor.
|
|
94
121
|
|
|
@@ -189,10 +216,15 @@ npm pack
|
|
|
189
216
|
```
|
|
190
217
|
|
|
191
218
|
`npm pack` builds the Wasm bindings and the TypeScript entry point. Then it
|
|
192
|
-
creates `tunelet
|
|
193
|
-
Node.js project, install it with
|
|
194
|
-
|
|
195
|
-
|
|
219
|
+
creates `tunelet-<version>.tgz`. To use this archive in a browser project or
|
|
220
|
+
a Node.js project, install it with this command:
|
|
221
|
+
|
|
222
|
+
```sh
|
|
223
|
+
npm install /path/to/tunelet-<version>.tgz
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
For local use, it is not necessary to publish the package to npm. To build
|
|
227
|
+
without an archive, run `npm run build`.
|
|
196
228
|
|
|
197
229
|
The build writes one `web`-target binding into `pkg/` and the shared entry
|
|
198
230
|
into `dist/`. Git ignores both directories. The archive contains only these
|
|
@@ -229,18 +261,29 @@ during each call. Web Audio uses Float32 samples, which you must convert to
|
|
|
229
261
|
and from 16-bit PCM. This package does not install an AudioWorklet or an
|
|
230
262
|
integration with an audio device.
|
|
231
263
|
|
|
232
|
-
Configuration objects contain all fields. They use camelCase names
|
|
233
|
-
enums as string literals. To change the configuration, do these steps:
|
|
264
|
+
Configuration objects contain all required fields. They use camelCase names
|
|
265
|
+
and show enums as string literals. To change the configuration, do these steps:
|
|
234
266
|
|
|
235
267
|
1. Start from `defaultConfig()` or `config()`.
|
|
236
268
|
2. Edit the necessary fields.
|
|
237
269
|
3. Call `setConfig()`.
|
|
238
270
|
|
|
239
|
-
If a field is
|
|
240
|
-
`Error`. The
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
`
|
|
271
|
+
If a required field is absent or a value is not valid, the call throws a
|
|
272
|
+
JavaScript `Error`. The optional `resynthesis.harmony.voices` field defaults
|
|
273
|
+
to 4 if it is absent. The conversion ignores extra object properties. The
|
|
274
|
+
generated declarations contain the parameter documentation from the Rust
|
|
275
|
+
types. `resynthesis.randomSeed` and the `processedFrames` field of feedback
|
|
276
|
+
and telemetry use `bigint`. Frame offsets, block lengths and latency use
|
|
277
|
+
`number`.
|
|
278
|
+
|
|
279
|
+
`telemetry()` and `takeTelemetry()` return a `Telemetry` object.
|
|
280
|
+
`formantEnvelope(maxFrequencyHz, input, output)` fills two `Float32Array`
|
|
281
|
+
buffers of equal length and returns `false` if no envelope is available.
|
|
282
|
+
In that case, it fills both buffers with zeros. If the lengths are not equal
|
|
283
|
+
or the frequency is not valid, it throws and does not change the buffers. The
|
|
284
|
+
frequency must be finite, more than zero and not more than half of the sample
|
|
285
|
+
rate. The class keeps a buffer for the points, so only the first call and a
|
|
286
|
+
call with more points than before reserve memory.
|
|
244
287
|
|
|
245
288
|
In feedback, `targetMidiNote` is `undefined` in these cases, which are also
|
|
246
289
|
the cases where `voiced` is `false`:
|
|
@@ -269,7 +312,8 @@ Wasm. These items can allocate:
|
|
|
269
312
|
- Object conversion.
|
|
270
313
|
- Supplied events.
|
|
271
314
|
- Errors.
|
|
272
|
-
- Feedback.
|
|
315
|
+
- Feedback and telemetry.
|
|
316
|
+
- The formant envelopes.
|
|
273
317
|
|
|
274
318
|
The generated glue can also make temporary views. This binding is for general
|
|
275
319
|
use, and it does not guarantee hard real-time behavior for allocation or
|