Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat override synthesizer options from config #590

Closed
wants to merge 5 commits into from

Conversation

xquanluu
Copy link
Contributor

@xquanluu xquanluu commented Jan 5, 2024

@xquanluu xquanluu marked this pull request as draft January 5, 2024 14:36
@xquanluu xquanluu marked this pull request as ready for review January 5, 2024 14:48
@xquanluu
Copy link
Contributor Author

xquanluu commented Jan 5, 2024

Tested on jambonz.me

lib/tasks/say.js Outdated
@@ -68,6 +68,12 @@ class TaskSay extends Task {
const salt = cs.callSid;

let credentials = cs.getSpeechCredentials(vendor, 'tts', label);

// override Synthesizer options from config verb
if (cs.synthesizer && cs.synthesizer.options) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xquanluu I would add these conditions:

  • call session synthesizer options are only applied, when there is no say.synthesizer.options
  • at least one "key" must be present in call session synthesizer options
if (Object.keys(this.options).length === 0 && cs.synthesizer && cs.synthesizer.options && Object.keys(cs.synthesizer.options).length > 0) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Catharsis68 for the review:
1/ call session synthesizer options are only applied, when there is no say.synthesizer.options
--> This seem to me we violate the rule for config verb to override configuration from other verb.

2/ at least one "key" must be present in call session synthesizer options
--> Do you know any case that user use config verb to put {} empty configuration, IMHO I think there is 2 normal case there is synthesizer.options and there is no synthesizer.options?

Copy link
Contributor

@Catharsis68 Catharsis68 Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I was thinking more like this:

    1. If there is a global config - options will be applied to say task synthAudio
    2. If there is a specific options property directly in the say task - this will "win" and overwrite the global config. e.g you want to change the synthAudio options just for one say task, you would otherwise send a new config with te changes and then an additional config to change it back. So there would be no benefit of "say.synthesizer.options" in that case
      The more specific options (directly provided in the say task) should overwrite the global one.
  2. This condition is just there, that the "this.options" should not get overwritten by an empty options object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @Catharsis68 on this one -- the config provides session-level settings, but if a verb specifies something different, that should take preference for that verb. Given that, I think we can merge this @xquanluu ?

lib/tasks/say.js Outdated
@@ -70,7 +70,10 @@ class TaskSay extends Task {
let credentials = cs.getSpeechCredentials(vendor, 'tts', label);

// override Synthesizer options from config verb
if (cs.synthesizer && cs.synthesizer.options) {
if (!Object.keys(this.options).length != 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly are we saying here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not length does not equal zero.....can't that be made into a simple test: if length equals zero?

@xquanluu xquanluu closed this Aug 28, 2024
@xquanluu xquanluu deleted the feat/synthezier_options branch September 20, 2024 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants