Skip to content

Commit 499026e

Browse files
authored
Update 1
1 parent ffcb74a commit 499026e

File tree

1 file changed

+41
-47
lines changed
  • articles/communication-services/tutorials/audio-quality-enhancements/includes

1 file changed

+41
-47
lines changed

articles/communication-services/tutorials/audio-quality-enhancements/includes/web.md

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,25 @@ The Azure Communication Services audio effects features can significantly enhanc
1717
## 🎧 What Are Audio Effects?
1818
Audio effects in ACS are real-time enhancements applied to microphone input during a call. The Azure Communications Services audio effects package has multiple abilities to remove unwanted sounds from a call (from a client perspective).
1919

20-
1. **Noise suppression** (sometimes called noise reduction) focuses on eliminating unwanted background sounds. Think typing sounds, fan hums, distant conversations, or street noise. Its job is to isolate your voice so that whoever is listening hears you more clearly, and reduce or remove the distracting background sounds. It uses algorithms trained to recognize the difference between your speech and ambient noise, then reduces or removes that noise in real time.
20+
**Noise suppression** (sometimes called noise reduction) focuses on eliminating unwanted background sounds. Think typing sounds, fan hums, distant conversations, or street noise. Its job is to isolate your voice so that whoever is listening hears you more clearly, and reduce or remove the distracting background sounds. It uses algorithms trained to recognize the difference between your speech and ambient noise, then reduces or removes that noise in real time. These noises can be considered a sound that is not human voice.
2121
Key traits that noise suppression does:
22-
- Removes continuous or predictable noises.
22+
- Removes continuous or predictable background noises.
2323
- Enhances speech clarity.
2424
- Typically works on the speaker’s end before sending the audio out.
2525

26-
2. **Echo cancellation** eliminates echo caused when your microphone picks up audio from your speakers. For example, when someone is on speakerphone and their microphone picks up your voice from their speaker, it can loop back to you as an echo. Echo cancellation predicts and subtracts this returning sound so you don’t hear yourself talking back a fraction of a second later.
26+
**Echo cancellation** eliminates echo caused when your microphone picks up audio from your speakers. For example, when someone is on speakerphone and their microphone picks up your voice from their speaker, it can loop back to you as an echo. Echo cancellation predicts and subtracts this returning sound so you don’t hear yourself talking back a fraction of a second later.
2727
Key traits for echo cancelation:
2828
- Eliminates acoustic feedback.
29-
- Essential in speakerphone or open mic setups.
29+
- Essential in open microphone and desktop setups where the microphone picks up audio output from a local speaker.
3030
- Reduces listener fatigue and confusion caused by hearing your own voice returned.
3131

32+
## Best Practices
33+
The ACS audio effects package provides tools for reducing unwanted sounds. Additional measures can be taken to improve audio quality, such as:
34+
- Encouraging end users to consider using headphones to minimize the need for echo cancellation.
35+
- Enabling noise suppression tin shared or open work environments.
36+
- Setting noise suppression as the default option (i.e., having audio effects activated when a user initiates a call). If this feature is enabled automatically at the start of calls, users do not have to activate it manually. Enabling noise suppression and echo cancellation by default may help mitigate audio issues during calls.
37+
- Test audio effects in different environments to optimize end user experience.
38+
3239
## Use audio effects: Install the calling effects npm package
3340

