open-agents-ai 0.138.2 → 0.138.3
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/dist/index.js +20 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39875,20 +39875,30 @@ if __name__ == '__main__':
|
|
|
39875
39875
|
}
|
|
39876
39876
|
if (!existsSync35(wavPath))
|
|
39877
39877
|
return;
|
|
39878
|
-
|
|
39879
|
-
|
|
39880
|
-
|
|
39881
|
-
|
|
39882
|
-
|
|
39878
|
+
try {
|
|
39879
|
+
const wavData = readFileSync24(wavPath);
|
|
39880
|
+
if (wavData.length > 44) {
|
|
39881
|
+
const sampleRate = wavData.readUInt32LE(24);
|
|
39882
|
+
const samples = new Int16Array(wavData.buffer, wavData.byteOffset + 44, (wavData.length - 44) / 2);
|
|
39883
|
+
const fadeInSamples = Math.min(Math.round(sampleRate * 0.2), samples.length);
|
|
39884
|
+
for (let i = 0; i < fadeInSamples; i++) {
|
|
39885
|
+
samples[i] = Math.round(samples[i] * (i / fadeInSamples));
|
|
39886
|
+
}
|
|
39887
|
+
const fadeOutSamples = Math.min(Math.round(sampleRate * 0.05), samples.length);
|
|
39888
|
+
const fadeOutStart = samples.length - fadeOutSamples;
|
|
39889
|
+
for (let i = 0; i < fadeOutSamples; i++) {
|
|
39890
|
+
samples[fadeOutStart + i] = Math.round(samples[fadeOutStart + i] * (1 - i / fadeOutSamples));
|
|
39891
|
+
}
|
|
39892
|
+
if (volume !== 1) {
|
|
39883
39893
|
for (let i = 0; i < samples.length; i++) {
|
|
39884
39894
|
samples[i] = Math.round(samples[i] * volume);
|
|
39885
39895
|
}
|
|
39886
|
-
const header = wavData.subarray(0, 44);
|
|
39887
|
-
const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
|
|
39888
|
-
writeFileSync14(wavPath, scaled);
|
|
39889
39896
|
}
|
|
39890
|
-
|
|
39897
|
+
const header = wavData.subarray(0, 44);
|
|
39898
|
+
const scaled = Buffer.concat([header, Buffer.from(samples.buffer, samples.byteOffset, samples.byteLength)]);
|
|
39899
|
+
writeFileSync14(wavPath, scaled);
|
|
39891
39900
|
}
|
|
39901
|
+
} catch {
|
|
39892
39902
|
}
|
|
39893
39903
|
if (pitchFactor !== 1) {
|
|
39894
39904
|
try {
|
|
@@ -39936,6 +39946,7 @@ if __name__ == '__main__':
|
|
|
39936
39946
|
}
|
|
39937
39947
|
}
|
|
39938
39948
|
await this.playWav(wavPath);
|
|
39949
|
+
await this.sleep(80);
|
|
39939
39950
|
try {
|
|
39940
39951
|
unlinkSync8(wavPath);
|
|
39941
39952
|
} catch {
|
package/package.json
CHANGED