Skip to content

Commit 1d0cbfb

Browse files
authored
Merge pull request #286587 from sloanster/patch-23
Update web.md
2 parents 708b750 + fa4a059 commit 1d0cbfb

File tree

1 file changed

+36
-9
lines changed
  • articles/communication-services/tutorials/audio-quality-enhancements/includes

1 file changed

+36
-9
lines changed

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

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ ms.subservice: calling
1414

1515
The Azure Communication Services audio effects **noise suppression** abilities can improve your audio calls by filtering out unwanted background noises. **Noise suppression** is a technology that removes background noises from audio calls. It makes audio calls clearer and better by eliminating background noise, making it easier to talk and listen. Noise suppression can also reduce distractions and tiredness caused by noisy places. For example, if you're taking an Azure Communication Services WebJS call in a coffee shop with considerable noise, turning on noise suppression can make the call experience better.
1616

17-
## Using audio effects - **Noise Suppression**
18-
### Install the npm package
17+
## Using audio effects - install the calling effects npm package
1918
> [!IMPORTANT]
20-
> This tutorial employs the Azure Communication Services Calling SDK version `1.28.4` or later, alongside the Azure Communication > Services Calling Effects SDK version `1.1.1` or newer. The GA (stable) version **`1.28.4`** and above of the calling SDK support noise suppression features. Alternatively, if you opt to use the public preview version, calling SDK versions `1.24.2-beta.1` and higher also support noise suppression.
19+
> This tutorial employs the Azure Communication Services Calling SDK version `1.28.4` or later, alongside the Azure Communication Services Calling Effects SDK version `1.1.1` or newer. The GA (stable) version **`1.28.4`** and above of the calling SDK support noise suppression features. Alternatively, if you opt to use the public preview version, calling SDK versions `1.24.2-beta.1` and higher also support noise suppression.
2120
>
2221
> Current browser support for adding audio noise suppression effects is only available on Chrome and Edge Desktop browsers.
2322
@@ -37,7 +36,7 @@ Use the `npm install` command to install the Azure Communication Services Audio
3736
```console
3837
3938
```
40-
39+
## Loading the Noise Suppression effects library
4140
To use `noise suppression` audio effects within the Azure Communication Calling SDK, you need the `LocalAudioStream` that is currently in the call. You need access to the `AudioEffects` API of the `LocalAudioStream` to start and stop audio effects.
4241
```js
4342
import * as AzureCommunicationCallingSDK from '@azure/communication-calling';
@@ -65,20 +64,41 @@ audioEffectsFeatureApi.on('effectsError', (error: AudioEffectErrorPayload) => {
6564
console.log(`Error with audio effects: ${error.message}`);
6665
});
6766
```
68-
67+
## Checking what audio effects are active
6968
At anytime if you want to check what **noise suppression** effects are currently active, you can use the `activeEffects` property.
7069
The `activeEffects` property returns an object with the names of the current active effects.
7170
```js
7271
// Using the audio effects feature api
7372
const currentActiveEffects = audioEffectsFeatureApi.activeEffects;
73+
74+
// Create the noise suppression instance
75+
const deepNoiseSuppression = new DeepNoiseSuppressionEffect();
76+
// Its recommened to check support for the effect in the current environment using the isSupported API
77+
// method. Remember that Noise Supression is only supported on Desktop Browsers for Chrome and Edge
78+
79+
const isDeepNoiseSuppressionSupported = await audioEffectsFeatureApi.isSupported(deepNoiseSuppression);
80+
if (isDeepNoiseSuppressionSupported) {
81+
console.log('Noise supression is supported in local browser environment');
82+
}
83+
84+
// To start ACS Deep Noise Suppression
85+
await audioEffectsFeatureApi.startEffects({
86+
noiseSuppression: deepNoiseSuppression
87+
});
88+
89+
// To stop ACS Deep Noise Suppression
90+
await audioEffectsFeatureApi.stopEffects({
91+
noiseSuppression: true
92+
});
93+
7494
```
7595

76-
### Start a call with Noise Suppression enabled
96+
## Start a call with Noise Suppression automatically enabled
7797
To start a call with **noise suppression** turned on, you can create a new `LocalAudioStream` with a `AudioDeviceInfo` (the LocalAudioStream source <u>shouldn't</u> be a raw `MediaStream` to use audio effects), and pass it in the `CallStartOptions.audioOptions`:
7898
```js
7999
// As an example, here we are simply creating a LocalAudioStream using the current selected mic on the DeviceManager
80100
const audioDevice = deviceManager.selectedMicrophone;
81-
const localAudioStreamWithEffects = new .LocalAudioStream(audioDevice);
101+
const localAudioStreamWithEffects = new AzureCommunicationCallingSDK.LocalAudioStream(audioDevice);
82102
const audioEffectsFeatureApi = localAudioStreamWithEffects.feature(AzureCommunicationCallingSDK.Features.AudioEffects);
83103

84104
// Start effect
@@ -95,16 +115,23 @@ await call.startCall({
95115
});
96116
```
97117

98-
### How to turn on Noise Suppression during an ongoing call
118+
## Turn on Noise Suppression during an ongoing call
99119
There are situations where a user might start a call and not have **noise suppression** turned on, but their current environment might get noisy resulting in them needing to turn on **noise suppression**. To turn on **noise suppression**, you can use the `audioEffectsFeatureApi.startEffects` API.
100120
```js
101121
// Create the noise supression instance
102122
const deepNoiseSuppression = new DeepNoiseSuppressionEffect();
103123

124+
// Get the LocalAudioStream from the localAudioStream collection on the call object
125+
// 'call' here represents the call object.
126+
const localAudioStreamInCall = call.localAudioStreams[0];
127+
128+
// Get the audio effects feature API from LocalAudioStream
129+
const audioEffectsFeatureApi = localAudioStreamInCall.feature(AzureCommunicationCallingSDK.Features.AudioEffects);
130+
104131
// Its recommened to check support for the effect in the current environment using the isSupported method on the feature API. Remember that Noise Supression is only supported on Desktop Browsers for Chrome and Edge
105132
const isDeepNoiseSuppressionSupported = await audioEffectsFeatureApi.isSupported(deepNoiseSuppression);
106133
if (isDeepNoiseSuppressionSupported) {
107-
console.log('Noise supression is supported in browser environment');
134+
console.log('Noise supression is supported in the current browser environment');
108135
}
109136

110137
// To start ACS Deep Noise Suppression,

0 commit comments

Comments
 (0)