New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 2697 users

Comments by non-members will not trigger notification emails to users who starred this issue.

Issue metadata

Status: Verified
Owner:
Email to this user bounced
Closed: Nov 2012
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment

getUserMedia() doesn't work for microphone input

Project Member Reported by ericbidelman@chromium.org, Feb 1 2012

Issue description

getUserMedia('video, audio', ...) and getUserMedia('audio', ...) do not work for audio access.

navigator.webkitGetUserMedia('video, audio', function(s) {
  audioElement.src = window.webkitURL.createObjectURL(s);
  video.src = audioElement.src;
}, function(e) {
  alert('Error');
  console.log(e);
});

Does not play the mic's input through the audio tag.

Try attached test case. The video is passed through to the video tag, but the audio is not.
 
getUserMedia_audioonly_test.html
502 bytes View Download
Showing comments 113 - 212 of 212 Older
Brendan, I looked at audioProcessing.js and noticed you're using a "JavaScriptAudioNode" with a very low buffer size of 256.  This will not work on Windows:
    jsnode = con.createJavaScriptNode(256,1,1); // We could change this to stereo

I know the Web Audio spec says this is a possible value, in practice these small buffer sizes are not practical for use on the main JavaScript thread.

Please try 1024 or higher and see if that helps

Comment 114 by noi...@gmail.com, Nov 9 2012

Any changes here with new beta in repository?
With audio recording issues in Pepper Flash in the M23 (http://code.google.com/p/chromium/issues/detail?id=157613), it seems to me that this should be a high priority release. Sure hope this comes to M24.
any news about actually storing the recorded audio? 
Does anyone have working code for getUserMedia({audio:true},function(stream) { /* get stream.audioTracks as buffer, byte array, or anything? */ });  I swear I saw blob = createObjectURL(stream); new FileReader().readAsArrayBuffer(blob);  somewhere.  

I just need bytes!!!  :)

Comment 118 by Deleted ...@, Nov 19 2012

If anyone know how to play the audio stream on browser? :(
I really really want this WebRTC audio only to work.  Does anyone have any idea when that might happen?  I just want to see a simple "Hello World" example.  Something along the lines of 2 PCs with 2 People with 2 Headsets and mics.  All of a sudden "Watson come here . . . " and the rest is history!

When might this be possible?  We were planning development 6 months ago that anticipated this simple task would be working by now.  We had already seen the interactive video/audio working example from the Google folks.

Does anyone have a timeframe of when this simple "Hello World" example might be available?
Owner: henrika@chromium.org
Henrik, dupe if needed.

Comment 121 by sirj...@gmail.com, Nov 28 2012

I've got this flying on Windows 7 Canary, with a little comet server magic and alot of patience you can read raw PCM data from WebAudioAPI, process it with Speex compiled to javascript with emascripten and bobs your uncle. I integrated a working, low latency version into our HTML5 web conference software in little more than a day.

All the bits are there, as the api matures less 'hacky' ways of doing this will inevitably emerge, but works great for now. Just need widespread browser adoption now :)
Mergedinto: 157142
Status: Duplicate

Comment 123 by Deleted ...@, Dec 1 2012

This is my way how i broadcast microphone input to clients with html5:
1) Use WebKitAudio on Windows 7 Canary
2) Capture microphone input every second and stream it as PCM using https://github.com/mattdiamond/Recorderjs
3) Send the blob with websocket (PCM is 1.4Mbit/s)
4) Put the PCM binary stream in a temporary .wav file.
5) Convert it with ffmpeg to mp3 very low quality -> 3KB/s
6) Send it to all clients and play it

I know this is a very 'hacky' way and the convertion take 0.1sec for every single file. This produces a delay, which will eventually be solved with streaming a buffer. Is there a better solution?
I am waiting
nikrofilizm: The requested functionality originally asked for in this thread has been added to Chrome and exists in Canary.


Comment 126 by Deleted ...@, Dec 30 2012

жду!

Comment 127 by Deleted ...@, Jan 14 2013

