Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Poor music quality using AVS on Android, suggest floating point PCM output #950

Closed
6 tasks
wjennings opened this issue Sep 6, 2018 · 5 comments
Closed
6 tasks

Comments

@wjennings
Copy link

Briefly summarize your issue:

The music quality from Amazon music is very poor when playing on android.

What is the expected behavior?

I would expect crisp, audio quality when playing back music.

What behavior are you observing?

The audio sounds scratchy and definitely degraded. Looking at the media player, I'd suggest playing with floating point PCM output (available to OpenSL ES via SLAndroidDataFormat_PCM_EX source with SL_ANDROID_PCM_REPRESENTATION_FLOAT representation).

Provide the steps to reproduce the issue, if applicable:

Trigger alexa to listen, ask to play a song/artist, and listen to the quality.

Tell us about your environment:

avs 1.9.0, running on android

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • [ x] Other - tell us more: Arm7 based platform

Tell us about your OS (Type & version):

  • [x ] Linux
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
@bennyAv10
Copy link

Hi @wjennings,

Thanks for raising the issue. We already have this on our backlog.

Thanks,
Benny

@wjennings
Copy link
Author

wjennings commented Sep 7, 2018

@bennyAv10,
Turns out, while going floating point may improve it, the real issue is in FFmpegDecoder::readData(), where the function av_samples_get_buffer_size is being called with align 0 (NO_FLAGS), where it should be called with 1. From the ffmpeg documentation:
align buffer size alignment (0 = default, 1 = no alignment)

This causes the number of bytes to be returned to be too large. For example, with nb_samples = 1114, 2 channels, 16-bit format, the size in bytes should be 4456, but the value being returned is 4480, which is 32 byte aligned.

This causes there to be empty samples played, which causes bad quality sound.

@kclchan
Copy link
Contributor

kclchan commented Sep 10, 2018

Hi @wjennings, thanks for the finding! We have opened an internal ticket to do more investigation and verification with your suggestion. Thank you so much again!

scotthea-amazon added a commit that referenced this issue Oct 24, 2018
Changes in this update:

**Enhancements**

* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.

**Bug Fixes**

* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](#973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](#948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](#839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](#950) - Improved Android Media Player audio quality.
* [Issue 908](#908) - Fixed compile error on g++ 7.x in which includes were missing.
@scotthea-amazon
Copy link
Contributor

Hello wjennings,

Release 1.10 includes a change to AndroidSLESMediaPlayer/src/FFmpegDecoder.cpp that is intended to fix this problem. If you can, please let us know if it works for you.

Thank you,
-SWH

@kclchan
Copy link
Contributor

kclchan commented Nov 10, 2018

I am closing this issue due to inactivity. Please feel free to re-open it if it has been closed in error.

@kclchan kclchan closed this as completed Nov 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants