Since this was not working on latest chrome 71, I downgraded to chrome 60. I see that this program is recording from microphone instead from speechSynthesis.speak(). I feel the reason is because both audioinput and audiooutput have same deviceId="default". So how can I make it record from speak() ?
Kindly use a different descriptor other than "output" in this specification, as the intent appears to be re-routingmicrophoneinput to an HTMLMediaElement, not actual capture of an audio output (headphones or speakers) - or one of the specification authors yourself explain to users that are, in this case reasonably, expecting "audiooutput" to refer to headphones or speakers per Media Streams and Capture specification, not the exact same device as one labelled "audioinput", that they should reasonably expect "audioinput" to refer to the exact same device as one labelled "audiooutput"https://stackoverflow.com/a/45003549
2 Hi @guest271314, isn't this recording the user's mic - and not the actual synthesized speech? Is that what you intended? – Ronen Rabinovici Dec 1 '17 at 11:26
Thanks for this great example. I'm not sure if it is currently working in the latest Chrome (non beta). I have forked here to try it. I can see the audio player, but with no audio file in: jsfiddle.net/k1q07rsy – loretoparisi Dec 7 '17 at 9:36
@RonenRabinovici Yes, the original code at answer did record the device microphone. The original code is a workaround for the requirement to record speech synthesis by default at modern browsers. Updated code to set "audioouput" as device to record github.com/guest271314/SpeechSynthesisRecorder/commit/… – guest271314 Jan 10 '18 at 3:18
2 @loretoparisi See updated code which sets media device to record to "audiooutput" plnkr.co/edit/PmpCSJ9GtVCXDhnOqn3D?p=preview – guest271314 Jan 10 '18 at 3:22
2 @guest271314, I used the code at plnkr.co/edit/PmpCSJ9GtVCXDhnOqn3D?p=preview but it still recorded from my microphone. – Jeff Baker Aug 15 '18 at 22:54
This doesn't record speaker output. I tried capturing tab audio using chrome extension but still failed. It seems speechSynthesis is not using HTMLmediaElement for audio hence we shall not be able to capture at tab/browser level. The audiooutput mentioned above returns "default " for both mic and speaker since there is no way to set "kind" field while setting constraints in getUsermedia, it always captures "mic". Let me know in case more details required. – Gaurav Srivastava Mar 4 '19 at 1:13
Confirming that it records from microphone rather than speech synthesis - at least in Chrome 84. – joe Aug 13 at 11:15
This language should be conspicuously displayed at this specification
"audiooutput" refers to audio playback via a media element. It does not refer to microphone input or audio capture of anything.
https://bugs.chromium.org/p/chromium/issues/detail?id=1114422, so that no user will ever expect a device labelled "audiooutput" to refer to capture of headphones or speakers, and selectAudioOutputdoes not select or capture an output device (headphones or speakers) whatsoever.
Thus, the method name should be something like rerouteMicrohoneAudioToHTMLMediaElement().
The terms "audio output device" is not defined whatsoever at this specification.
The term
"audiooutput"
defined Media Capture and Streams specification (aka getUserMedia) https://w3c.github.io/mediacapture-main/ is defined asis not used in or re-defined in this specification.
Neither Media Capture and Streams nor Audio Output Devices API actually state they are intended to capture headphones or speakers.
Thus, using the term "output" is a misnomer that can lead to confusion when the requirement is to actually capture audio output to headphones or speakers This is again recording from microphone, not from audiooutput device #14
https://github.com/w3c/mediacapture-main/issues/720.
Kindly use a different descriptor other than "output" in this specification, as the intent appears to be re-routing microphone input to an
HTMLMediaElement
, not actual capture of an audio output (headphones or speakers) - or one of the specification authors yourself explain to users that are, in this case reasonably, expecting"audiooutput"
to refer to headphones or speakers per Media Streams and Capture specification, not the exact same device as one labelled"audioinput"
, that they should reasonably expect"audioinput"
to refer to the exact same device as one labelled"audiooutput"
https://stackoverflow.com/a/45003549This language should be conspicuously displayed at this specification
https://bugs.chromium.org/p/chromium/issues/detail?id=1114422, so that no user will ever expect a device labelled
"audiooutput"
to refer to capture of headphones or speakers, andselectAudioOutput
does not select or capture an output device (headphones or speakers) whatsoever.Thus, the method name should be something like
rerouteMicrohoneAudioToHTMLMediaElement()
.