Skip to content

Property "SpeechServiceConnection_SynthOutputFormat" is ignored in DialogServiceAdapter #314

Closed

Description

The code handling SpeechServiceConnection_SynthOutputFormat is wrong and the cause starts at DialogServiceAdapter.ts:599.

const pullAudioOutputStream: PullAudioOutputStreamImpl = turn.processActivityPayload(
  activityPayload,
  (SpeechSynthesisOutputFormat as any)[this.privDialogServiceConnector.properties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)]
);

Then, it call the DialogServiceTurnState.processActivityPayload function, it accept AudioOutputFormatImpl instead of SpeechSynthesisOutputFormat.

public processActivityPayload(payload: ActivityPayloadResponse, audioFormat?: AudioOutputFormatImpl): PullAudioOutputStreamImpl {
    if (payload.messageDataStreamType === MessageDataStreamType.TextToSpeechAudio) {
        this.privAudioStream = AudioOutputStream.createPullStream() as PullAudioOutputStreamImpl;
        this.privAudioStream.format = (audioFormat !== undefined) ? audioFormat : AudioOutputFormatImpl.getDefaultOutputFormat();
        // tslint:disable-next-line:no-console
        // console.info("Audio start debugturn:" + this.privRequestId);
    }
    return this.privAudioStream;
}

Then it call the setter of PullAudioOutputStream.format:

public set format(format: AudioStreamFormat) {
    if (format === undefined || format === null) {
        this.privFormat = AudioOutputFormatImpl.getDefaultOutputFormat();
    }
    this.privFormat = format as AudioOutputFormatImpl;
}

No matter what we set for SpeechServiceConnection_SynthOutputFormat, it send a SpeechSynthesisOutputFormat enum to DialogServiceTurnState.processActivityPayload, instead of AudioOutputFormat object. Thus, it is actually sending a wrong argument. And this code here detect wrong type of object and fallback to undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions