superpoweredSDK / web-audio-javascript-webassembly-SDK-interactive-audio

🌐 Superpowered Web Audio JavaScript and WebAssembly SDK for modern web browsers. Allows developers to implement low-latency interactive audio features into web sites and web apps with a friendly Javascript API. https://superpowered.com
152 stars 16 forks source link

Timestretching example garbled or very staticy on recent versions of Chrome on Android #7

Closed svenoaks closed 4 years ago

svenoaks commented 4 years ago

Very garbled on Android 10, I have also tried other versions of Android and it's very staticy, though not as garbled, but still very bad. It seems it has happened with the recent updates of Chrome. Is there something with a buffer size being wrong now?

Example: https://drive.google.com/file/d/1_qrDIo8gYmCe1lPpSJZMAoi7OpGwUaRa/view?usp=sharing

gaborszanto commented 4 years ago

I only have some Android 9 devices, including the Samsung S10e, but it doesn't do that. Can you please the following very simple audio worklet example and console.log the output.length in bypass-processor.js? https://github.com/GoogleChromeLabs/web-audio-samples/tree/master/audio-worklet/basic/hello-audio-worklet/ What number is displayed on those problematic devices?

svenoaks commented 4 years ago

output.length is 128. All of those examples are also garbled or static on multiple devices, even after clearing Chrome storage and restarting devices. I guess Chrome needs a bug report and I suppose I will make changes to use ScriptProcessorNode for now.

gaborszanto commented 4 years ago

Google is well known for breaking audio features. :-) input.length is also 128?

gaborszanto commented 4 years ago

Please respond, input.length is also 128?

svenoaks commented 4 years ago

Yes it is.

gaborszanto commented 4 years ago

Is this problem still exist on your device? I still didn't encounter any device producing this.

peteee commented 4 years ago

Yes, it does! Android 9 as well Android 10 | Not sure if it's software or hardware glitch

gaborszanto commented 4 years ago

Please test with the latest version of Superpowered, just updated seconds ago.

laura-walsh commented 4 years ago

@gaborszanto Currently experiencing the same issue on an Android 8 device with the latest version of Superpowered Web SDK

gaborszanto commented 4 years ago

Do you experience this with our hosted example too, by visiting https://superpowered.com/js-wasm-sdk/example_timestretching ?

laura-walsh commented 4 years ago

Yes, the hosted example has some audio dropouts and crackling audio when I play it on the Chrome browser on the Android device, but sounds fine when I play it through Chrome browser on Mac

gaborszanto commented 4 years ago

Does it have similar problems when trying https://superpowered.com/js-wasm-sdk/example_effects ?

laura-walsh commented 4 years ago

Harder to tell for that one with its effects but I think I am hearing a little more crackling on Chrome on Android vs on Mac, with the same effect settings. The main thing I notice with this one is that there is a lot more lag on the Android whereas on the Mac the playback sounds very close to real time. That may be unrelated to the issue at hand, though.

gaborszanto commented 4 years ago

Android devices perform poorly with audio, especially if a browser is on top.

laura-walsh commented 4 years ago

Hi Gabor, I have been tasked with bringing the Superpowered Web Audio SDK to our product on Android. We are currently using the C++ Audio Library & SDK for our native Android app (under development). We want to redirect audio streams into the Superpowered Web Audio SDK for processing.

Are you saying the Superpowered Web Audio SDK doesn't work on Android?

When I include an AudioWorkletProcessor the audio is distorted on Android. I hear some light distortion with your example_timestretching on a Pixel2 on Android 8 at original tempo. I do not hear distortion with example_effects. There is a significant delay ~400ms.

What can I do to get the Superpowered Web Audio SDK working on Android? I have searched through the docs and the forums, but I may have missed something. Have you determined hardware and software limits/minimums? Please advise.

As well, since this case is closed, would it be best if I open a new ticket?

gaborszanto commented 4 years ago

Web Audio is not a reliable technology on every Android device yet. It has nothing to do with Superpowered.

This is not a hardware limitation, but a software problem. Android has well-known audio I/O problems itself (check out https://superpowered.com/latency) and Google is not able to resolve that. Putting another deep audio stack on top of that (in the browser) may or may not work on some Android devices.

Do you experience the dropouts with the timestretching example even if you keep the tempo at 1? Superpowered does no processing in that case.

laura-walsh commented 4 years ago

I agree that Superpowered processing is not the problem. However, I need to enable the Superpowered Web Audio SDK on as large an Android device base as possible. Currently, using Superpowered with an AudioWorkletProcessor is not usable on my devices. Looking for your advice for optimizing the use of the Superpowered Web Audio SDK on Android. Do you have any suggestions or ideas that have not been explored yet?

gaborszanto commented 4 years ago

Web Audio (the official API that we're using to set up audio I/O) is not ready for a stable release on most Android devices currently.

laura-walsh commented 4 years ago

I see, thank you. Please let me know if there is anything we can do to help.

dj-fiorex commented 3 years ago

Sorry to reopen this, but i want to buy SuperpoweredSDK for js but the playback on my Android 10 S20 Ultra and my android 9 S8 is garbled and choppy. I tried https://superpowered.com/js-wasm-sdk/example_effects and https://superpowered.com/js-wasm-sdk/example_timestretching ever without touching speed or pitch. Any news on this?

gaborszanto commented 3 years ago

Web Audio is not reliable on some Android devices, there is nothing we can do about it. Google is working on it: https://bugs.chromium.org/p/chromium/issues/detail?id=1090441