question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

in iOS WebAudio streams buffer is empty

See original GitHub issue

Hi, I’m on iOS, trying to get mic stream and send to Google Cloud Speech to Text service. So I need a replacement for getUserMedia, and splicing the Google sample and one of the example in one of the closed issues I did:

context = new AudioContext({latencyHint: 'interactive'});' var processor = this.context.createScriptProcessor(2048, 1, 1); processor.connect(context.destination);

audioinput.start({streamToWebAudio: true}) var dest = audioinput.getAudioContext().createMediaStreamDestination(); audioinput.connect(dest); var stream = dest.stream; var input = context.createMediaStreamSource(stream); input.connect(processor); processor.onaudioprocess = (e)=>{ var left = e.inputBuffer.getChannelData(0) console.log(left)//<---buffer seems empty ; };

I did get the mic permission popup the first time around so I think the mic was listening. I am total noob on audio, any tips to get mic stream greatly appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
orryoraclecommented, Aug 27, 2019

I managed to achieve my original goal of getting mic input’s stream in iOS and sending it to speech recognition service by getting a MediaStream out of the audioInput. The root cause of my problem was v 1.0.2 doesn’t work on iOS for me, reverting back to v 1.0.1 fixed this. Plugin works great - thanks @edimuj for this!

1reaction
orryoraclecommented, Aug 21, 2019

Thanks for the response and link to sample code! The sample app works, as I can hear my mic input echoed back.

I should have mentioned that I’m using ionic capacitor which is largely cordova plugin compatible. With the cordova app sample in hand, I can start to investigate the issue on capacitor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebAudioAPI decodeAudioData() giving null error on iOS 14 ...
It's a callback function for an async fetch() process that's grabbing the mp3 data from the stream. async function pushStream(value) { // Web...
Read more >
BaseAudioContext.createBuffer() - Web APIs | MDN
The createBuffer() method of the BaseAudioContext Interface is used to create a new, empty AudioBuffer object, which can then be populated ...
Read more >
Web Audio API on iPad | Apple Developer Forums
Note: On iOS, the Web Audio API requires sounds to be triggered from an explicit user ... play empty buffer to unmute audio....
Read more >
Web Audio API - W3C
Audio stream synthesis and processing directly using scripts. ... The promise resolves when the frame buffer is empty (has been handed off ...
Read more >
Getting started with Web Audio API
The Web Audio API uses an AudioBuffer for short- to medium-length sounds. The basic approach is to use XMLHttpRequest for fetching sound ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found