-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Pitch causing problems on exoplayer #2751
Comments
Are you building a release version of your APK? If not, the audio playback may not be smooth (see #26 (comment)). If you see this problem with a release version of your APK, please provide all the information requested in the issue template so we can investigate further. |
I am having the exact same problem. For me it can be reproduced by adding an MP3 file as an asset in the demo app, and then setting PlaybackParameters with speed 1.25 and pitch 1. |
The problem is the same on a release APK for my own app. |
@clauskrogholm Testing on a Samsung Galaxy S4 running Android 4.2.2, a 44.1 kHz stereo MP3 played back fine at 1.25 speed. This was on a debuggable (non-release) build in the demo app. Please could you provide a link to the stream you're trying to play so I can try to reproduce the issue you're seeing? |
@andrewlewis First of all, thank you for taking such quick action! The file I tested in the demo app can be found here: https://www.dropbox.com/s/7ctbo1rxud0wlpj/02%20Amore%20E%20Musica.mp3?dl=0 I have tested on a handful of different files too, with the same result. And all of them play back flawlessly on speed 1.0. |
Thanks. I can reproduce the issue with that file. |
@andrewlewis That is good to know - after all, a reproducible error is so much more fixable than an unknown error :-) Thanks again for the swift reply! |
on my app it worked on release mode |
@clauskrogholm I'm afraid I spoke too soon -- although playback is not smooth with that file on a debuggable APK on my test device, it plays fine if I use a signed, release APK.
|
@andrewlewis I will check as soon as possible, and revert. |
@andrewlewis I just tested that the APK was a signed release APK (yielding no output from the aapt command). Also - to be absolutely sure - I generated a new signed APK and transferred it to my device via Android File Transfer, and installed it from there. What I find quite strange is that the high level of distortion that I am experiencing is neither better nor worse when I am explicitly using a debug build... The playback sounds exactly the same. The following is a link to a bug report generated via the developer options on my device: Thanks for your time in examining this, and please let me know if I can provide anything else to shed light on the subject! |
@clauskrogholm Could you also describe what the distortion sounds like or attach a video of the problem? We've found an issue with using extensions and variable playback speed, where the byte buffer endianness is set incorrectly. This can result in very noisy sound, rather than the stuttering playback experienced when using a debuggable APK. It's probably unrelated to your issue unless you're using the FFmpeg extension to play your MP3. |
@andrewlewis It is a bit difficult to describe - my main impression is that the background music sounds "wobbly" (as if played under water, if that makes any sense). There are no stutters as such, and I have noticed that the lyrics themselves actually sound quite decent. I don't know if it could be because the Sonic framework is more geared towards speech? I haven't done anything special regarding extensions - simply added the MP3 file as an asset in your demo app, and set the PlaybackParameters to the increased speed. Not sure if I mentioned it earlier, but I am testing on a Samsung Galaxy S8, running Android 7.0. Even though, by your previous directions, I feel confident to have verified that I am actually using a release build, I find it weird that there doesn't seem to be any quality difference between a debug build and a release build - but that is perhaps because I am on API 23? |
@clauskrogholm I think you might be right that the distortion is expected with Sonic. One way to verify that this isn't the same performance issue would be to run on the most powerful device you can find running Android Nougat and check whether you hear the same thing. There is a quality/performance trade-off, and if you can find another suitable speed/pitch adjustment library that gives output that sounds better when processing music we could investigate integrating it as an alternative. Thanks! |
@andrewlewis I guess it would be difficult finding a more powerful device than the Galaxy S8 right now, so performance definitely shouldn't be an issue. I have been looking towards the Superpowered library, but so far have found it too cumbersome to integrate into my own app - I am really looking for something that is as approachable as ExoPlayer... I will try to make a recording of the sound both with speed 1.00 and 1.25, in the hope that you could tell if the quality difference is expected or caused by something else. Thanks for your continued support! |
One other thing that's worth trying is to use Android's regular MediaPlayer API to play the sample at 1.25x, which is supported on more recent API levels. IIRC MediaPlayer also uses Sonic internally. If you experience the same distortion using that approach then it's probably expected with Sonic. If MediaPlayer is distortion free then that would point more toward an ExoPlayer issue. |
@ojw28 Thank you for the suggestion. I already tried the MediaPlayer API in order to have a reference, and it exhibits the same level of distortion. So I think you're right that it points to a Sonic issue rather than an ExoPlayer issue (I was not aware until now that MediaPlayer is also based on Sonic). |
In that case it sounds like things are working as intended. @andrewlewis did find some incorrect rate/pitch adjustment logic in the Sonic library, which we've fixed in 631cce9. Apparently it does sound a little better with the fix, so give that a try and see if it helps! The fix has also been merged into Sonic, and should be merged into Android O as well. |
Guys first of all thank you for adding the PlaybackParameters function to exoplayer.
but the pitch variable is causing some problems on Exoplayer when im setting different speeds
in different phones and android versions.
on a motorola g1 android 5.1 i set the speed at 1.5x and pitch to one and the audio gets all distorted
on a samsung s4 android 4.4 i set the speed at 2x and pitch at one and the same happens
can you guys give me a clue of what to do?
thanks
The text was updated successfully, but these errors were encountered: