ly-ms-edge-tts
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -28,2 +28,5 @@ /// <reference types="node" /> | ||
private _startTime; | ||
private pitch; | ||
private rate; | ||
private volume; | ||
private readonly _agent; | ||
@@ -54,5 +57,8 @@ private _log; | ||
* @param outputFormat any {@link OUTPUT_FORMAT} | ||
* @param pitch (default 0) | ||
* @param volume (default 0) | ||
* @param rate (default 0) | ||
* @param voiceLocale (optional) any voice locale that is supported by the voice. See the list of all voices for compatibility. If not provided, the locale will be inferred from the `voiceName` | ||
*/ | ||
setMetadata(voiceName: string, outputFormat: OUTPUT_FORMAT, voiceLocale?: string): Promise<void>; | ||
setMetadata(voiceName: string, outputFormat: OUTPUT_FORMAT, pitch?: number, rate?: number, volume?: number, voiceLocale?: string): Promise<void>; | ||
private _metadataCheck; | ||
@@ -59,0 +65,0 @@ /** |
@@ -29,2 +29,5 @@ "use strict"; | ||
this._startTime = 0; | ||
this.pitch = 0; | ||
this.rate = 0; | ||
this.volume = 0; | ||
this._enableLogger = enableLogger; | ||
@@ -113,3 +116,3 @@ this._agent = agent; | ||
this._queue[requestId].push(audioData); | ||
this._log("receive audio chunk size: ", audioData === null || audioData === void 0 ? void 0 : audioData.length); | ||
// this._log("receive audio chunk size: ", audioData?.length) | ||
} | ||
@@ -119,3 +122,5 @@ _SSMLTemplate(input) { | ||
<voice name="${this._voice}"> | ||
${input} | ||
<prosody pitch='+${this.pitch}Hz' rate ='+${this.rate}%' volume='+${this.volume}%'> | ||
${input} | ||
</prosody> | ||
</voice> | ||
@@ -142,5 +147,8 @@ </speak>`; | ||
* @param outputFormat any {@link OUTPUT_FORMAT} | ||
* @param pitch (default 0) | ||
* @param volume (default 0) | ||
* @param rate (default 0) | ||
* @param voiceLocale (optional) any voice locale that is supported by the voice. See the list of all voices for compatibility. If not provided, the locale will be inferred from the `voiceName` | ||
*/ | ||
setMetadata(voiceName, outputFormat, voiceLocale) { | ||
setMetadata(voiceName, outputFormat, pitch = 0, rate = 0, volume = 0, voiceLocale) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -152,2 +160,5 @@ const oldVoice = this._voice; | ||
this._voiceLocale = voiceLocale; | ||
this.pitch = pitch; | ||
this.rate = rate; | ||
this.volume = volume; | ||
if (!this._voiceLocale) { | ||
@@ -154,0 +165,0 @@ const voiceLangMatch = MsEdgeTTS.VOICE_LANG_REGEX.exec(this._voice); |
@@ -12,17 +12,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const __1 = require(".."); | ||
const ms_tts = new __1.MsEdgeTTS(null, true); | ||
function test() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield ms_tts.setMetadata("zh-CN-XiaoxiaoNeural", __1.OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS, "zh-CN"); | ||
yield ms_tts.toFile("C:\\Users\\liangjinkang\\Desktop\\my\\workspace\\myproject\\MsEdgeTTS\\example_audio.webm", "你好世界"); | ||
yield ms_tts.toFile("C:\\Users\\liangjinkang\\Desktop\\my\\workspace\\myproject\\MsEdgeTTS\\example_audio.webm", "你好世界,你好世界"); | ||
setTimeout(() => __awaiter(this, void 0, void 0, function* () { | ||
yield ms_tts.toFile("C:\\Users\\liangjinkang\\Desktop\\my\\workspace\\myproject\\MsEdgeTTS\\example_audio.webm", "你好世界,你好世界,你好世界"); | ||
}), 40 * 1000); | ||
setTimeout(() => { | ||
console.log("finished"); | ||
}, 60 * 1000); | ||
}); | ||
} | ||
test(); | ||
const index_1 = require("../index"); | ||
(() => __awaiter(void 0, void 0, void 0, function* () { | ||
const tts = new index_1.MsEdgeTTS(null, true); | ||
yield tts.setMetadata("en-US-AriaNeural", index_1.OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS, 0, 100, 10); | ||
const filePath = yield tts.toFile("./example_audio.webm", "Hi, how are you?"); | ||
}))(); |
{ | ||
"name": "ly-ms-edge-tts", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "An Azure Speech Service module that uses the Microsoft Edge Read Aloud API.", | ||
"author": "guquanlengyue <guquanlengyue@gmail.com>", | ||
"license": "MIT", | ||
"author": "孤泉冷月 <guquanlengyue@gmail.com>", | ||
"license": "GPL-3.0-or-later", | ||
"repository": "https://github.com/guquan-lengyue/MsEdgeTTS.git", | ||
@@ -12,3 +12,3 @@ "private": false, | ||
"scripts": { | ||
"start": "yarn run build && node test/index.js", | ||
"start": "yarn run build && node src/test/index.js", | ||
"build": "tsc", | ||
@@ -15,0 +15,0 @@ "prepublishOnly": "yarn run build", |
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
34577
12
437
3
70