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

Ensure that Amazon Voice Focus only receives downmixed mono input. #1458

Merged
merged 2 commits into from
Jul 23, 2021

Conversation

richnew10
Copy link
Contributor

When the SDK requests an audio input, it specifies ideal
single-channel input. The browser is not guaranteed to return a mono
stream, and indeed builders can supply a stereo stream from their own
audio sources.

This change ensures that the Web Audio graph will provide a
single-channel mixed input to the node, and thus the processor will
receive only a single array of samples.

  1. Have you successfully run npm run build:release locally?

Yes.

  1. How did you test these changes?

In the Voice Focus test harness, and manually in the demo app.

  1. Can these changes be tested using the demo application? If yes, which demo application can be used to test it?

Not directly. You can fake it:

const gUM = navigator.mediaDevices.getUserMedia;
navigator.mediaDevices.getUserMedia = (constraints) => {
  const c = constraints.audio ? {...constraints, audio: {...constraints.audio, channelCount: 2 } } : constraints;
  console.info('XXX using constraints', c);
  return gUM.call(navigator.mediaDevices, c);
};

which will cause stereo inputs to be returned. If you hit the Record button you'll get a recording that now plays through both channels, which was not previously the case.

  1. Do you add, modify, or delete public API definitions? If yes, has that been reviewed and approved?

No.

  1. Do you change the wire protocol, e.g. the request method? If yes, has that been reviewed and approved?

No.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

When the SDK requests an audio input, it specifies _ideal_
single-channel input. The browser is not guaranteed to return a mono
stream, and indeed builders can supply a stereo stream from their own
audio sources.

This change ensures that the Web Audio graph will provide a
single-channel mixed input to the node, and thus the processor will
receive only a single array of samples.
@richnew10 richnew10 self-assigned this Jul 22, 2021
@ltrung ltrung merged commit d7f8e34 into master Jul 23, 2021
@ltrung ltrung deleted the richnew/vf-mono branch July 23, 2021 15:49
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.

2 participants