tunelet 0.1.1 → 0.3.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 CHANGED
@@ -1,32 +1,208 @@
1
1
  # tunelet
2
2
 
3
3
  tunelet is a Rust library for vocal pitch correction, choir, harmony,
4
- formant control and effects. Its input is mono signed 16-bit PCM at 44.1 kHz
5
- or 48 kHz. Its output is stereo or mono PCM. The default Rust build has no
6
- dependencies. For `wasm32-unknown-unknown`, the optional `wasm` feature gives
7
- JavaScript bindings and generated TypeScript declarations.
4
+ formant control and effects. It is also available as an npm package for
5
+ browsers and Node.js.
6
+
7
+ [![crates.io](https://img.shields.io/crates/v/tunelet.svg)](https://crates.io/crates/tunelet)
8
+ [![npm](https://img.shields.io/npm/v/tunelet.svg)](https://www.npmjs.com/package/tunelet)
9
+ [![docs.rs](https://img.shields.io/docsrs/tunelet)](https://docs.rs/tunelet)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
+
12
+ **[Website](https://tunelet.byteland.app)** ·
13
+ [crates.io](https://crates.io/crates/tunelet) ·
14
+ [npm](https://www.npmjs.com/package/tunelet) ·
15
+ [GitHub Packages](https://github.com/ByteLandTechnology/tunelet/pkgs/npm/tunelet) ·
16
+ [API documentation](https://docs.rs/tunelet)
17
+
18
+ ![The tunelet signal chain: Punch, Warm, pitch tracking and resynthesis, Alien, reverb and the output gain](docs/images/signal-chain.svg)
19
+
20
+ ## Contents
21
+
22
+ - [Features](#features)
23
+ - [Installation](#installation)
24
+ - [Quick start](#quick-start)
25
+ - [Signal chain](#signal-chain)
26
+ - [Process audio](#process-audio)
27
+ - [Timed events](#timed-events)
28
+ - [Lifecycle](#lifecycle)
29
+ - [Feedback and telemetry](#feedback-and-telemetry)
30
+ - [Real-time rules](#real-time-rules)
31
+ - [WebAssembly and TypeScript](#webassembly-and-typescript)
32
+ - [Build from source](#build-from-source)
33
+ - [License](#license)
34
+
35
+ ## Features
36
+
37
+ - **Pitch correction**: The processor moves the voice to the nearest note in
38
+ a scale. A MIDI keyboard can also select the notes.
39
+ - **Choir**: The processor adds a maximum of 15 voices with random pitch
40
+ drift and delay.
41
+ - **Harmony**: The processor adds a maximum of four voices from intervals,
42
+ chords or MIDI notes.
43
+ - **Formant control**: An LPC model changes the width and the length of the
44
+ vocal tract.
45
+ - **Effects**: Punch, Warm, Alien and six reverb modes are available.
46
+ - **Sample-exact output**: All stages use fixed-point arithmetic. The
47
+ same input, configuration and seed give the same samples.
48
+ - **Real-time safety**: After construction, the audio calls do not allocate
49
+ memory, acquire locks or do I/O.
50
+ - **No dependencies**: The default Rust build has no dependencies and uses
51
+ only safe Rust.
52
+
53
+ The input is mono signed 16-bit PCM at 44.1 kHz or 48 kHz. The output is
54
+ stereo or mono 16-bit PCM.
55
+
56
+ ## Installation
57
+
58
+ tunelet is available from these registries:
59
+
60
+ | Registry | Package | Use |
61
+ | --------------- | ----------------------------------------------------------------------------------------------- | ----------------- |
62
+ | crates.io | [`tunelet`](https://crates.io/crates/tunelet) | Rust |
63
+ | npm | [`tunelet`](https://www.npmjs.com/package/tunelet) | Browsers, Node.js |
64
+ | GitHub Packages | [`@bytelandtechnology/tunelet`](https://github.com/ByteLandTechnology/tunelet/pkgs/npm/tunelet) | Browsers, Node.js |
65
+
66
+ For Rust, add the crate:
8
67
 
9
- The processing chain has these stages, in this order:
68
+ ```sh
69
+ cargo add tunelet
70
+ ```
71
+
72
+ For browsers and Node.js, install the npm package:
73
+
74
+ ```sh
75
+ npm install tunelet
76
+ ```
77
+
78
+ The GitHub Packages registry has the same package with a scoped name. To
79
+ use it, add this line to the `.npmrc` file of your project:
80
+
81
+ ```ini
82
+ @bytelandtechnology:registry=https://npm.pkg.github.com
83
+ ```
84
+
85
+ Then install the package. GitHub Packages needs a token with the
86
+ `read:packages` scope, also for public packages.
87
+
88
+ ```sh
89
+ npm install @bytelandtechnology/tunelet
90
+ ```
91
+
92
+ If you use the scoped package, import from `@bytelandtechnology/tunelet`.
93
+
94
+ ## Quick start
95
+
96
+ ### Rust
97
+
98
+ ```rust
99
+ use tunelet::{
100
+ CorrectionScale, NoteMask, PitchClass, PrepareConfig, Processor, ProcessorConfig,
101
+ SampleRate,
102
+ };
103
+
104
+ fn main() -> Result<(), tunelet::Error> {
105
+ // 1. Set the sample rate and the largest block.
106
+ let rate = SampleRate::try_from(48_000)?;
107
+ let preparation = PrepareConfig::new(rate, 1024)?;
108
+
109
+ // 2. Start from the default configuration and change fields.
110
+ let mut config = ProcessorConfig::default();
111
+ config.resynthesis.correction.notes =
112
+ NoteMask::from_key_scale(PitchClass::A, CorrectionScale::Minor);
113
+ config.resynthesis.correction.retune_ms = 20.0;
114
+
115
+ // 3. Construct the processor. Only this step allocates memory.
116
+ let mut processor = Processor::new(preparation, config)?;
117
+
118
+ // 4. Process blocks. Each input sample gives one stereo frame.
119
+ let input = [0i16; 1024];
120
+ let mut output = [[0i16; 2]; 1024];
121
+ processor.process(&input, &mut output, &[])?;
122
+
123
+ // 5. After the last block, get the tail.
124
+ processor.begin_drain();
125
+ loop {
126
+ let frames = processor.drain(&mut output)?;
127
+ if frames == 0 {
128
+ break;
129
+ }
130
+ // Use only output[..frames].
131
+ }
132
+ Ok(())
133
+ }
134
+ ```
10
135
 
11
- 1. Punch
12
- 2. Warm
13
- 3. Pitch tracking, correction and voice resynthesis
14
- 4. Alien
15
- 5. Reverb
16
- 6. Output gain
136
+ ### TypeScript
17
137
 
18
- The default configuration enables chromatic pitch correction and uses one
19
- choir voice. It disables the effects and the formant stage.
138
+ ```ts
139
+ import { loadTunelet, Tunelet, defaultConfig } from "tunelet";
20
140
 
21
- ## Integration
141
+ await loadTunelet();
142
+ const config = defaultConfig();
143
+ config.resynthesis.pitchRatio = 1.25;
144
+ const processor = new Tunelet(48000, 1024, config);
22
145
 
23
- Add the repository as a Git dependency:
146
+ const input = new Int16Array(1024);
147
+ const left = new Int16Array(1024);
148
+ const right = new Int16Array(1024);
149
+ // Fill input with mono PCM before each call; reuse all three arrays.
150
+ processor.process(input, left, right);
24
151
 
25
- ```toml
26
- [dependencies]
27
- tunelet = { git = "https://github.com/ByteLandTechnology/tunelet.git" }
152
+ // After all processing and optional drain calls:
153
+ processor.free();
28
154
  ```
29
155
 
156
+ ## Signal chain
157
+
158
+ The processor sends each sample through these stages, in this order. The
159
+ default configuration enables chromatic pitch correction and one choir
160
+ voice. It disables the effects and the formant stage.
161
+
162
+ | Stage | Function | Default | Configuration field |
163
+ | -------------- | ----------------------------------------------------------- | -------------- | ------------------------ |
164
+ | Punch | Input gain and transient enhancement | Disabled | `punch` |
165
+ | Warm | Asymmetric saturation and a 50 Hz high-pass filter | Disabled | `warm` |
166
+ | Pitch tracking | Finds the pitch of the voice | Enabled | `resynthesis.pitch` |
167
+ | Correction | Moves the pitch to the nearest permitted note | Chromatic | `resynthesis.correction` |
168
+ | Voices | Renders a choir (1 to 16 voices) or harmony (lead and 0–4) | Choir, 1 voice | `resynthesis.mode` |
169
+ | Formant | Changes the vocal tract with an LPC model and aspiration | Disabled | `resynthesis.formant` |
170
+ | Alien | Plays recent audio in reverse loops | Disabled | `alien` |
171
+ | Reverb | Echo, Schroeder, SmallRoom, Binaural, MediumHall, LargeHall | Disabled | `reverb` |
172
+ | Output gain | Linear gain, 0..=64, before `-32767..=32767` clipping | 1 | `output_gain` |
173
+
174
+ The internal Q14 stages use `i64` products and saturate at the `i32`
175
+ limits. Decrease `output_gain` to prevent `-32767..=32767` clipping on
176
+ multi-voice mixes.
177
+
178
+ `resynthesis.dry_mix` sets the dry fraction at the resynthesis stage. The
179
+ dry path starts after Warm and has a delay of 1,543 frames.
180
+
181
+ ### Harmony sources
182
+
183
+ Set `resynthesis.mode` to `Harmony`. Then select the source of the voices
184
+ with `resynthesis.harmony.source`:
185
+
186
+ | Source | The voices follow |
187
+ | --------------- | ------------------------------------------------------ |
188
+ | `FixedInterval` | A fixed number of semitones from the singer |
189
+ | `SmartInterval` | An interval in scale steps, in a key and a scale |
190
+ | `ChordByDegree` | A chord on a scale degree |
191
+ | `ChordByName` | A named chord, for example `MinorSeventh` |
192
+ | `ChordViaMidi` | The active MIDI notes, as a chord |
193
+ | `MidiOmni` | MIDI notes from all channels, on the first free voice |
194
+ | `MidiChannels` | MIDI channel `n` for voice `n` (channels 0–3), default |
195
+
196
+ `resynthesis.harmony.voices` sets the number of interval voices, in `0..=4`.
197
+ The default is 4. `FixedInterval` and `SmartInterval` use the first `voices`
198
+ voices. The other voices release with the usual gain envelope. The chord
199
+ and MIDI sources ignore this field.
200
+
201
+ `resynthesis.harmony_gain` scales the four harmony voices in mono and in
202
+ stereo. It does not scale the lead voice.
203
+
204
+ ## Process audio
205
+
30
206
  To prepare a processor, do these steps:
31
207
 
32
208
  1. Use `SampleRate::try_from(hz)` to check the input rate.
@@ -35,7 +211,10 @@ To prepare a processor, do these steps:
35
211
  3. Create a `Processor` with that preparation and a `ProcessorConfig`.
36
212
 
37
213
  Configuration structures implement `Default`. To select voices and effects,
38
- edit their fields.
214
+ edit their fields. To change the sample rate or the block limit, make a new
215
+ processor.
216
+
217
+ Select the process function for your output layout:
39
218
 
40
219
  | Output layout | Function for input | Function for the tail |
41
220
  | ------------------------------ | ----------------------- | --------------------- |
@@ -43,74 +222,143 @@ edit their fields.
43
222
  | Separate left and right slices | `process_planar` | `drain_planar` |
44
223
  | Mono slice | `process_mono_in_place` | `drain_mono` |
45
224
 
46
- Each input sample gives one output frame. The channel lengths must be equal,
47
- and each call must fit in the prepared block limit. Short blocks and empty
48
- blocks are permitted. All operations that can fail do their validation before
49
- they change the state or the output.
225
+ These rules apply to each call:
226
+
227
+ - Each input sample gives one output frame.
228
+ - The channel lengths must be equal.
229
+ - The block must not be longer than the prepared block limit.
230
+ - Short blocks and empty blocks are permitted.
231
+ - If the call fails, the output and the state do not change.
232
+
233
+ ## Timed events
50
234
 
51
- To apply controls immediately before specific frames, give `TimedEvent`
52
- values. These rules apply to the offsets:
235
+ To apply a control immediately before a specific frame, give `TimedEvent`
236
+ values to the process call.
237
+
238
+ ![Timed events in a block of 16 frames](docs/images/timed-events.svg)
239
+
240
+ These rules apply to the offsets:
53
241
 
54
242
  - Offsets start at zero in each block.
55
243
  - Each offset must be in the block.
56
244
  - An offset must not be less than the offset before it.
57
245
 
58
246
  Events with equal offsets execute in slice order. An empty block accepts no
59
- events. Harmony MIDI uses `ControlEvent::Midi`. MIDI for the correction
60
- keyboard uses `ControlEvent::CorrectionMidi`.
247
+ events. A stage event replaces all settings of that stage. To change one
248
+ field, start from `processor.config()`.
61
249
 
62
- ## State and timing
250
+ Harmony MIDI uses `ControlEvent::Midi`. MIDI for the correction keyboard uses
251
+ `ControlEvent::CorrectionMidi`. For example, this event starts a harmony note
252
+ at frame 256:
63
253
 
64
- Construction allocates the storage of the processor. These operations do not
65
- allocate memory, acquire locks or do I/O:
254
+ ```rust
255
+ use tunelet::{ControlEvent, MidiEvent, TimedEvent};
66
256
 
67
- - Processing
68
- - Configuration
69
- - MIDI
70
- - Feedback
71
- - Reset
72
- - Drain
257
+ let events = [TimedEvent {
258
+ offset: 256,
259
+ event: ControlEvent::Midi(MidiEvent::NoteOn { channel: 0, note: 64, velocity: 100 }),
260
+ }];
261
+ processor.process(&input, &mut output, &events)?;
262
+ ```
263
+
264
+ ## Lifecycle
73
265
 
74
- The crate forbids unsafe Rust.
266
+ ![The processor lifecycle: construction, process calls, drain and reset](docs/images/lifecycle.svg)
75
267
 
76
- To get the tail after the last input block, do these steps:
268
+ ### Construction
269
+
270
+ Construction validates the configuration and allocates all the storage of
271
+ the processor. After construction, no call allocates memory.
272
+
273
+ ### Drain
274
+
275
+ The drain gives the tail of the reverb and the voices after the last input
276
+ block. To get the tail, do these steps:
77
277
 
78
278
  1. Call `begin_drain()` one time.
79
- 2. From each drain call, use only the frames that the call returns.
279
+ 2. Call `drain`, `drain_planar` or `drain_mono` until the call returns zero.
280
+ 3. From each drain call, use only the frames that the call returns.
80
281
 
81
282
  The drain fills the unused output with zeros. The drain has a finite budget,
82
- which can include silence. Completion resets the audio histories and the
83
- feedback. A successful call that processes audio or sets the configuration
84
- cancels the drain. `reset()` also cancels the drain.
283
+ `tail_frames()`, which can include silence. The last drain call resets the
284
+ audio histories and the feedback. A successful call that processes audio or
285
+ sets the configuration cancels the drain. `reset()` also cancels the drain.
85
286
 
86
- `feedback()` reads the pitch information, the stereo peak, the correction
87
- ratio, the frame count and the latency. `take_feedback()` also clears the
88
- peak window. `latency_frames()` gives 1,593 frames of nominal resynthesis
89
- latency at both sample rates. Dry mixes, resampled voices and effects have
90
- different timing.
287
+ ### Reset
91
288
 
92
289
  `reset()` keeps the configuration, the random stream and some controller and
93
290
  filter state. If you need a fully new state, construct a new processor.
94
291
 
95
- The API documentation gives the parameter ranges, the MIDI behavior and the
96
- reset semantics. To open it, run this command:
292
+ ## Feedback and telemetry
97
293
 
98
- ```sh
99
- cargo doc --locked --no-deps --open
100
- ```
294
+ These calls read the state of the processor. They do not change the audio.
101
295
 
102
- ## Build
296
+ | Call | Data |
297
+ | -------------------- | ----------------------------------------------------------------- |
298
+ | `feedback()` | The pitch, the stereo peak, the correction ratio, the frame count |
299
+ | `take_feedback()` | The same data as `feedback()`, and clears the peak window |
300
+ | `telemetry()` | Data for meters and displays (refer to the list below) |
301
+ | `take_telemetry()` | The same data as `telemetry()`, and clears its three peak windows |
302
+ | `latency_frames()` | 1,593 frames of nominal resynthesis latency at both sample rates |
303
+ | `formant_envelope()` | The LPC envelopes before and after the formant controls |
103
304
 
104
- To build the crate and check the format and the lints, run these commands:
305
+ The telemetry includes these items:
306
+
307
+ - The pitch ratio and the gain of each voice.
308
+ - The peaks of the input, of the two output channels and of the reverb wet
309
+ signal.
310
+ - The pitch clarity, which is a confidence score from 0 to 1.
311
+ - The current gains of Punch and Warm, and the position in the Alien loop.
312
+
313
+ The peak windows of the telemetry are independent of the peak window of the
314
+ feedback. The latency is nominal. Dry mixes, resampled voices and effects
315
+ have different timing.
316
+
317
+ `formant_envelope()` writes two LPC envelopes into slices of equal length:
318
+
319
+ - The vocal-tract envelope from the analysis.
320
+ - The envelope after the width and stretch controls.
321
+
322
+ The values are linear and have no absolute level. The formant stage must be
323
+ enabled. The envelopes are those of the model that the audio used for the
324
+ last frame. The method returns `Result<bool, Error>`:
325
+
326
+ | Result | Description |
327
+ | ----------- | ---------------------------------------------------------------- |
328
+ | `Ok(true)` | The slices contain valid envelopes. |
329
+ | `Ok(false)` | No model is available. The method fills both slices with zeros. |
330
+ | `Err(_)` | An argument is not valid. The method does not change the slices. |
331
+
332
+ ## Real-time rules
333
+
334
+ Construction allocates the storage of the processor. These operations do not
335
+ allocate memory, acquire locks or do I/O:
336
+
337
+ - Processing
338
+ - Configuration
339
+ - MIDI
340
+ - Feedback
341
+ - Telemetry
342
+ - Reset
343
+ - Drain
344
+
345
+ All operations that can fail do their validation before they change the
346
+ state or the output. The crate forbids unsafe Rust.
347
+
348
+ The API documentation gives the parameter ranges, the MIDI behavior and the
349
+ reset semantics. Read it on [docs.rs](https://docs.rs/tunelet), or run this
350
+ command:
105
351
 
106
352
  ```sh
107
- cargo build --locked --release
108
- cargo fmt --check
109
- cargo clippy --locked --lib -- -D warnings
353
+ cargo doc --locked --no-deps --open
110
354
  ```
111
355
 
112
356
  ## WebAssembly and TypeScript
113
357
 
358
+ For `wasm32-unknown-unknown`, the optional `wasm` feature of the crate gives
359
+ JavaScript bindings and generated TypeScript declarations. The npm package
360
+ contains these bindings.
361
+
114
362
  The npm package is one ES module for both browsers and Node.js. It contains
115
363
  these items:
116
364
 
@@ -118,29 +366,14 @@ these items:
118
366
  - The generated bindings.
119
367
  - A shared `loadTunelet` entry point.
120
368
 
121
- Both environments use the same imports and the same initialization call:
369
+ ### Load the module
122
370
 
123
- ```ts
124
- import { loadTunelet, Tunelet, defaultConfig } from "tunelet";
371
+ Both environments use the same imports and the same initialization call. An
372
+ import of the package does not load the binary. Call `loadTunelet()` before
373
+ you use `Tunelet` or `defaultConfig()`.
125
374
 
126
- await loadTunelet();
127
- const config = defaultConfig();
128
- config.resynthesis.pitchRatio = 1.25;
129
- const processor = new Tunelet(48000, 1024, config);
130
-
131
- const input = new Int16Array(1024);
132
- const left = new Int16Array(1024);
133
- const right = new Int16Array(1024);
134
- // Fill input with mono PCM before each call; reuse all three arrays.
135
- processor.process(input, left, right);
136
-
137
- // After all processing and optional drain calls:
138
- processor.free();
139
- ```
140
-
141
- Node.js reads the packaged binary from a file URL relative to the module.
142
- Browsers fetch the served Wasm asset. An import of the package does not load
143
- the binary. Call `loadTunelet()` before you use `Tunelet` or `defaultConfig()`.
375
+ - Node.js reads the packaged binary from a file URL relative to the module.
376
+ - Browsers fetch the served Wasm asset.
144
377
 
145
378
  Concurrent calls share one initialization promise. The package keeps the
146
379
  result of a successful initialization. If a load fails, the promise rejects,
@@ -166,6 +399,8 @@ initializer and `initSync`. The package root re-exports `initSync` too. Use
166
399
  only one initialization entry point for each module instance. The package
167
400
  gives only ESM exports. CommonJS applications can use `await import("tunelet")`.
168
401
 
402
+ ### Deployment
403
+
169
404
  Browser bundlers must keep or emit the Wasm asset that
170
405
  `new URL(..., import.meta.url)` refers to. For a browser deployment without a
171
406
  bundler, do these steps:
@@ -176,39 +411,7 @@ bundler, do these steps:
176
411
  Serve the assets over HTTP(S). The package does not support a local `file:`
177
412
  page that opens the JavaScript.
178
413
 
179
- ### Build the shared package
180
-
181
- Install Node.js and `wasm-pack`. Then run these commands to add the
182
- `wasm32-unknown-unknown` Rust target, install the development dependencies
183
- and make the archive:
184
-
185
- ```sh
186
- rustup target add wasm32-unknown-unknown
187
- npm ci
188
- npm pack
189
- ```
190
-
191
- `npm pack` builds the Wasm bindings and the TypeScript entry point. Then it
192
- creates `tunelet-0.1.1.tgz`. To use this archive in a browser project or a
193
- Node.js project, install it with `npm install /path/to/tunelet-0.1.1.tgz`. For
194
- local use, it is not necessary to publish the package to npm. To build without
195
- an archive, run `npm run build`.
196
-
197
- The build writes one `web`-target binding into `pkg/` and the shared entry
198
- into `dist/`. Git ignores both directories. The archive contains only these
199
- items:
200
-
201
- - The runtime entry.
202
- - The declarations.
203
- - The bindings.
204
- - The binary.
205
- - The package metadata.
206
- - The README.
207
-
208
- The `build:wasm` script uses `--no-opt`. This flag disables the separate
209
- Binaryen pass, but Rust still builds in release mode. The TypeScript and
210
- Node.js type declarations are only development dependencies. Native Rust
211
- builds use Cargo and do not need Node.js or npm.
414
+ ### TypeScript API
212
415
 
213
416
  | Operation | TypeScript API |
214
417
  | --------------------------------- | -------------------------------------------------------- |
@@ -218,29 +421,68 @@ builds use Cargo and do not need Node.js or npm.
218
421
  | Configuration | `config()`, `setConfig(config)`, `defaultConfig()` |
219
422
  | Information about the preparation | `sampleRate`, `maxBlockFrames`, `latencyFrames` |
220
423
  | Feedback | `feedback()`, `takeFeedback()` |
424
+ | Telemetry | `telemetry()`, `takeTelemetry()` |
425
+ | Formant envelopes | `formantEnvelope(maxFrequencyHz, input, output)` |
221
426
  | Finite tail | `beginDrain()`, `drain(left, right)`, `drainMono(audio)` |
222
427
  | Configured tail budget | `tailFrames()` |
223
428
  | Reset or release memory | `reset()`, `free()` |
224
429
 
430
+ ### Audio buffers
431
+
225
432
  All audio buffers are `Int16Array` buffers, and they must fit in the prepared
226
- frame limit. Stereo output arrays must not overlap. The input can overlap an
227
- output, because the binding copies the input first. Buffers must stay attached
228
- during each call. Web Audio uses Float32 samples, which you must convert to
229
- and from 16-bit PCM. This package does not install an AudioWorklet or an
230
- integration with an audio device.
433
+ frame limit. These rules apply:
434
+
435
+ - Stereo output arrays must not overlap.
436
+ - The input can overlap an output, because the binding copies the input
437
+ first.
438
+ - Buffers must stay attached during each call.
231
439
 
232
- Configuration objects contain all fields. They use camelCase names and show
233
- enums as string literals. To change the configuration, do these steps:
440
+ Web Audio uses Float32 samples, which you must convert to and from 16-bit
441
+ PCM. This package does not install an AudioWorklet or an integration with an
442
+ audio device.
443
+
444
+ ### Configuration objects
445
+
446
+ Configuration objects contain all required fields. They use camelCase names
447
+ and show enums as string literals. To change the configuration, do these steps:
234
448
 
235
449
  1. Start from `defaultConfig()` or `config()`.
236
450
  2. Edit the necessary fields.
237
451
  3. Call `setConfig()`.
238
452
 
239
- If a field is missing or a value is not valid, the call throws a JavaScript
240
- `Error`. The conversion ignores extra object properties. The generated
241
- declarations contain the parameter documentation from the Rust types.
242
- `resynthesis.randomSeed` and the `processedFrames` field of feedback use
243
- `bigint`. Frame offsets, block lengths and latency use `number`.
453
+ If a required field is absent or a value is not valid, the call throws a
454
+ JavaScript `Error`. The optional `resynthesis.harmony.voices` field defaults
455
+ to 4 if it is absent. The conversion ignores extra object properties. The
456
+ generated declarations contain the parameter documentation from the Rust
457
+ types.
458
+
459
+ `resynthesis.randomSeed` and the `processedFrames` field of feedback and
460
+ telemetry use `bigint`. Frame offsets, block lengths and latency use
461
+ `number`.
462
+
463
+ ### Events
464
+
465
+ The optional event argument is a `TimedEvent[]`. Controls use a `type`
466
+ discriminant and a `value` payload. The reset control has no payload. For
467
+ example, this event changes the final gain before the first frame:
468
+
469
+ ```ts
470
+ { offset: 0, event: { type: "outputGain", value: 0.5 } }
471
+ ```
472
+
473
+ A harmony Note On event has this form:
474
+
475
+ ```ts
476
+ { offset: 0, event: { type: "midi", value: { type: "noteOn", channel: 0, note: 60, velocity: 100 } } }
477
+ ```
478
+
479
+ Use `correctionMidi` for the separate correction keyboard. The native rules
480
+ for event order and for the validation of the whole block also apply to these
481
+ bindings.
482
+
483
+ ### Feedback, telemetry and formant envelopes
484
+
485
+ `telemetry()` and `takeTelemetry()` return a `Telemetry` object.
244
486
 
245
487
  In feedback, `targetMidiNote` is `undefined` in these cases, which are also
246
488
  the cases where `voiced` is `false`:
@@ -250,16 +492,15 @@ the cases where `voiced` is `false`:
250
492
  - The estimated frequency is outside the inclusive reporting bounds
251
493
  `resynthesis.pitch.minFrequencyHz` and `resynthesis.pitch.maxFrequencyHz`.
252
494
 
253
- The optional event argument is a `TimedEvent[]`. Controls use a `type`
254
- discriminant and a `value` payload. The reset control has no payload. For
255
- example, `{ offset: 0, event: { type: "outputGain", value: 0.5 } }` changes
256
- the final gain before the first frame.
495
+ `formantEnvelope(maxFrequencyHz, input, output)` fills two `Float32Array`
496
+ buffers of equal length and returns `false` if no envelope is available.
497
+ In that case, it fills both buffers with zeros. If the lengths are not equal
498
+ or the frequency is not valid, it throws and does not change the buffers. The
499
+ frequency must be finite, more than zero and not more than half of the sample
500
+ rate. The class keeps a buffer for the points, so only the first call and a
501
+ call with more points than before reserve memory.
257
502
 
258
- A harmony Note On event uses
259
- `{ offset: 0, event: { type: "midi", value: { type: "noteOn", channel: 0, note: 60, velocity: 100 } } }`.
260
- Use `correctionMidi` for the separate correction keyboard. The native rules
261
- for event order and for the validation of the whole block also apply to these
262
- bindings.
503
+ ### Memory allocation
263
504
 
264
505
  The constructor allocates reusable PCM buffers. A successful call that
265
506
  processes audio without events does not allocate new Rust PCM storage.
@@ -269,13 +510,64 @@ Wasm. These items can allocate:
269
510
  - Object conversion.
270
511
  - Supplied events.
271
512
  - Errors.
272
- - Feedback.
513
+ - Feedback and telemetry.
514
+ - The formant envelopes.
273
515
 
274
516
  The generated glue can also make temporary views. This binding is for general
275
517
  use, and it does not guarantee hard real-time behavior for allocation or
276
518
  scheduling. Drain completion and reset keep the same state as the equivalent
277
519
  Rust functions.
278
520
 
521
+ ## Build from source
522
+
523
+ ### Rust crate
524
+
525
+ To build the crate and check the format and the lints, run these commands:
526
+
527
+ ```sh
528
+ cargo build --locked --release
529
+ cargo fmt --check
530
+ cargo clippy --locked --lib -- -D warnings
531
+ ```
532
+
533
+ Native Rust builds use Cargo and do not need Node.js or npm.
534
+
535
+ ### npm package
536
+
537
+ Install Node.js and `wasm-pack`. Then run these commands to add the
538
+ `wasm32-unknown-unknown` Rust target, install the development dependencies
539
+ and make the archive:
540
+
541
+ ```sh
542
+ rustup target add wasm32-unknown-unknown
543
+ npm ci
544
+ npm pack
545
+ ```
546
+
547
+ `npm pack` builds the Wasm bindings and the TypeScript entry point. Then it
548
+ creates `tunelet-<version>.tgz`. To use this archive in a browser project or
549
+ a Node.js project, install it with this command:
550
+
551
+ ```sh
552
+ npm install /path/to/tunelet-<version>.tgz
553
+ ```
554
+
555
+ To build without an archive, run `npm run build`. The build writes one
556
+ `web`-target binding into `pkg/` and the shared entry into `dist/`. Git
557
+ ignores both directories. The archive contains only these items:
558
+
559
+ - The runtime entry.
560
+ - The declarations.
561
+ - The bindings.
562
+ - The binary.
563
+ - The package metadata.
564
+ - The README.
565
+
566
+ The `build:wasm` script builds the crate in release mode with LTO and one
567
+ codegen unit. Then `wasm-pack` runs Binaryen `wasm-opt` on
568
+ `pkg/tunelet_bg.wasm`. The TypeScript and Node.js type declarations are only
569
+ development dependencies.
570
+
279
571
  ## License
280
572
 
281
573
  tunelet is available under the MIT License. Refer to [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tunelet",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Vocal pitch correction, choir, harmony, formant control and effects for WebAssembly",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -29,9 +29,10 @@
29
29
  "sideEffects": false,
30
30
  "scripts": {
31
31
  "build": "npm run build:wasm && npm run build:ts",
32
- "build:wasm": "wasm-pack build --target web --out-dir pkg --release --no-opt --features wasm --locked",
32
+ "build:wasm": "wasm-pack build --target web --out-dir pkg --release --no-pack --features wasm --locked && node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('pkg/.gitignore', { force: true })\"",
33
33
  "build:ts": "tsc",
34
- "prepack": "npm run build"
34
+ "prepack": "npm run build",
35
+ "verify:pack": "node scripts/verify-pack.mjs"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/node": "^22.20.5",
package/pkg/tunelet.d.ts CHANGED
@@ -150,6 +150,134 @@ export interface Feedback {
150
150
  latencyFrames: number;
151
151
  }
152
152
 
153
+ /**
154
+ * A snapshot of the voices, the levels and the effect state that you can
155
+ * copy.
156
+ *
157
+ * Get it with [`Processor::telemetry`] or [`Processor::take_telemetry`]. The
158
+ * telemetry is for meters and displays. No audio calculation reads it.
159
+ * `Default` gives a snapshot with all zeros.
160
+ *
161
+ * The three peak fields measure a window. The window starts at
162
+ * construction, at a reset, at a change of stereo output or at a call to
163
+ * [`Processor::take_telemetry`]. This window is independent of the peak
164
+ * window of [`Feedback`].
165
+ */
166
+ export interface Telemetry {
167
+ /**
168
+ * The number of frames processed since construction or the last reset,
169
+ * as [`Feedback::processed_frames`] gives.
170
+ */
171
+ processedFrames: bigint;
172
+ /**
173
+ * The largest absolute input sample in the window, divided by 32768.
174
+ *
175
+ * The measurement is before Punch and Warm. The value is in 0..=1.
176
+ */
177
+ inputPeak: number;
178
+ /**
179
+ * The largest absolute clipped sample of the left and the right output
180
+ * in the window, divided by 32768.
181
+ *
182
+ * The measurement is after the output gain. Each value is in
183
+ * 0..=32767/32768.
184
+ */
185
+ outputPeak: [number, number];
186
+ /**
187
+ * The largest absolute wet contribution of the reverb in the window,
188
+ * where 1 is full scale.
189
+ *
190
+ * The contribution is the wet signal times the mix, before the output
191
+ * gain. It is the larger of the two channels. While the reverb is
192
+ * disabled, the window gets no new values.
193
+ */
194
+ reverbWetPeak: number;
195
+ /**
196
+ * How periodic the tracked input is, in 0..=1.
197
+ *
198
+ * The value is 1 for a signal that repeats exactly at the tracked
199
+ * period. It is 0 for a signal with no relation between cycles and
200
+ * during pitch acquisition. Use it as a confidence score for
201
+ * [`Feedback::voiced`]. The tracker updates the related sums on each
202
+ * frame.
203
+ */
204
+ clarity: number;
205
+ /**
206
+ * This field is `true` if the pitch tracker follows a period. It is
207
+ * `false` during pitch acquisition.
208
+ */
209
+ tracking: boolean;
210
+ /**
211
+ * The number of valid entries in [`voice_ratios`](Self::voice_ratios)
212
+ * and [`voice_gains`](Self::voice_gains).
213
+ *
214
+ * The value is 5 in Harmony mode. In Choir mode, it is
215
+ * [`crate::ResynthesisConfig::choir_voices`], in 1..=16.
216
+ */
217
+ voiceCount: number;
218
+ /**
219
+ * The pitch ratio of each voice on the last frame, where 1 is the input
220
+ * pitch.
221
+ *
222
+ * Entry zero is the lead voice. In Harmony mode, entries 1 to 4 are the
223
+ * harmony voices. In Choir mode, the entries after the lead are the
224
+ * secondary voices. Each ratio includes the correction, the configured
225
+ * pitch shift and the ratio of the voice. The entries after
226
+ * [`voice_count`](Self::voice_count) are zero.
227
+ */
228
+ voiceRatios: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
229
+ /**
230
+ * The linear gain of each voice, in the order of
231
+ * [`voice_ratios`](Self::voice_ratios).
232
+ *
233
+ * The lead and the choir voices have a gain of 1. The gain of a harmony
234
+ * voice includes the MIDI velocity gain, in 0..=3.98095703125. MIDI
235
+ * velocity 127 gives the maximum, approximately +12 dB. The gain is zero
236
+ * for a voice that does not sound. It does not include the configured
237
+ * harmony level or the pan. The harmony controller updates it every 101
238
+ * frames.
239
+ */
240
+ voiceGains: [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
241
+ /**
242
+ * The current drive of Punch, divided by its base drive.
243
+ *
244
+ * The value is the ratio of the two input envelopes times the
245
+ * configured input gain. It is more than 1 at an attack. Punch updates
246
+ * it every 100 frames. The value is 1 while Punch is disabled.
247
+ */
248
+ punchGain: number;
249
+ /**
250
+ * The linear gain that Warm applies before its saturation curve and
251
+ * removes after it.
252
+ *
253
+ * The value is the inverse of the input peak envelope. For input below
254
+ * -30 dB, it is the gain of +30 dB. Warm updates it every 100 frames.
255
+ * The value is 1 while Warm is disabled.
256
+ */
257
+ warmGain: number;
258
+ /**
259
+ * The length of the Alien loop in frames, as
260
+ * [`crate::AlienConfig::loop_frames`] gives.
261
+ */
262
+ alienLoopFrames: number;
263
+ /**
264
+ * The current frame in the Alien loop. It is less than
265
+ * [`alien_loop_frames`](Self::alien_loop_frames).
266
+ *
267
+ * The reverse reader is two times this number of frames behind the
268
+ * recording position. The value advances also while Alien is disabled.
269
+ */
270
+ alienPhaseFrames: number;
271
+ /**
272
+ * The wrapping count of formant analyses since construction.
273
+ *
274
+ * The count increases every 441 frames while the formant stage is
275
+ * enabled. Compare two values to find if
276
+ * [`Processor::formant_envelope`] can give a new result.
277
+ */
278
+ formantGeneration: number;
279
+ }
280
+
153
281
  /**
154
282
  * Asymmetric input saturation, followed by a 50 Hz high-pass filter.
155
283
  *
@@ -255,6 +383,7 @@ export type Inversion = "root" | "first" | "second";
255
383
  * - A tonic major chord in root position.
256
384
  * - A register of 50%.
257
385
  * - A closed voicing and zero portamento.
386
+ * - Four voices for the interval sources.
258
387
  *
259
388
  * These settings configure all sources. Only the fields for the selected
260
389
  * source change the target notes. Validation always checks all fields.
@@ -338,6 +467,16 @@ export interface HarmonyConfig {
338
467
  * semitone bin, each voice starts at its new target without a glide.
339
468
  */
340
469
  portamentoMs: number;
470
+ /**
471
+ * The number of voices that sound in the interval sources, 0..=4.
472
+ *
473
+ * The default is 4. [`HarmonySource::FixedInterval`] and
474
+ * [`HarmonySource::SmartInterval`] use the first `voices` voices. The
475
+ * other voices release with the usual gain envelope. The chord and MIDI
476
+ * sources ignore this field. In JavaScript, the field is optional and
477
+ * a missing value gives the default.
478
+ */
479
+ voices?: number;
341
480
  }
342
481
 
343
482
  /**
@@ -441,11 +580,11 @@ export interface ResynthesisConfig {
441
580
  */
442
581
  harmony: HarmonyConfig;
443
582
  /**
444
- * The pan gain of the harmony voices, 0..=1. The default is 0.5.
583
+ * The linear gain of the four harmony voices, 0..=1. The default is 0.5.
445
584
  *
446
- * The code applies this gain only if `stereo_output` is `true`. The
447
- * harmony path without pan does not use this control. It does not scale
448
- * the lead voice.
585
+ * If `stereo_output` is `true`, the stereo pan gains include this gain.
586
+ * If `stereo_output` is `false`, this gain scales each harmony voice
587
+ * directly. It does not scale the lead voice.
449
588
  */
450
589
  harmonyGain: number;
451
590
  /**
@@ -901,6 +1040,34 @@ export class Tunelet {
901
1040
  * If the conversion to a JavaScript object fails, this method throws.
902
1041
  */
903
1042
  feedback(): Feedback;
1043
+ /**
1044
+ * Writes the formant envelopes of the current model into two
1045
+ * `Float32Array` buffers of equal length.
1046
+ *
1047
+ * `input` gets the vocal-tract envelope that the LPC analysis found.
1048
+ * `output` gets the envelope after the width and stretch controls. Point
1049
+ * `k` of `n` is at the frequency `maxFrequencyHz * k / (n - 1)`. The
1050
+ * values are linear magnitudes with no absolute level. Scale them for a
1051
+ * display.
1052
+ *
1053
+ * `maxFrequencyHz` must be finite, more than zero and not more than half
1054
+ * of the sample rate.
1055
+ *
1056
+ * The method returns `true` if the envelopes are valid. It returns
1057
+ * `false` and fills the two arrays with zeros if the formant stage is
1058
+ * disabled or if the current model has no synthesis filter. The audio
1059
+ * does not change.
1060
+ *
1061
+ * The class keeps a buffer for the points. Only the first call and a
1062
+ * call with more points than before reserve memory.
1063
+ *
1064
+ * # Errors
1065
+ *
1066
+ * The method throws if the array lengths are not equal, if the frequency
1067
+ * is not valid or if the reservation of the buffer fails. The arrays
1068
+ * then do not change.
1069
+ */
1070
+ formantEnvelope(max_frequency_hz: number, input: Float32Array, output: Float32Array): boolean;
904
1071
  /**
905
1072
  * Prepares a processor and its reusable PCM buffers.
906
1073
  *
@@ -995,6 +1162,31 @@ export class Tunelet {
995
1162
  * object.
996
1163
  */
997
1164
  takeFeedback(): Feedback;
1165
+ /**
1166
+ * Returns the telemetry and clears only its three peak windows.
1167
+ *
1168
+ * The peak window of the feedback and all audio histories do not change.
1169
+ *
1170
+ * # Errors
1171
+ *
1172
+ * If the conversion to a JavaScript object fails, this method throws. The
1173
+ * method clears the peaks only after it successfully makes a telemetry
1174
+ * object.
1175
+ */
1176
+ takeTelemetry(): Telemetry;
1177
+ /**
1178
+ * Returns a new telemetry object and does not clear its peak windows.
1179
+ *
1180
+ * The telemetry is for meters and displays. It gives the ratio and the
1181
+ * gain of each voice, the input and output peaks, the pitch clarity and
1182
+ * the state of the effects. `processedFrames` is a `bigint`. See
1183
+ * `Telemetry` for each measurement.
1184
+ *
1185
+ * # Errors
1186
+ *
1187
+ * If the conversion to a JavaScript object fails, this method throws.
1188
+ */
1189
+ telemetry(): Telemetry;
998
1190
  /**
999
1191
  * The nominal resynthesis delay in frames.
1000
1192
  *
@@ -1042,6 +1234,7 @@ export interface InitOutput {
1042
1234
  readonly tunelet_drain: (a: number, b: any, c: any) => [number, number, number];
1043
1235
  readonly tunelet_drainMono: (a: number, b: any) => [number, number, number];
1044
1236
  readonly tunelet_feedback: (a: number) => [number, number, number];
1237
+ readonly tunelet_formantEnvelope: (a: number, b: number, c: any, d: any) => [number, number, number];
1045
1238
  readonly tunelet_latencyFrames: (a: number) => number;
1046
1239
  readonly tunelet_maxBlockFrames: (a: number) => number;
1047
1240
  readonly tunelet_new: (a: number, b: number, c: number) => [number, number, number];
@@ -1052,6 +1245,8 @@ export interface InitOutput {
1052
1245
  readonly tunelet_setConfig: (a: number, b: any) => [number, number];
1053
1246
  readonly tunelet_tailFrames: (a: number) => number;
1054
1247
  readonly tunelet_takeFeedback: (a: number) => [number, number, number];
1248
+ readonly tunelet_takeTelemetry: (a: number) => [number, number, number];
1249
+ readonly tunelet_telemetry: (a: number) => [number, number, number];
1055
1250
  readonly __wbindgen_malloc: (a: number, b: number) => number;
1056
1251
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
1057
1252
  readonly __wbindgen_exn_store: (a: number) => void;
package/pkg/tunelet.js CHANGED
@@ -134,6 +134,44 @@ export class Tunelet {
134
134
  }
135
135
  return takeFromExternrefTable0(ret[0]);
136
136
  }
137
+ /**
138
+ * Writes the formant envelopes of the current model into two
139
+ * `Float32Array` buffers of equal length.
140
+ *
141
+ * `input` gets the vocal-tract envelope that the LPC analysis found.
142
+ * `output` gets the envelope after the width and stretch controls. Point
143
+ * `k` of `n` is at the frequency `maxFrequencyHz * k / (n - 1)`. The
144
+ * values are linear magnitudes with no absolute level. Scale them for a
145
+ * display.
146
+ *
147
+ * `maxFrequencyHz` must be finite, more than zero and not more than half
148
+ * of the sample rate.
149
+ *
150
+ * The method returns `true` if the envelopes are valid. It returns
151
+ * `false` and fills the two arrays with zeros if the formant stage is
152
+ * disabled or if the current model has no synthesis filter. The audio
153
+ * does not change.
154
+ *
155
+ * The class keeps a buffer for the points. Only the first call and a
156
+ * call with more points than before reserve memory.
157
+ *
158
+ * # Errors
159
+ *
160
+ * The method throws if the array lengths are not equal, if the frequency
161
+ * is not valid or if the reservation of the buffer fails. The arrays
162
+ * then do not change.
163
+ * @param {number} max_frequency_hz
164
+ * @param {Float32Array} input
165
+ * @param {Float32Array} output
166
+ * @returns {boolean}
167
+ */
168
+ formantEnvelope(max_frequency_hz, input, output) {
169
+ const ret = wasm.tunelet_formantEnvelope(this.__wbg_ptr, max_frequency_hz, input, output);
170
+ if (ret[2]) {
171
+ throw takeFromExternrefTable0(ret[1]);
172
+ }
173
+ return ret[0] !== 0;
174
+ }
137
175
  /**
138
176
  * The nominal resynthesis delay in frames.
139
177
  *
@@ -305,6 +343,45 @@ export class Tunelet {
305
343
  }
306
344
  return takeFromExternrefTable0(ret[0]);
307
345
  }
346
+ /**
347
+ * Returns the telemetry and clears only its three peak windows.
348
+ *
349
+ * The peak window of the feedback and all audio histories do not change.
350
+ *
351
+ * # Errors
352
+ *
353
+ * If the conversion to a JavaScript object fails, this method throws. The
354
+ * method clears the peaks only after it successfully makes a telemetry
355
+ * object.
356
+ * @returns {Telemetry}
357
+ */
358
+ takeTelemetry() {
359
+ const ret = wasm.tunelet_takeTelemetry(this.__wbg_ptr);
360
+ if (ret[2]) {
361
+ throw takeFromExternrefTable0(ret[1]);
362
+ }
363
+ return takeFromExternrefTable0(ret[0]);
364
+ }
365
+ /**
366
+ * Returns a new telemetry object and does not clear its peak windows.
367
+ *
368
+ * The telemetry is for meters and displays. It gives the ratio and the
369
+ * gain of each voice, the input and output peaks, the pitch clarity and
370
+ * the state of the effects. `processedFrames` is a `bigint`. See
371
+ * `Telemetry` for each measurement.
372
+ *
373
+ * # Errors
374
+ *
375
+ * If the conversion to a JavaScript object fails, this method throws.
376
+ * @returns {Telemetry}
377
+ */
378
+ telemetry() {
379
+ const ret = wasm.tunelet_telemetry(this.__wbg_ptr);
380
+ if (ret[2]) {
381
+ throw takeFromExternrefTable0(ret[1]);
382
+ }
383
+ return takeFromExternrefTable0(ret[0]);
384
+ }
308
385
  }
309
386
  if (Symbol.dispose) Tunelet.prototype[Symbol.dispose] = Tunelet.prototype.free;
310
387
 
@@ -485,6 +562,10 @@ function __wbg_get_imports() {
485
562
  const ret = Symbol.iterator;
486
563
  return ret;
487
564
  },
565
+ __wbg_length_58572db4c38f3c3e: function(arg0) {
566
+ const ret = arg0.length;
567
+ return ret;
568
+ },
488
569
  __wbg_length_7f3c00c40364105e: function(arg0) {
489
570
  const ret = arg0.length;
490
571
  return ret;
@@ -523,6 +604,9 @@ function __wbg_get_imports() {
523
604
  __wbg_prototypesetcall_f8d32a400a944612: function(arg0, arg1, arg2) {
524
605
  Int16Array.prototype.set.call(getArrayI16FromWasm0(arg0, arg1), arg2);
525
606
  },
607
+ __wbg_set_070bd465f1c195a4: function(arg0, arg1, arg2) {
608
+ arg0.set(getArrayF32FromWasm0(arg1, arg2));
609
+ },
526
610
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
527
611
  arg0[arg1] = arg2;
528
612
  },
@@ -647,6 +731,11 @@ function debugString(val) {
647
731
  return className;
648
732
  }
649
733
 
734
+ function getArrayF32FromWasm0(ptr, len) {
735
+ ptr = ptr >>> 0;
736
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
737
+ }
738
+
650
739
  function getArrayI16FromWasm0(ptr, len) {
651
740
  ptr = ptr >>> 0;
652
741
  return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
@@ -665,6 +754,14 @@ function getDataViewMemory0() {
665
754
  return cachedDataViewMemory0;
666
755
  }
667
756
 
757
+ let cachedFloat32ArrayMemory0 = null;
758
+ function getFloat32ArrayMemory0() {
759
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
760
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
761
+ }
762
+ return cachedFloat32ArrayMemory0;
763
+ }
764
+
668
765
  let cachedInt16ArrayMemory0 = null;
669
766
  function getInt16ArrayMemory0() {
670
767
  if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
@@ -776,6 +873,7 @@ function __wbg_finalize_init(instance, module) {
776
873
  wasm = instance.exports;
777
874
  wasmModule = module;
778
875
  cachedDataViewMemory0 = null;
876
+ cachedFloat32ArrayMemory0 = null;
779
877
  cachedInt16ArrayMemory0 = null;
780
878
  cachedUint8ArrayMemory0 = null;
781
879
  wasm.__wbindgen_start();
Binary file