support noise isolation

This commit is contained in:
xquanluu
2026-01-27 13:28:40 +07:00
parent 325af42946
commit f070f262db
5 changed files with 132 additions and 2 deletions

View File

@@ -19,7 +19,8 @@ class TaskConfig extends Task {
'vad',
'ttsStream',
'autoStreamTts',
'disableTtsCache'
'disableTtsCache',
'noiseIsolation'
].forEach((k) => this[k] = this.data[k] || {});
if ('notifyEvents' in this.data) {
@@ -90,6 +91,7 @@ class TaskConfig extends Task {
get hasNotifySttLatency() { return Object.keys(this.data).includes('notifySttLatency'); }
get hasTtsStream() { return Object.keys(this.ttsStream).length; }
get hasDisableTtsCache() { return Object.keys(this.data).includes('disableTtsCache'); }
get hasNoiseIsolation() { return Object.keys(this.data).includes('noiseIsolation'); }
get summary() {
const phrase = [];
@@ -128,6 +130,7 @@ class TaskConfig extends Task {
}
if ('autoStreamTts' in this.data) phrase.push(`enable Say.stream value ${this.data.autoStreamTts ? 'on' : 'off'}`);
if (this.hasDisableTtsCache) phrase.push(`disableTtsCache ${this.data.disableTtsCache ? 'on' : 'off'}`);
if (this.hasNoiseIsolation) phrase.push(`noiseIsolation ${this.noiseIsolation.enable ? 'on' : 'off'}`);
return `${this.name}{${phrase.join(',')}}`;
}
@@ -365,6 +368,17 @@ class TaskConfig extends Task {
this.logger.info(`set disableTtsCache = ${this.disableTtsCache}`);
cs.disableTtsCache = this.data.disableTtsCache;
}
if (this.hasNoiseIsolation) {
const {enable, ...opts} = this.noiseIsolation;
if (enable) {
this.logger.debug({opts}, 'Config: enabling noiseIsolation');
cs.startBackgroundTask('noiseIsolation', {verb: 'noiseIsolation', ...opts});
} else {
this.logger.info('Config: disabling noiseIsolation');
cs.stopBackgroundTask('noiseIsolation');
}
}
}
async kill(cs) {