cantor-digitalis 0.0.4 → 0.0.6
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 +36 -4
- package/dist/index.js +425 -239
- package/dist/index.js.map +1 -1
- package/dist/nodes/anti-resonance.d.ts +13 -2
- package/dist/nodes/anti-resonance.d.ts.map +1 -1
- package/dist/nodes/formant-bank.d.ts +14 -2
- package/dist/nodes/formant-bank.d.ts.map +1 -1
- package/dist/nodes/formant-resonator.d.ts +13 -2
- package/dist/nodes/formant-resonator.d.ts.map +1 -1
- package/dist/nodes/gain.d.ts +13 -2
- package/dist/nodes/gain.d.ts.map +1 -1
- package/dist/nodes/glottal-flow-derivative.d.ts +21 -2
- package/dist/nodes/glottal-flow-derivative.d.ts.map +1 -1
- package/dist/nodes/glottal-formant.d.ts +13 -2
- package/dist/nodes/glottal-formant.d.ts.map +1 -1
- package/dist/nodes/noise-source.d.ts +2 -2
- package/dist/nodes/noise-source.d.ts.map +1 -1
- package/dist/nodes/pulse-train.d.ts +13 -2
- package/dist/nodes/pulse-train.d.ts.map +1 -1
- package/dist/nodes/spectral-tilt.d.ts +16 -3
- package/dist/nodes/spectral-tilt.d.ts.map +1 -1
- package/dist/nodes/types.d.ts +1 -1
- package/dist/nodes/types.d.ts.map +1 -1
- package/dist/nodes/vocal-tract.d.ts +18 -2
- package/dist/nodes/vocal-tract.d.ts.map +1 -1
- package/dist/nodes/voice.d.ts +14 -2
- package/dist/nodes/voice.d.ts.map +1 -1
- package/dist/nodes/worklet-utils.d.ts +6 -4
- package/dist/nodes/worklet-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -203,7 +203,11 @@ pulseTrain.start();
|
|
|
203
203
|
|
|
204
204
|
## Frequency Response Analysis
|
|
205
205
|
|
|
206
|
-
All nodes provide
|
|
206
|
+
All nodes provide methods for computing magnitude response at specified frequencies, useful for visualisation and analysis.
|
|
207
|
+
|
|
208
|
+
### From Live Nodes
|
|
209
|
+
|
|
210
|
+
Use the member method to get the response based on current AudioParam values:
|
|
207
211
|
|
|
208
212
|
```typescript
|
|
209
213
|
import { linearToDb } from "cantor-digitalis";
|
|
@@ -212,15 +216,43 @@ import { linearToDb } from "cantor-digitalis";
|
|
|
212
216
|
const frequencies = Array.from({ length: 500 }, (_, i) => 20 * Math.pow(1000, i / 499));
|
|
213
217
|
|
|
214
218
|
// Get response from the complete voice...
|
|
215
|
-
const voiceResponse = voice.getFrequencyResponse(frequencies
|
|
219
|
+
const voiceResponse = voice.getFrequencyResponse(frequencies);
|
|
216
220
|
// ...or individual components
|
|
217
|
-
const tractResponse = voice.tract.getFrequencyResponse(frequencies
|
|
218
|
-
const f1Response = voice.tract.formants[0].getFrequencyResponse(frequencies
|
|
221
|
+
const tractResponse = voice.tract.getFrequencyResponse(frequencies);
|
|
222
|
+
const f1Response = voice.tract.formants[0].getFrequencyResponse(frequencies);
|
|
219
223
|
|
|
220
224
|
// Convert to dB for plotting
|
|
221
225
|
const responseDb = linearToDb(voiceResponse);
|
|
222
226
|
```
|
|
223
227
|
|
|
228
|
+
### Without AudioContext (Static Method)
|
|
229
|
+
|
|
230
|
+
Use the static method to compute frequency response from explicit parameters, without needing an AudioContext. This is useful for server-side rendering, web workers, or precomputing response curves before audio initialisation.
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { Voice, generateSynthParams, linearToDb } from "cantor-digitalis";
|
|
234
|
+
|
|
235
|
+
const frequencies = Array.from({ length: 500 }, (_, i) => 20 * Math.pow(1000, i / 499));
|
|
236
|
+
|
|
237
|
+
// Generate synth params
|
|
238
|
+
const synthParams = generateSynthParams({
|
|
239
|
+
pitch: 0.5,
|
|
240
|
+
pitchOffset: 60,
|
|
241
|
+
vocalEffort: 0.7,
|
|
242
|
+
vowelHeight: 0.5,
|
|
243
|
+
vowelBackness: 0.5,
|
|
244
|
+
tenseness: 0.5,
|
|
245
|
+
breathiness: 0.02,
|
|
246
|
+
roughness: 0.01,
|
|
247
|
+
vocalTractSize: 0.3,
|
|
248
|
+
isFalsetto: false,
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// Compute response without any AudioContext
|
|
252
|
+
const response = Voice.getFrequencyResponse(frequencies, synthParams);
|
|
253
|
+
const responseDb = linearToDb(response);
|
|
254
|
+
```
|
|
255
|
+
|
|
224
256
|
## License
|
|
225
257
|
|
|
226
258
|
ISC
|