@audio/shift-hybrid 1.0.2 → 1.1.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/audio.d.ts +28 -0
- package/audio.js +19 -0
- package/package.json +9 -2
package/audio.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Generated from the audio.js manifest (params metadata is the source of truth).
|
|
2
|
+
// Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
/** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
|
|
5
|
+
type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
|
|
6
|
+
/** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
|
|
7
|
+
type Live = Record<string, Float32Array | string | boolean>
|
|
8
|
+
type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
|
|
9
|
+
type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
|
|
10
|
+
|
|
11
|
+
/** Chainable-host options for 'pitchHybrid' */
|
|
12
|
+
export interface PitchHybridOptions {
|
|
13
|
+
/** -24..24 (default 0) */
|
|
14
|
+
"semitones"?: Auto
|
|
15
|
+
at?: number | string
|
|
16
|
+
duration?: number | string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare const pitchHybrid: {
|
|
20
|
+
(ctx: Ctx): Process
|
|
21
|
+
channels: "any"
|
|
22
|
+
streaming: false
|
|
23
|
+
tail: 0
|
|
24
|
+
params: {
|
|
25
|
+
/** -24..24 (default 0) */
|
|
26
|
+
"semitones": { type: "number", default: 0 }
|
|
27
|
+
}
|
|
28
|
+
}
|
package/audio.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// audio manifest — this one pitch shift per @audio/compile CONTRACT (tonal and transient parts each their own way: full mixes), so a host loads it
|
|
2
|
+
// alone: @audio/shift's pitch-shift chooses among every method and loads them all. Whole-render (streaming: false), as
|
|
3
|
+
// that umbrella hosts every method: the host buffers the input and calls process once.
|
|
4
|
+
|
|
5
|
+
import shift from './index.js'
|
|
6
|
+
|
|
7
|
+
export const pitchHybrid = (ctx) => {
|
|
8
|
+
return (inputs, outputs, params) => {
|
|
9
|
+
const inp = inputs[0], out = outputs[0]
|
|
10
|
+
if (!inp || !inp.length) return
|
|
11
|
+
for (let c = 0; c < inp.length; c++) out[c].set(shift(inp[c], { semitones: params.semitones[0], sampleRate: ctx.sampleRate, fs: ctx.sampleRate }))
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
pitchHybrid.channels = 'any'
|
|
15
|
+
pitchHybrid.streaming = false
|
|
16
|
+
pitchHybrid.tail = 0
|
|
17
|
+
pitchHybrid.params = {
|
|
18
|
+
semitones: { type: 'number', min: -24, max: 24, default: 0 },
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/shift-hybrid",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Hybrid pitch shift — runs phase-lock + WSOLA in parallel, crossfades by transient confidence",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./index.js",
|
|
10
|
+
"./audio": {
|
|
11
|
+
"types": "./audio.d.ts",
|
|
12
|
+
"default": "./audio.js"
|
|
13
|
+
},
|
|
10
14
|
"./package.json": "./package.json"
|
|
11
15
|
},
|
|
12
16
|
"files": [
|
|
13
17
|
"index.js",
|
|
18
|
+
"audio.d.ts",
|
|
19
|
+
"audio.js",
|
|
14
20
|
"host.js",
|
|
15
21
|
"index.d.ts"
|
|
16
22
|
],
|
|
@@ -43,5 +49,6 @@
|
|
|
43
49
|
"node": ">=18"
|
|
44
50
|
},
|
|
45
51
|
"funding": "https://github.com/sponsors/audiojs",
|
|
46
|
-
"types": "index.d.ts"
|
|
52
|
+
"types": "index.d.ts",
|
|
53
|
+
"audio": "./audio.js"
|
|
47
54
|
}
|