Advertisement
Guest User

Untitled

a guest
Dec 15th, 2013
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <script>
  2. var audio_context;
  3. var recorder;
  4.  
  5.  
  6. window.onload = function init() {
  7. try {
  8. window.AudioContext = window.AudioContext || window.webkitAudioContext;
  9. navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
  10. window.URL = window.URL || window.webkitURL;
  11.  
  12. audio_context = new AudioContext;
  13. } catch (e) {
  14. console.log(e);
  15. }
  16.  
  17. navigator.getUserMedia({audio: true}, startUserMedia);
  18.  
  19. function startUserMedia(stream) {
  20. console.log('Initializing');
  21. var input = audio_context.createMediaStreamSource(stream);
  22. input.connect(audio_context.destination);
  23.  
  24. var node = input.context.createGain(4096, 2, 2);
  25.  
  26. node.onaudioprocess = function(e){
  27. console.log('done');
  28. }
  29.  
  30. node.connect(audio_context.destination);
  31. }
  32. };
  33. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement