Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange sound quality with decoding example #306

Open
flosse opened this issue Jun 22, 2023 · 3 comments
Open

Strange sound quality with decoding example #306

flosse opened this issue Jun 22, 2023 · 3 comments

Comments

@flosse
Copy link

flosse commented Jun 22, 2023

@orottier first of all:
I really like your approach to not re-invent the wheel and to use an existing API as a starting point 👍
And thanks for all your work, it all looks like a very cool project 😄

Now here is my issue:
I just run the decoding example with an MP3 sample (I think it's stolen from cpal or symphonia) and it sounds terrible.

What's going on there?

Here is the sample: music.zip

@orottier
Copy link
Owner

Hi @flosse, thanks for the kind words!

It works on my machine ™

Do you happen to run on Linux with the ALSA sound system?
We are currently looking into an issue there #288 because it does not seem to work properly with the very low default latency of the Web Audio API specification.
We have just landed a fix on main so perhaps you could try to run
WEB_AUDIO_LATENCY=playback RUST_LOG=debug cargo run --release --example decoding

Even when you are not running on ALSA I'd be interested to review the output of the above command. Remember to pull a very fresh checkout of main because the latency option has only just landed.

@flosse
Copy link
Author

flosse commented Jun 23, 2023

Do you happen to run on Linux with the ALSA sound system?

yes

WEB_AUDIO_LATENCY=playback RUST_LOG=debug cargo run --release --example decoding

this works fine 👍

So probably this latency should be set as default.

@orottier
Copy link
Owner

Thanks @flosse. I'm relieved to hear this fixes your playback issue.

Deviating from the official specification for audio hosts that are unable to provide low latency is probably the sensible thing to do. However we actually want to push users to start using Jack instead and benefit from the low-latency features this library offers. The readme has been updated with this info.

I'm leaving this issue open so sort out two things:

  • is there anything we can do to make ALSA behave properly?
  • how can we communicate the issue properly and in a more general way? e.g. measure the number of buffer underruns and print out the suggestions to use a higher latency setting when applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants