Strange sound quality with decoding example
flosse opened this issue ยท 3 comments
@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
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.
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.
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.