miroslavpejic85/mirotalkbro

Issue with WebRTC Noise Reduction feature affecting audio quality

aloproducao opened this issue · 3 comments

Hello,

I've been using this project and noticed that the current implementation of Noise Reduction in WebRTC might be causing a specific problem. When I send high-quality video and audio signals, the Noise Reduction feature seems to be affecting the sound, particularly when music is involved.

While I understand the intent behind Noise Reduction, in certain cases such as transmitting high-quality audio, it may be impairing the end-user experience. This is particularly noticeable when music is transmitted, with the audio being cut off or losing quality.

I'd like to suggest the consideration of adding an option to disable or adjust this Noise Reduction feature. It would be interesting to have more detailed control over it, according to the type of audio that is being transmitted.

I hope this suggestion might be helpful to further improve the project. I am available to discuss in more detail if needed.

Thank you for your attention.

const audioSource = audioSelect.value;
const videoSource = videoSelect.value;

const constraints = screenShareEnabled
    ? { 
        audio: { echoCancellation: false, noiseSuppression: false, autoGainControl: false },
        video: true 
      }
    : {
          audio: { 
              deviceId: audioSource ? { exact: audioSource } : undefined,
              echoCancellation: false,
              noiseSuppression: false,
              autoGainControl: false
          },
          video: { deviceId: videoSource ? { exact: videoSource } : undefined },
      };

if (screenShareEnabled) {
    video.classList.remove('mirror');
    isVideoMirrored = false;
    return navigator.mediaDevices.getDisplayMedia(constraints).then(gotStream).catch(handleError);
    // ToDo: On Screen share, add the possibility to choose the microphone audio or tab audio
}
if (isDesktopDevice && !isVideoMirrored) {
    video.className = 'mirror';
    isVideoMirrored = true;
}

return navigator.mediaDevices.getUserMedia(constraints).then(gotStream).catch(handleError);

Hello @aloproducao,

The default values for the WebRTC audio constraints vary depending on the browser and platform. However, in most cases, are as follows:

echoCancellation: true
noiseSuppression: true
autoGainControl: true

If you set the WebRTC audio constraints with echoCancellation, noiseSuppression, and autoGainControl all set to false, it means that these audio processing features will be disabled. This can result in the following effects:

  • Echo Cancellation: Disabling echo cancellation can lead to the presence of echo in the audio. Echo cancellation is typically used to remove any echo caused by audio feedback between the microphone and speakers. Without it, you may hear an echo effect in the audio.

  • Noise Suppression: Disabling noise suppression means that any background noise or ambient sounds present in the environment will not be filtered out. As a result, the audio quality may be impacted by background noise, which can reduce the clarity of the audio signal.

  • Auto Gain Control: With auto gain control disabled, the audio volume will not be automatically adjusted to maintain a consistent level. This can result in variations in volume, where some parts of the audio may be too loud or too soft.

In general, enabling these audio processing features (echo cancellation, noise suppression, and auto gain control) can improve the audio quality by reducing background noise, eliminating echo, and maintaining a consistent volume level. Disabling these features may result in a lower audio quality, especially in scenarios where there is background noise or potential for echo.

However, it's worth noting that the perceived audio quality also depends on various factors such as the network conditions, the capabilities of the devices used, and the overall audio processing pipeline implemented by the WebRTC application. Simply enabling these features does not guarantee high-quality audio-video, but they can contribute to improving the overall experience.

Note Using the Broadcast and Viewer that are on the same PC:

there can be potential issues with audio. Here are a few common problems and solutions:

  • Audio feedback or echo: When the microphone picks up the sound from the speakers, it creates a feedback loop resulting in echo or audio distortion. To solve this, make sure to use headphones or separate speakers for the viewer's audio to prevent the microphone from picking it up.

  • Audio driver conflicts: Sometimes, conflicts between audio drivers can cause issues. Ensure that your audio drivers are up to date and compatible with both the broadcasting and viewing software.

  • Software settings: Check the audio settings within the broadcasting and viewing software. Ensure that the correct audio devices are selected and that the audio levels are properly adjusted. You may need to configure the software to use different audio devices for broadcasting and viewing.

  • Resource limitations: If your PC doesn't have sufficient resources (CPU, memory, etc.), running both the broadcasting and viewing software simultaneously may strain the system and cause audio problems. Close any unnecessary applications or consider upgrading your hardware if needed.

  • Network latency: If you are streaming the broadcast over a network, latency issues can cause audio synchronization problems between the broadcaster and viewer. Ensure a stable network connection and consider using low-latency streaming solutions.

It's important to troubleshoot each of these factors to determine the exact cause of the audio issues when the broadcast and viewer are on the same PC.

Try streaming to viewers who are not listening on your own PC (tab browser).

PS: Join with us on discord forum, channel: ideas and suggestions, where we can also talking about all together.

Thank you!