title: Using webRTC for recording sound through microphone
body: <p>I am developing an app which records the user Audio. For recording audio I am using getUserMedia API. The maximum length of the audio will be around 15 minutes. I don't want to store it in cache. I did it by streaming directly to the node js server. The server streams it and encodes so that a mp3 file is being generated. It is done by something like this. </p>
  
  <pre><code>var encoder;
  var lame = require('lame');
  var fs = require('fs');
  
  var encodeAudio = function (data) {
    // my own logic here ---- &gt;
    // Encode audio is below
        encoder = lame.Encoder({
          channels: 2,
          bitDepth: 16,
          sampleRate: 22050,
          bitRate: 128,
          outSampleRate: 22050,
          mode: lame.STEREO
        });
        encoder.pipe(fs.createWriteStream('/tmp/' + data.name + '/audio.mp3'));
      }
      encoder.write(new Buffer(data.buffer), function () {
      });
    }
  };
  </code></pre>
  
  <p>Client Side </p>
  
  <pre><code>navigator.getUserMedia = ( navigator.getUserMedia ||
                       navigator.webkitGetUserMedia ||
                       navigator.mozGetUserMedia ||
                       navigator.msGetUserMedia);
    navigator.getUserMedia({audio: true, video: false}, function (stream) {
      var audioContext = window.AudioContext;
      var context = new audioContext();
      window.audioInput = context.createMediaStreamSource(stream);
      var bufferSize = 2048;
      var recorder = context.createScriptProcessor(bufferSize, 1, 1);
      recorder.onaudioprocess = self.onAudioProcess.bind(self);
      audioInput.connect(recorder);
      recorder.connect(context.destination);
    }, this.onAudioError);
  </code></pre>
  
  <p>Here the data is sent from socket.io from the client side. So whenever a chunk of audio is sent from the client, nodejs server creates buffer and saves it as mp3.</p>
  
  <p>Now I heard about WebRTC and its functionalities. But then it doesn't work with safari and IE. Then I came through Temasys plugin for making WebRTC compatible with safari and IE. But I am confused since Temasys doesn't support recording. Can someone guide how to do this ?</p>