@voicethere/agent 0.10.0 → 0.10.1
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/package.json +1 -1
- package/templates/mix-smoke/agent.ts +11 -2
package/package.json
CHANGED
|
@@ -41,9 +41,13 @@ export const FIXTURE_MARKER = "mix-smoke-fixture-a";
|
|
|
41
41
|
/** Inline clip: 16 kHz mono s16le — decoded size stays under 64 KiB play cap. */
|
|
42
42
|
export const CLIP_WAV_DURATION_MS = 2000;
|
|
43
43
|
export const CLIP_WAV_AMPLITUDE = 14_000;
|
|
44
|
+
export const CLIP_WAV_TONE_HZ = 440;
|
|
44
45
|
export const INLINE_CLIP_DUMMY_URL = "https://example.com/inline-clip.wav";
|
|
45
46
|
|
|
46
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Loud 440 Hz tone, mono WAV (s16le 16 kHz) for default inline clip play.
|
|
49
|
+
* Not a constant value: Opus removes DC, so a constant would arrive as two clicks.
|
|
50
|
+
*/
|
|
47
51
|
export function buildMixSmokeInlineClipBase64(
|
|
48
52
|
durationMs = CLIP_WAV_DURATION_MS,
|
|
49
53
|
amplitude = CLIP_WAV_AMPLITUDE,
|
|
@@ -68,7 +72,12 @@ export function buildMixSmokeInlineClipBase64(
|
|
|
68
72
|
buffer.write("data", 36);
|
|
69
73
|
buffer.writeUInt32LE(dataSize, 40);
|
|
70
74
|
for (let i = 0; i < numSamples; i++) {
|
|
71
|
-
buffer.writeInt16LE(
|
|
75
|
+
buffer.writeInt16LE(
|
|
76
|
+
Math.round(
|
|
77
|
+
amplitude * Math.sin((2 * Math.PI * CLIP_WAV_TONE_HZ * i) / sampleRate),
|
|
78
|
+
),
|
|
79
|
+
44 + i * 2,
|
|
80
|
+
);
|
|
72
81
|
}
|
|
73
82
|
return buffer.toString("base64");
|
|
74
83
|
}
|