I'm able to make this work in 24.0.1312.52 on Mac by enabling it in chrome://flags. I can make it work in Canary (26.0.1382.0) on Windows 8 by doing the same. Windows 7 does not work for me, the difference is that I'm using a Logitech USB webcam (orbit) with integrated mic. I'm using that mic has primary input on the windows 7 box, and I'm not able to get any audio. Using http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html to test.
clayrongulick@: The most probable reason why it does not work for you on
Win 7 is that the USB webcam uses a different capture sample rate than your
output device (that's my theory at least). The current implementation of
live-audio on Windows requires that both sides uses the same sample rate.
If possible; try changing  sample rate(s) and ensure that they are the same
in both directions.
Hello,
thank you!

I used not a webcam mic, actually. I have a studio microphone with M-Audio
Fast Track Pro audio card, maybe this will be helpful?
Hello,

I have tried all kind of examples (also http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html) non of them work on my Chrome 24.0.1312.52 and Chrome Canary 26.0.1382.0 on Win 7. I have successfully added stream and send through peer connection and sound is very good, but the problem I can't analyze the sound using Web Audio API with MediaTrack. I am sure that my mic is working good using WebRTC. Tried on 4 different computers with same specifications and versions. What can be the problem? Thank you!
Can you check what sample rate (and channel configuration) you are using in
both directions and report back?
Thanks.
I am using 2 channel, 16 bit, 44100 Hz [CD Quality] sample rate. For mic and for speaker. Thanks!
не понимаю
 14 Січ. 2013 15:48, <chromium@googlecode.com> напис.
Note that any usage of live-audio input requires that the experimental flag Web Audio Input is enabled (see chrome://flags). 

With that enabled, and in combination with identical sample rates for in and out, demos like http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html should work.
I have already enabled this:

Web Audio Input Mac, Windows, Linux, Chrome OS
Enables live audio input using getUserMedia() and the Web Audio API.

It enables getUserMedia and Web Audio API , so there is no need to enable Web Audio Input separately. 

I am really stuck..
The flag does not "enable getUserMedia and Web Audio API", it enables "live audio input using getUserMedia() and the Web Audio API" and that is not the same thing.

Let me check again:

- you are on Windows 7;
- with the Web Auido Input flag enabled;
- and using http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html

Next, you grant access to the default microphone which is configured to run at the same sample rate as the default output device.

Then what happens?
Nothing happens, no graphic changes on the visualizer even I scream to the mic. Thanks!
Please note that the mic and camera you approve using chrome://settings/content and the Media section is not the one that will be utilized in this demo. Instead, the default microphone will always be used. Just checking to ensure that this is the one you have verified having the same sample rate and channel config as the default output device.
Yes I pick the mic from the list in the Options when Allow/Deny toolbar is comming.

By the way, I can't find any information about my mic and webcamera here: chrome://settings/content , it is only giving security option to ask or deny accessing my webcam and mic.


It is supported in latest Canary but what I am trying to say is that your selection is ignored in combination with live audio input. I.e., the default microphone will always be utilized. All you do with getUserMedia is to allow access to any microphone.
Using same Chrome Canary I have successfully connected with a peer connection to other Chrome browser and the sound can be heard very well, but using the same stream with webkitContext and analyser it is not giving anything. Using the same Chrome Canary and same mic settings I used demo http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html , nothing happend. So in conclusion, the audio is transmitting within the stream, but it is not taken by web audio api for some reason.
I might be doing a bad job explaining here but what I mean is that the two cases you describe have very few parts in common. Hence saying that #1 works gives no clues to why #2 does not. The live audio part is under a flag and experimental only. That's why there are restrictions on things like sample rate and a non perfect device selection.
Yes I understand that it is experimental, just want to know what should I do to make it work, because the demo is not working on non of my 4 pc with windows 7 and 1 mac.
Can you experiment with another (USB) headset and use that as default
device?
All pc's have different headsets, MacBook have builtin one, other ones are using headsets with audio jacks (not usb).
I have tried Chrome 26.0.1382.0 (Official Build 176602) canary with enable-webaudio-input flag set and can run the demo on my Windows 7 machine. Using a USB headset, 2 channels at 48kHz in both directions.

I am currently unable to say why it does not work for you.
Ok I will continue my investigations and will let you know if I find any problem, let me know also if you remember anything and think it can solve this problem, thanks!

Comment 148 by Deleted ...@, Jan 14 2013

henrika: Thanks for your work on this and your assistance! I'm excited about this functionality because I have a client who's interested in implementing an online music application, and we were hoping to avoid writing it in Flash. We're trying to decide if  we should start down the html5/web audio path in the hope that by the time the application is complete, Chrome will have a stable implementation of real-time audio capabilities (we're ok with requiring chrome).

I did double check that the sample rate (48k) was the same on both input and output on windows 7, and I'm still not having any luck - but it's equally probably that the issue here is with the logitech drivers, and not with chrome. The UI says I'm recording at 48k, but who knows what's actually being sent to chrome through the driver chain and windows audio. I can see it work on my mac, and windows 8 box (with built-in mic).

Rather than trying to debug the specific issue with my usb mic, I'd like to know in a broader sense what your recommendation is for the direction we should take our application. Do you see real-time audio processing with various input sources and the web audio api being stable and released in the next year? Or is this more of an experimental "this is cool to play with" kind of technology?

Should we place a bet on html5? Or take the safe road with flash? It looks like Mozilla is a long way off still: https://bugzilla.mozilla.org/show_bug.cgi?id=779297 - they appear to be much more focused on WebRTC, but like I mentioned, I'm ok with requiring our users to install Chrome.

Thanks again!
Cc: crogers@google.com
Mergedinto:
Status: Fixed
+crogers:

Let me start with an admin issue. This thread is actually about adding support for local rendering in combination with getUserMedia. The issue is solved and marked as fixed in 157142. Any input added here also affects 157142 which can be confusing. To break this dependency, I will mark this issue as Fixed instead and then continue the discussion.

Marked as Fixed. See https://code.google.com/p/chromium/issues/detail?id=157142 for more details.

claytongulick@: I understand your concern and would like to provide a clear answer but feel that Chris Rogers is more suitable since he is the main developer and editor of the Web Audio spec (https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html).
henrika: Like claytongulick, I am also trying to get something working through basic webcams on windows 7.  My focus has been widely available webcams I can find at big box retail outlets.  I started with Logitech, but I'll pick up some HP and Microsoft devices today, too.  So far, Logitech C920 works on Mac, but not on Windows, assuming it's set as default (as the thread suggests).  C525 doesn't work on either Mac or Windows, but I'm suspicious of how well the UVC drivers support C525.  C920 doesn't have much in the way of sampling rate (only 32kHz), so given MS default playback, I couldn't match.  C525 was set to 48kHz, both directions.  Also of note, on Windows 7, when I disabled the primary output device, I got aw shucks. From what I can tell, looks like that's where you pull you sample rate. I can feedback my findings on other webcams if you'd like.
This thread is moving forward well -- let's get this working!
The discussion has drifted too much from the original topic (which is now
solved). All input is appreciated but could you (e.g. jason.a@ or
clytongulick@) start a fresh issue report and re-apply the last input? A
more suitable heading could be "Issues with the experimental live-audio
implementation (MediaStreamSource)". It would allow us to provide feedback
that would make sense to more users who search for answers to their
questions.

Thanks.
Thank you.  I have created a fresh issue report, titled as suggested:

https://code.google.com/p/chromium/issues/detail?id=170384


Comment 154 by Deleted ...@, Jan 22 2013

+

Comment 155 by Deleted ...@, Jan 26 2013

come on guys
ackise@: please elaborate; exactly which functionality are you waiting for?
*

Comment 158 by Deleted ...@, Feb 16 2013

Hi,

I have been using the Web Audio API for weeks, in particular to record user audio from the built-in microphone, and suddenly it stopped working. Is there any change recently in this API implementation? 

I checked that default sound input and output sound devices are correctly set and have the same rate (48kHz). Whatever the configuration, the microphone outputs only null values. 

I cannot run simple example such as the following, which should echo the audio input on the audio output:

<script>
var liveSource;
// creates an audiocontext and hooks up the audio input
function connectAudioInToSpeakers(){
  var context = new webkitAudioContext();  
  navigator.webkitGetUserMedia({audio: true}, function(stream) {
    console.log("Connected live audio input");
    liveSource = context.createMediaStreamSource(stream);
    liveSource.connect(context.destination);
  });
 }
// disconnects the audio input
function makeItStop(){
   console.log("killing audio!");
   liveSource.disconnect();
 }
// run this when the page loads
connectAudioInToSpeakers();
</script>

Any help would be appreciated.

Regards, Gilles
Gilles,

I assume you are on Windows and rely on Canary. Live-audio has been broken for a while on Windows but it was fixed last Friday and should work in latest Canary.

Please try again and report back.

Comment 160 by Deleted ...@, Feb 16 2013

Thanks for your help, 

Indeed, I am on Windows 7 and I was running Chrome Version 26.0.1410.5 dev-m.
I installed Chrome Canary (Version 27.0.1413.0 canary), but the problem is still the same. I tried on other computers as well (different HW and different releases of Chrome) without success. I'm not sure where the problem comes from. Are there some sample programs or websites that demo the audio recording part?

Regards, Gilles
Try http://webaudiodemos.appspot.com/input/index.html

and ensure that the Web Audio Input flag is enabled.

Comment 162 by Deleted ...@, Feb 16 2013

Thanks for the link. I have Web Audio enabled but I have no sound recorded. I guess I should see nice waves on the demo page, but there is none (cf. picture attached).

I've been using this feature for months and now I cannot make it work... It's a mystery.
ScreenShot080.jpg
39.9 KB View Download
I'm having the same problem as Gilles.  Seemed to just start happening.  Not working in Canary.  
Should have read above.  Web Audio Input has to be enabled in about:flags.
tsargent@: could you please check which version and platform you are
running using chrome://version.
Chrome version: 24.0.1312.57 (Official Build 178923)
Platform: OS X 10.8.2
henrika@: Chrome version: 24.0.1312.57 (Official Build 178923) 
Platform: OS X 10.8.2

Comment 168 by Deleted ...@, Feb 19 2013

I'm having the same problem as Gilles as well, and the problem is started 2 days ago, and the sample code I used is OK for last months.
Chrome version:26.0.1410.5 (Official Build 182376) dev-m
platform: Windows 7
Please try latest Canary.

http://webaudiodemos.appspot.com/input/index.html works on Windows 7 on
27.0.1416.0.

Comment 170 by Deleted ...@, Feb 22 2013

For browser-based audio production tools, such as a drum sequencer that one might be building, it would be great to record a stream of audio from samples that have been previously loaded. In the case of a sequencer, there are many wav files being handled in different buffers, but I'm still searching for a way to feed those buffers  to a single output for a stereo mixdown. This mixdown would then be bounced/rendered to disk and saved to the client machine as a PCM (bit-depth)bit WAV file. Hmmm. Any ideas?
For recording you can use a ScriptProcessorNode to intercept the audio stream and record.


I wrote a small library to help with recording WAV files client-side:
https://github.com/mattdiamond/Recorderjs </shameless self-promotion>

Comment 173 Deleted

Comment 175 by Deleted ...@, Mar 1 2013

I am unable to get any page with web audio input to work in Chrome Version 27.0.1426.0 canary on 
Mac OS X 10.7.5  (e.g. http://webaudiodemos.appspot.com/AudioRecorder/index.html?)

Web Audio Input flag is enabled, microphone has been allowed
No output in the Dev Tools console

The icon in the address bar is a video camera - not a microphone


Project Member

Comment 176 by bugdroid1@chromium.org, Mar 11 2013

Labels: -Area-WebKit -Feature-WebRTC Cr-Content Cr-Internals-WebRTC

Comment 177 by Deleted ...@, Mar 13 2013

Please, i  really want  video and audio messages ^_____^
jones@: please try latest Canary. You should no longer have to set the flag since WebAudio input is supported by default. The demo you refer to works well for me on Mac 10.8.6.

Comment 179 by Deleted ...@, Mar 19 2013

Hey guys,

Awesome work. Just got curious to test the api. Tried my best but was not working. After going through all the comments I finally realized that issue was of tuning both input and output. Can someone post the minimum things required on the project homepage to run the api? 

Thanks.
Project Member

Comment 180 by bugdroid1@chromium.org, Apr 6 2013

Labels: -Cr-Content Cr-Blink

Comment 181 by Deleted ...@, Apr 11 2013

I have last Chrome Canary and capture audio NO WORK:

Google Chrome:	28.0.1473.0 (Build oficial 193311) canary
Operating System:	Windows 7 

I have the live microphone input, utilizing the analyser to visualize the sound, working fine in Chrome 24.  The same code shows the mic input levels at zero as of Chrome 26.  Can anyone verify if this is a Chrome bug?
Ok, this page http://webaudiodemos.appspot.com/input/index.html and my previous code both work correctly for me in the current Chrome Beta (Version 27.0.1453.47 beta-m) on Windows 7.  However, I have a virtual machine running XP 64 and another physical machine running windows 7, that do not work on either example running the same latest Chrome beta (Version 27.0.1453.47 beta-m).  So, what could it be? (This is in reference to live webaudio input and the analyser node.) Also, is there somewhere else I should post this? Thanks.
Most probable reason for failure on Windows is that you don't use identical sample rates for input and output. It is currently a requirement. There are no guarantees that virtual machines are supported.
Any idea when then the sample rate requirement won't apply
Simply check settings for the default input device and output device. If they differ, live-audio input will not work on Windows.

Comment 187 by Deleted ...@, May 2 2013

I configure same sample rates in my Windows 7 and I can capture audio !
Thanks
What about Windows XP?
getUserMedia() is supported on Win XP but not live-audio input.
OK, so I still cannot get Win7 64bit working with Chrome 27.0.1453.81 beta-m.  I have gone to Win Control Panel and set MIC to 44.1k; 16bit; 2channel and AUDIO playback 44.1k; 16bit.  (I attached as screenshot of the settings).

I was using the test app: http://gentle-oasis-4517.herokuapp.com/index.html 

Am I missing something?  
audiomicprops.png
36.7 KB View Download
joe@: hard to tell; it should work given the settings you describe. We have recently done substantial modifications related to WebAudio on Windows. Could please try the same demo using Chrome Canary on your machine. Thanks.
@henrika - i was finally able to get it work.  I needed to set Chrome content settings to default mic.  I will now play with settings.  I will also get the latest "production" chrome too.
I forgot to mention that only the default mic is supported. The restriction on sample rates (same in both directions) is removed in Canary. Hence, you can select any combination of devices and sample rates as long as they are default. 
@henrika - i downloaded chrome production "Version 27.0.1453.81 m" -- it works fine. If the bitrate is set too high (192k; 16bit) it fails.  44.1k 16bit, 48k 16bit, 96k 16bit all work.  But that should be fine.  thanks - i did not try on Canary.  Hopefully in the future the settings - if mismatched will work.  It may be tough to have the end users fiddle around with the settings.
Canary will support many more combinations and will reach Dev, Beta and Stable after some time.
Thanks for working on this! I just tried Canary on Windows and when sample rates differ between input and output device, the sound is indeed working! However, it is wobbling, sounds like varispeed. Maybe related to:

https://code.google.com/p/chromium/issues/detail?id=164778

bjorn.melinder@: you must have golden ears to detect the effect of matching the different sample rates ;-) What combination of sample rates are you using? Can you send an output recording? I am guessing you are a musician and is listening to a specific tone where you know your reference really well. Can you hear any effects using pure voice as well?
Henrik, if necessary we can tune the smoothing to reduce any potential artifacts there...
henrika@: Golden ears, haha, I don't know if golden ears are required for this :) Please listen to the attachment around 0:04. It's an electric guitar through a cheap onboard soundcard on a PC. Input is set to 48kHz, output 44.1kHz. When changing both to 44.1kHz, the vibrato goes away. 

After that, Canary audio input stopped working so I can't tell whether speech is affected. Will reboot machine and try again after that.
varispeed windows.wav
2.8 MB Download
Got it. Might need some tuning from our side there as Chris states. In the mean time; hope you are OK with the "sample-sample-rate-mode" on Windows.
Of course - a lot better than no sound at all, it's a big usability improvement. Thanks!
Project Member

Comment 201 by bugdroid1@chromium.org, May 24 2013

Labels: -Cr-Internals-WebRTC Cr-Blink-WebRTC

Comment 202 by Deleted ...@, Jul 3 2013

We are waiting for adding this feature ASAP!!
Using CEF 3.1650.1503 (Chromium 31.0.1650.16) and Latest .Net/Mono (CEF3) still not working yet.  Any update please.  Thanks in advance!
whindes@: It is not clear to me what the issue is. Are you saying that getUserMedia fails for you on Chrome M31? If so, please add more details about what demo/application you are testing. Also add platform specifics. I am unable to assist on issues related to CEF.
henrika@:  Yes, here are some details -->

Not sure how to configure/set flags if necessary.

Using Source from:
https://bitbucket.org/xilium/xilium.cefglue
 Update to CEF 3.1650.1503 (Chromium 31.0.1650.16) on 2013-11-03

Using Visual Studio 2010 32 bit - Windows 7

Testing CefGlue.Demo.WinForm using URL
http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html

function getUserMedia(dictionary, callback) {
try {
navigator.webkitGetUserMedia(dictionary, callback, error);
} catch (e) {
alert('webkitGetUserMedia threw exception :' + e);
/* webkitGetUserMedia threw exception:TypeError: Object#<Navigator> has no method 'webkitGetUserMedia' */
finishJSTest();
}
} 
Can you please try a regular Chrome and avoid mixing in CEF. This thread
deals with pure Chrome related issues.
Thanks.
Status: Verified
Using just chrome 31.0.1650.16 with the http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html page works fine, the visualizer reacts to microphone input, microphone input is looped and played back. 

visualizer-live.html calls getUserMedia with audio only as a constraint:

function init() {
    getUserMedia({audio:true}, gotStream);

Hence the original issue (read the first initial report) is fixed. I suggests creating new bugs if you still encounter problems. It will more likely be fixed as well. Golden rule: one bug/issue per bug report.

Marking this as verified.

Comment 208 by Deleted ...@, May 9 2014

+
Owner: xians@chromium.org
Please add the kovunec in the toolbar
martyanovdenv@: I am unable to see how your comment is related to this issue (which is closed BTW). If you want to report problem, please open up a new issue and file it with a suitable title.

Comment 212 by Deleted ...@, Jun 10 2014

+
Showing comments 113 - 212 of 212 Older

Sign in to add a comment