3441
> [!IMPORTANT]
@@ -55,7 +62,7 @@ If you use the **public preview** of the Calling SDK, you must use the [beta ver
5562
@azure/communication-calling-effects/v/next
5663
```
5764

58-
## Enable Audio Effects
65+
## Step 2 Enable Audio Effects you wish to use
5966
For information on the interface that details audio effects properties and methods, see the [Audio Effects Feature interface](/javascript/api/azure-communication-services/@azure/communication-calling/audioeffectsfeature?view=azure-communication-services-js&preserve-view=true) API documentation page.
6067

6168
### Initialize the Audio Effects Feature
@@ -81,58 +88,53 @@ const audioEffects = await deviceManager.createAudioEffects(selectedMicrophone);
8188
await audioEffects.setFeature({ featureName: 'noiseSuppression', enabled: true });
8289
```
8390
### Enable Echo Cancellation
84-
91+
```js
8592
=========================================
8693

8794
import * as AzureCommunicationCallingSDK from '@azure/communication-calling';
88-
import { DeepNoiseSuppressionEffect } from '@azure/communication-calling-effects';
95+
import { EchoCancellationEffect } from '@azure/communication-calling-effects';
8996

90-
// Get LocalAudioStream from the localAudioStream collection on the call object.
97+
// Create the noise suppression instance
98+
const echoCancellationEffect = new EchoCancellationEffect();
99+
100+
// Get LocalAudioStream from the localAudioStream collection on the call object
91101
// 'call' here represents the call object.
92102
const localAudioStreamInCall = call.localAudioStreams[0];
93103

94104
// Get the audio effects feature API from LocalAudioStream
95105
const audioEffectsFeatureApi = localAudioStreamInCall.feature(AzureCommunicationCallingSDK.Features.AudioEffects);
96106

97-
// Subscribe to useful events that show audio effects status
98-
audioEffectsFeatureApi.on('effectsStarted', (activeEffects: ActiveAudioEffects) => {
99-
console.log(`Current status audio effects: ${activeEffects}`);
100-
});
101-
102-
103-
audioEffectsFeatureApi.on('effectsStopped', (activeEffects: ActiveAudioEffects) => {
104-
console.log(`Current status audio effects: ${activeEffects}`);
105-
});
106-
107-
108-
audioEffectsFeatureApi.on('effectsError', (error: AudioEffectErrorPayload) => {
109-
console.log(`Error with audio effects: ${error.message}`);
110-
});
107+
// We recommend that you check support for the effect in the current environment by using the isSupported method on the feature API. Remember that noise suppression is only supported on desktop browsers for Chrome and Edge.
108+
const isEchoCancellationSupported = await audioEffectsFeatureApi.isSupported(echoCancellationEffect);
109+
if (isEchoCancellationSupported) {
110+
console.log('Echo Cancellation is supported in the current browser environment');
111+
}
111112
```
112-
=====================================
113113

114-
## Start a call with noise suppression automatically enabled
114+
## Bring it all together: Loand and start Noise Suppresion, Echo cancelation and have the effects automatically
115115

116116
To initiate a call with noise suppression enabled, create a new `LocalAudioStream` property using `AudioDeviceInfo`. Ensure that the `LocalAudioStream` source is not set as a raw `MediaStream` property to support audio effects. Then, include this property within `CallStartOptions.audioOptions` when starting the call.
117117

118118
```js
119-
// As an example, here we're simply creating LocalAudioStream by using the current selected mic on DeviceManager.
120-
const audioDevice = deviceManager.selectedMicrophone;
121-
const localAudioStreamWithEffects = new AzureCommunicationCallingSDK.LocalAudioStream(audioDevice);
122-
const audioEffectsFeatureApi = localAudioStreamWithEffects.feature(AzureCommunicationCallingSDK.Features.AudioEffects);
119+
import { EchoCancellationEffect, DeepNoiseSuppressionEffect } from '@azure/communication-calling-effects';
120+
121+
// Create the noise suppression instance
122+
const deepNoiseSuppression = new DeepNoiseSuppressionEffect();
123+
// Create the noise suppression instance
124+
const echoCancellationEffect = new EchoCancellationEffect();
123125

124-
// Start effect
126+
// Get LocalAudioStream from the localAudioStream collection on the call object
127+
// 'call' here represents the call object.
128+
const localAudioStreamInCall = call.localAudioStreams[0];
129+
130+
// Get the audio effects feature API from LocalAudioStream
131+
const audioEffectsFeatureApi = localAudioStreamInCall.feature(AzureCommunicationCallingSDK.Features.AudioEffects);
132+
133+
// To start Communication Services Deep Noise Suppression
125134
await audioEffectsFeatureApi.startEffects({
135+
echoCancellation: echoCancellationEffect,
126136
noiseSuppression: deepNoiseSuppression
127-
});
128-
129-
// Pass LocalAudioStream in audioOptions in call start/accept options.
130-
await call.startCall({
131-
audioOptions: {
132-
muted: false,
133-
localAudioStreams: [localAudioStreamWithEffects]
134-
}
135-
});
137+
});
136138
```
137139

138140
## Turn on noise suppression during an ongoing call
@@ -166,7 +168,7 @@ await audioEffectsFeatureApi.stopEffects({
166168
noiseSuppression: true
167169
});
168170
```
169-
## To start or stop audio effects packages during a call
171+
### To start or stop audio effects packages during a call
170172
To start Azure Communication Services Deep Noise Suppression
171173
```js
172174
await audioEffectsFeatureApi.startEffects({
@@ -213,14 +215,6 @@ if (isDeepNoiseSuppressionSupported) {
213215
}
214216
```
215217

216-
## Best Practices
217-
The ACS audio effects package provides tools for reducing unwanted sounds. Additional measures can be taken to improve audio quality, such as:
218-
- Encouraging end users to consider using headphones to minimize the need for echo cancellation.
219-
- Enabling noise suppression tin shared or open work environments.
220-
- Setting noise suppression as the default option (i.e., having audio effects activated when a user initiates a call). If this feature is enabled automatically at the start of calls, users do not have to activate it manually. Enabling noise suppression and echo cancellation by default may help mitigate audio issues during calls.
221-
- Test audio effects in different environments to optimize user experience.
222-
223-
224218
## Related content
225219

226220
See the [Audio Effects Feature interface](/javascript/api/azure-communication-services/@azure/communication-calling/audioeffectsfeature?view=azure-communication-services-js&preserve-view=true) documentation page for extended API feature details.

0 commit comments

Comments
 (0)