muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.72k stars 3.95k forks source link

Is there any way to reduce the noise? #76

Open jieyun-yang opened 11 years ago

jieyun-yang commented 11 years ago

I run socketio-over-node.js video conference on my mac, when I set the volumn a little bit high, the noise is too loud. Is there any way to reduce it?THX

muaz-khan commented 11 years ago

High volume can produce sound noise on some audio devices. The value may not be significant if audio device volume is controlled externally.

HTMLAudioElement.volume = 0.9;
HTMLAudioElement.play();

The GainNode is a simple element that lets us control the volume of the audio that’s coming into to it.

var context = new webkitAudioContext(),
var sineWave = context.createOscillator();

// Declare gain node
var gainNode = context.createGainNode();

// Connect sine wave to gain node
sineWave.connect(gainNode);

// Connect gain node to speakers
gainNode.connect(context.destination);

// Play sine wave
sineWave.noteOn(0);

gainNode.gain.value = 0.9;

There is a demo to control volume using GainNode. Open it on your localhost.

Usage of headphone is preferred instead of using default (built-in) audio output devices coming with notebooks. Otherwise; recommend users to try software like this.

jieyun-yang commented 11 years ago

Another question, how to set the width and height? The default value of width:height is 1:1, how to change it?

federicopaynojr commented 10 years ago

Hi Muaz, I'm having error with the code 'var sineWave = context.createOscillator();'

I tried to check if my browser(FF V30.0) supports webkitAudioContext(), and it doesn't.

Please help.

Thanks,

muaz-khan commented 10 years ago

You can try prefix-less AudioContext object. E.g.

var context = new AudioContext();
var sineWave = context.createOscillator();
federicopaynojr commented 10 years ago

Hi Muaz, thanks for the reply :). I fixed the problem yesterday by adding 'muted' to the 'video' element and when playing, I set it to false (videoElement.muted = false) and also set it to true when recording to fix the feedback when doing another recording.

Right now this video recorder (got from your repo WebRTC-Experiment/RecordRTC/RecordRTC-to-Nodejs) only works on Firefox and I'm working on a separate program for Chrome which I found from your repo also and I'm having problem with saving the recorded message to the server. Maybe there's a way I can make it work on Chrome by adding some codes to existing program?

Thanks again