Visualization does not work on the new Galaxy devices
mobilevisuals opened this issue · 75 comments
A visualizer can have an internal music player, which means that the app has its own built in player. It can also use the music from external music players( Winamp for instance). Visualization for external players does not work on the new Galaxy devices.
I have played music with external players, while debugging the visualizer apps. The bytes in the updateVisualizerFFT method are always 0 for external players, when a visualizer is created with 0 as an argument.
This results in no visualization, since there is no signal to use for visualization.
It still works for internal players. The bytes in the updateVisualizerFFT are not 0 then, so the app has something to use for visualization, even when the visualizer is created with 0 as an argument.
This is caused by an Android code bug in the Digital Signal Processors, which are included in the new Galaxy and some HTC devices.
Several visualizer apps have this warning message:
"NOTE: To Galaxy S/S2/S3/S4, Galaxy Note 1/2, Galaxy Nexus and HTC Rezound owners: The visualizer will sporadically show a flatline with many music players, due to an Android bug related to the built-in DSP in these phones. This is a problem for all music visualizer apps on these phones, as evidenced by user reviews of other apps. Still looking for a work-around, but we'll probably have to wait for a future version of Android to fix it. If you have this problem, I apologize! Please email me and I will refund you."
Almost all visualizer apps on the market have this problem and can’t visualize from external players on the new Galaxy and some HTC devices.
It seems like it is possible to solve this problem, because external visualization works on the Morphyre Music Visualizer. It is right now the only visualizer on the market, where this works.
Hello. I'm developing and publishing "Music Visualizer" app on Google Play store. My app also have the similar issues, so I know some causes of them.
First, visualizer not working issue is not a single issue. There are several reasons that makes visualizer not working.
1. Galaxy devices (except for S4) and HTC Rezound
Sorry, I don't know about this issue on these phones. I have Galaxy S2 (SC-02C, JP model), but visualizer works well on it. But I got some feedback from Galaxy S3 users that my app doesn't work on it.
2. Galaxy S3, S4, Note 3 and derived models (Snapdragon model only)
Snapdragon based Galaxy S4 have visualizer not working issue. My Galaxy S4 (SC-0E, JP model) corresponds to this case. I investigated this issue and found the reason.
It uses hardware acceleration playback mechanism called "Tunnel Player (Tunnel Playback)" when playing music files. If the tunnel player is used, audio capturing process is bypassed. As a result, visualizer does not work at all.
There are several conditions for the tunnel player to be used.
- Snapdragon platform
- "tunnel.decode = true" system property is set
- Audio playback by MediaPlayer class (*1)
- MP3 or AAC playback only
- Only one instance is permitted (can't create multiple tunnel player instances)
So, workarounds are the follows;
- Use Open SL API instead of MediaPlayer class (*2)
- Use OGG format instead of MP3 or AAC
- Put "tunnel.decode = false" in build.prop file (!!! root required)
- Occupy tunnel player instance by dummy silent MP3/AAC file playback.
Second MediaPlayer instance will fall back on standard audio playback mechanism.
(November 20, 2013 added: I found that MediaPlayer.start() is not required on the dummy instance, only MediaPlayer.prepare() call is needed. sample code is here)
NOTE 1) This issue is already reported on Samsung's developer forum. (But it seems not fixed yet...)
NOTE 2) Originally, the tunnel player seems to have been introduced by Code Aurora Forum's developer.
3. Nexus 4, Nexus 5 and Nexus 7 (2013) (maybe Snapdragon based Nexus only)
Nexus series devices are Google's reference model Android devices. So sometimes they support new features earlier than vendor customized models.
The Google has introduced low-latency audio playback feature since Android 4.1. But it has a side-effect, visualizer doesn't work while music playing by Open SL APIs.
However this issue only occurs on certain Nexus devices. Nexus 10 also supports low-latency playback, but it doesn't have the issue. I think the difference came from base platform difference, Nexus 4 and 7 (2013) are using Qualcomm's Snapdragon SOC, on the other hand Nexus 10 uses Samsung's Exynos SOC. (I don't know that Galaxy Nexus has this issue, but it's interesting because the phone using OMAP SOC.)
Workaround is the follow;
- Use MediaPlayer class based player apps (*1)
ref.) http://source.android.com/devices/latency_design.html
4. Some custom ROMs (Old LiquidSmooth, RootBox and VanirAOSP)
Some custom ROMs have bugs on visualizer implementation. I fixed it on LiquidSmooth, RootBox and VanirAOSP ROM, but I'm afraid that there are other custom ROMs still have this bug.
- LiquidSmooth-Old/android_frameworks_av#1
- https://github.com/LiquidSmooth/android_frameworks_av/pull/2
- Root-Box/frameworks_av#1
- http://vaniraosp.goo.im/#/c/5820/
5. CyanogenMod 10.2 (ADDED on November 18, 2013)
On CyanogenMod 10.2, Visualizer class doesn't work if it created with audio session 0 (= system mixed output).
This issue seems to occur on certain devices only.
[Affected]
- Nexus 7 2013 ("flo")
- Galaxy S Relay G4 ("apexqtmo")
[Not affected]
- Nexus 7 2012 ("grouper")
6. Recent Motorola's phones (Moto X, DROID Mini, ...) (ADDED on November 23, 2013)
Maybe this issue is only occur on JellyBean. After upgrading to KitKat, it seems to be fixed. (A my app user confirmed this, he is using a Moto X phone.)
(*1) MediaPlayer class based player apps:
Music Visualizer built-in player, Google Play Music, PlayerPro (without DSP pack), Rocker Player Free, doubleTwist, n7player, Apollo
(*2) Open SL based player apps:
Poweramp, jetAudio, WinAmp, PlayerPro + DSP pack, Rocket Player Premium, GoneMad, Neutron
Thanks,
Haruki Hasegawa (h6a h4i)
It seems like there can be no definite solution to this problem until a new software update is released from Samsung.
How can we make them aware of this problem and encourage them to solve it as soon as possible?
Music visualization always works on the new iOS devices without any issues. Music visualization should work on all the new Android devices according to the specification, but it does not work on a lot of the new high profile devices, like Samsung's S4. This gives Android a bad reputation and makes people want to buy iPhone instead.
I agree that this is vendor issue. Have you tried contacting Samsung directly and seeing if they have a process for reporting such issues, or even a bug tracker (I know Apple has something like that, for example). I'm not in a position to test myself, as I don't have the device in question.
I'm afraid that I'm not that hopeful here, when a manufacturer ships a device that has a bug in its API, there's only so much you can do. Given how long it takes to get a bug fix from reporting stage to actually being pushed out to devices, sadly I don't think this will be fixed soon. Still worth a try though... :(
My Samsung Galaxy S4, Model SPH-L720, with Android version 4.3, suffers from this problem. Using MediaPlayer to play an MP3 causes the Visualizer to send a steady stream of 0's in the case of onFftDataCapture(), and a steady stream of -128's in the case of onWaveFormDataCapture()
I've tried one of h6ah4i's suggested work arounds: to play a quiet dummy MP3 before playing the actual music MP3. However, I did not see success. I used the 30second and 60second quiet MP3's found here: http://www.xamuel.com/blank-mp3s/
Maybe those MP3's aren't suitable because there wasn't enough data to enage the tunnel player ?
Hello abiemann. I think the Visualizer issue on SPH-L720 is different from tunnel player's side effect. Because the tunnel player is only used on Snapdragon SOC, SPH-L720 is a Samsung's Exynos SOC model... Oops, SPH-L720 is a Snapdragon model.
I downloaded the 1 min length MP3 from your suggested URL, and tried the workaround with using it. The result was good, it seemed to work on my S4 (SC-04E).
Have you tried Poweramp player already? It's the most easy way to identify the cause is a tunnel player's side effect.
Hi h6ah4i - I did try PowerAmp and with the Visualizer getting data from the mixer i.e. "audioSession=0" does indeed return real amplitude data instead of 0's.
However, my app uses the MediaPlayer and no amplitude data was returned by the Visualizer API on my S4. On other devices like the Nexus 7, and Nexus 4 there's no problem.
When I attempted the work-around with the quiet MP3, I simply created two MediaPlayer objects: one played the quiet MP3 first (looping was enabled), the second MediaPlayer then played the real music - but again I received no amplitude data from the mixer :-(
@abiemann I made a sample code that shows how to avoid tunnel player. Can you try this?
I want to test your sample app, to see if it fixes the problem. I only need the APK file to test, I don't need the source and the other files. Can you upload the APK file? abiemann, have you tested the file?
I think that this bug is devastating for the music visualizer business. There is no point in making music visualizers if they can't work on the most popular devices. I am not going to make any more music visualizers until this is fixed. It simply results in too many refunds and complaints from users.
This bug also makes people want to buy iPhone instead, since music visualizing works without problems there.
Maybe we should contact the Code Aurora project, since they are responsible for this bug?
Sorry about that long delay - and thank you h6ah4i for your effort !
I've just deployed the "tunnel player workaround" to my Samsung Galaxy S4 (Model SPH-L720, Android 4.3, Hardware version L720.08) and after pressing "play" and selecting a music track, I do see a red waveform on the display that matches the beat of the music ! It looks like the work-around is functional.
@abiemann, great to hear you've found a workaround for the tunnel player. Do you think you could perhaps integrate the same workaround into this project and submit it as a Pull Request, so others can benefit? Thanks
I have tested on my S4 Mini. The visualization works the first time the project is installed from Eclipse. I test with the music players "Sound picker" and "Choose music track". I close "Tunnel player workaround" and then start it by clicking on the app icon. The visualization also works now for both of the music players.
I restart the S4 Mini and open "Tunnel player workaround". The visualization does not work now, it only shows a flatline.
abiemann, do you get the same problem when you restart your S4?
h6ah4i, is it possible to make the visualization work then the device is restarted? It seems like the restart messes up something.
@mobilevisuals I think it's impossible to make the workaround more reliable. No way to obtain whether the MediaPlayer instance backend is a tunnel player...
h6ah4i; Do you get the same problem when you restart your S4?
Felix: Have you tested this on your mobile? Do you get the same problem when you restart it? I want to know if this only happens on the S4 Mini, which is a very compact device. This makes it limited in some ways, it doesn't have the full capacity as the S4.
@mobilevisuals The demo app works properly on my S4 after rebooting.
That is really good to hear! Have you deployed this code fix in your Visualizer app? It is a big improvement, since S4 is the most popular device now.
Mobiroo tested some of my company's visualizer apps and they found that visualization does not work on the Vanilla build on the Galaxy Note, HTC Evo 3D, Samsung Galaxy S3, and Samsung Galaxy S2.“ It is called Vanilla when not customized from its original form. They found the same problem on the integrated build of Galaxy note, Galaxy S2, and HTC Evo 3D.
Is Galaxy Note derived from S4? I assume that the code fix won't solve the problem on the Nexus devices, HTC Evo 3D, S3 and S2,since these are not derived from S4.
Which part of the code in the project can be used to fix the problem? I can add it to one of my visualizer apps and then send it to Mobiroo for testing. Then we'll know on which devices it works.
I got a response from Samsung today and they want a description of the problem. Isn't this also caused by a bug in the Digital Signal Processors? If so, how should I describe the DSP connection? This is what I plan to write, can you tell me if this is OK or if should add or remove something?
Music visualization should work on all the new Galaxy devices according to the specification, but it does not work on a lot of the new high profile devices, like the S4. We have investigated the problem and we came to these conclusions:
Galaxy S4 and derived models
These devices use a hardware acceleration playback mechanism called "Tunnel Player (Tunnel Playback)" when playing music files. If the tunnel player is used, audio capturing process is bypassed. As a result, visualizer does not works at all. This issue is already reported on Samsung's developer forum, but it seems not fixed yet.
• http://developer.samsung.com/forum/board/thread/view.do?boardName=GeneralB&messageId=238465
Originally, the tunnel player seems to have been introduced by Code Aurora Forum's developer.
• https://www.codeaurora.org/cgit/quic/la//platform/frameworks/base/tree/media/libstagefright/AwesomePlayer.cpp?id=refs/heads/b2g/ics_strawberry
Other Galaxy devices
It has been showed by tests conducted by Mobiroo that music visualization do not work on Galaxy Note and S3. Snapdragon based S3 uses LPAPlayer for MediaPlayer class backend. The "LPA" means Low Power Audio, and the LPAPlayer seems very similar to tunnel player, so this is probably causing the problem here. We do not know the reason why music visualization does not work on Galaxy Note.
I think this problem is very serious, because it gives Android a bad reputation and makes people want to buy iPhone instead. Music visualization always works on the new iOS devices without any issues. I know several people, who have bought iPhone instead of Android, just because they want music visualization to work.
Several developers of music visualizer apps are trying to solve this problem in an open source project. You can find more information here in this thread:
I've already introduced this workaround method in my Music Visualizer app since v1.5.0 (about five months ago). But sometimes the workaround fails, because another player app has already gained the tunnel player instance before my app launched. So, even now, some users report me that my app sometimes does not work, or suddenly stopped to work.
I don't know about Galaxy Note, S2, S3 and HTC Evo 3D's issues. At least my app works on my Galaxy S2 (SC-02C with stock Android 4.0.3 ROM) and HTC Evo 3D (ISW12HT with stock Android 4.0.3 ROM). And I know a bit about S3. Snapdragon based S3 uses LPAPlayer for MediaPlayer class backend. The "LPA" means Low Power Audio, and the LPAPlayer seems very similar to tunnel player. Yet, I'm NOT sure the LPAPlayer is the evil.
Which part of the code in the project can be used to fix the problem?
Refer to onCreate() method of MediaPlayerLocalService class.I got a response from Samsung today and they want a description of the problem. Isn't this also caused by a bug in the Digital Signal Processors? If so, how should I describe the DSP connection? This is what I plan to write, can you tell me if this is OK or if should add or remove something?
Sorry, I don't know WHY visualizer doesn't work when tunnel player is used. I haven't read the TunnelPlayer class, ALSA and lower drivers implementations completely. So I can't describe about DSP : (
Are you going to write about THIS issue ticket? I think it provides very useful information for Samsung's developer.
And... I'm not good at English, so please correct my sentences more preferable.
I have reported to Samsung now and I referred to this thread. Thanks for the S4 code fix! I am going to add it to one of visualizer apps. I hope that it solve this issue for S4, but there are a lot of other devices with problems
It would be good if we could list all the devices, which don't support music visualization. These could then be excluded from the compatibility list on Google play. This would decrease refunds and bad reviews. Do you know any more new devices,which don't support music visualization?
There's one additional technical detail that I just discovered on my Galaxy S4...
If the media volume is set all the way down by the user then the Visualizer data immediately stops coming through. For example, this means that onFftDataCapture() will return an fft[] containing just 0's
This will happen even with the tunnel workaround implemented, and for any audio session ID, and even with the Visualizer scaling mode explicitly set to SCALING_MODE_NORMALIZED.
If the media volume is increased just slightly then the Visualizer data will start coming through again.
h6ah4i: I try to add your S4 code fix to my app "Astral 3D visualizer", but I can not get it to work. I put the call
mSilentPlayer = createSilentMediaPlayer();
right before I create my own Mediaplayer in onCreate() of the main activity. The silent media player doesn't get started , which makes the tunnel player start. This makes the music visualization not work. I test on my S4 mini, but also on S4 on Samsung Remote labs (or should music visualization not be tested here?). It is the same result on both of these. I debug the code and I see that mp.setDataSource causes an IOException. The values for the arguments are:
FileDescriptor 45
startOffset 60
lengthFile 34478
I then debug tunnel_player_workaround and it is the same values and the same IOException here. I only see a flatline on tunnel_player_workaround now. I uninstall the app and install again, but it is the same thing. I test on S4 on Samsung Remote labs, but it is the same thing here. I haven't changed any code in tunnel_player_workaround. Do you know how I can proceed here?
@mobilevisuals It seems strange. On my S4, ParcelFileDescripter is like the flollowing;
{ParcelFileDescriptor: FileDescriptor[46]} start=60 len=961305}
FileDescriptor value is different, but it's OK, this value is determined on runtime. However len parameter is different, it's a problem. Maybe your MP3 file is broken.
The MP3 file that I use is 34 478 bytes and has MD5: 1D52337F55B07B6B823F5BFA9C4452FB. Do you have the same on your file? If so, how can the file be broken?
I don't know why your MP3 file is different from mine... Please download it again from the repository.
https://github.com/h6ah4i/tunnel_player_workaround/blob/master/assets/workaround_1min.mp3
% git clone https://github.com/h6ah4i/tunnel_player_workaround.git
Cloning into 'tunnel_player_workaround'...
remote: Counting objects: 45, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 45 (delta 0), reused 45 (delta 0)
Unpacking objects: 100% (45/45), done.
Checking connectivity... done% cd tunnel_player_workaround/assets
% dd if=workaround_1min.mp3 of=broken.mp3 bs=1 count=34478
34478+0 records in
34478+0 records out
34478 bytes transferred in 0.119411 secs (288734 bytes/sec)% ls -la *.mp3
-rw-r--r-- 1 h6ah4i staff 34478 12 4 07:25 broken.mp3
-rw-r--r-- 1 h6ah4i staff 961305 12 4 01:30 workaround_1min.mp3% md5sum *.mp3
8e2e1af675842886571ffd6452175b80 broken.mp3
14989cdbc0786e8ec326a7483374acad workaround_1min.mp3
Thanks, I got it to work on the S4 now! I tested on Samsung remote labs. It is possible to test there, but you have to go to the settings and turn up the media volume, because it is set to 0 as default. You will always get a flatline if you don't do that. Have you tested your app on Samsung remote labs? Maybe we should test the visualization on all the devices there? This would make it possible to exclude the incompatible devices, which would reduce the bad reviews and the refunds.
I also tested on S4 Mini, but the music visualization still does not work on tunnel_player_workaround or Astral 3D Music Visualizer . S4 Mini is however a very compact device, with some limitations.
I am listing the devices, which don't support music visualization. These can then be removed from the compatibility lists on Google Play, to avoid bad reviews and refunds. I checked all the reviews for my visualizer apps and found these incompatible devices:
S4 mini,Nexus 5,Kyocera Rise,LG Spectrum 2,Nexus 4,Nexus 7,Galaxy Note
Galaxy Note was incompatible according to Mobiroo's testing, so I added that one too.
Does anyone know any more devices, which don't support music visualization?
Mobiroo says that the integrated build of S3 is compatible, it is only the vanilla build, which is incompatible.
My apps have got 6 reviews from S3, where music visualization worked, so I think S3 can be listed as compatible.
I have not got any review, where it didn't work on S3.
Mobiroo also says that it doesn't work on neither the Vanilla build nor the integrated build of HTC Evo 3D and Galaxy S2. This is very strange, since my apps only have got reviews from these devices, where music visualization worked.
These devices support music visualization according to the reviews of my apps:
Galaxy Note2
Galaxy Tab3 8.0
EVO 3D
Galaxy S3
Event (C5133)
Galaxy Mega
Galaxy Prevail II
ST21a
Iconia Tab A100
TF700T
Optimus L3
Galaxy Tab2 10.1
XOOM (stingray)
C1505
Galaxy S II
Galaxy S I
@felixpalmer I added the workaround code in your android-visualizer app.
And I've just sent a pull request (#6).
Haruki, thanks for sharing all this info! I've been getting multiple emails a day for the past year because of this.
Do you know if your solution for occupying the tunnel player helps when using audio session 0 to listen to other media players, or is it only helpful for playing your own audio? i.e., is only one tunnel player allowed on the entire device, or only one per app?
@cypherdare The number of tunnel player instance is limited to only one per entire device. Therefore the workaround is effective for sounds from other player apps. But you must note that it's too difficult to maintain the sequence of creation MediaPlayer instances among different processes. So the workaround is not perfect, and sometimes it won't work as expected.
Yes, that's what I figured--there's no way to determine which music player will be the tunnel player.
If you don't mind (which I suppose you don't given the license you put on it), I may rework your tunnel_player_workaround project into a free app for Google Play. (Clean it up a bit, give it a nice icon and add instructions). It might be a good way to learn from many users how best to use it. For example, I could start by instructing the user to close all media players and then hit a button in the Tunnel workaround app that restarts its player. Then see what kind of feedback I get from users emailing me to see if that is adequate.
And maybe we could add a persistent service that forces the tunnel player to never get closed.
I can fork it from your project if you want.
That's a nice suggestion. I don't mind if you fork and rework the tunnel_player_workaround project. It's licensed under the public domain (see the license file; https://github.com/h6ah4i/tunnel_player_workaround/blob/master/LICENSE).
Thanks. I'll try to work on that this weekend. I'll keep you all in the loop when I release it.
Haruki, what is the reason your tunnel_player_workaround starts the silent media player, but the version for this project says in the comments that start() is not needed? And shouldn't the player need to play the file repeatedly on a loop to keep it going? Thanks.
Cypherdare, I don't call the start() method in tunnel_player_workaround project. Have you read the createSilentMediaPlayer() method of MediaPlayerLocalService? Also you can start and play the silent file repeatedly instead of leaving the state of prepared. However, I think leaving the prepared state is more better because it can save CPU power.
OK, I can see clearly that you don't call start, so I must have been looking at the wrong method before. Thanks.
So even if leaving it prepared without starting the file, does it hold onto the tunnel player for as long as the service is running?
I am trying to create it in a foreground service (persistent notification) so Android won't try to kill it. I can also put a restart button in the notification so, if necessary, the user can force close their media player that isn't visualizing and then just hit Restart. Restart tells the service to release the silent media player and recreate it (prepare it).
I think there is no problem on your plan. In fact, my Music Visualizer(*) app uses media player without starting to avoid the tunnel player. It hold onto the tunnel player until its process is killed.
(*) https://play.google.com/store/apps/details?id=com.h6ah4i.android.music_visualizer2&hl=en
Are you aware if KitKat's Nexus audio tunneling feature is a different implementation than the buggy Samsung one? http://www.androidpolice.com/2013/10/31/kitkat-feature-spotlight-audio-tunneling-to-dsp-dramatically-reduces-battery-consumption-when-playing-audio/
Yes, I've noticed that KitKat uses a new implementation of audio tunneling (DSP offloading) feature. If DSP offloading is used on Qualcomm devices, audio data is captured by offload_visualizer. However I'm not sure which is more buggy KitKat's one or Samsung's one.
I guess, CyanogenMod 10.2 bug is related to the new DSP offloading feature. I've noticed that the bug was introduced since 10.2 (KitKat), and it occurs on Qualcomm devices only.
Modified on Feb., 14
I noticed that my guess was wrong. First, I made a mistake that CM 10.2 is a Jelly Bean. On my Nexus 7 "flo" installed CM 11 has the number 3 issue only, so, the number 5 issue is the CM 10.2 specific. Then, I tried to fix number 5 bug, and built CM 10.2 from their source code. However, the bug wasn't reproduce on my own built ROM, and I've gave up to fix it...
Haruki, I saw in your first post point number 4 you said you fixed some ROM implementations of Visualizer. One of my users wrote to me and suggested that I write a module for Xposed (http://forum.xda-developers.com/showthread.php?t=1574401) that fixes the problem, so anyone can repair whatever ROM they are using by downloading the module.
However, I know absolutely zero about building or modifying ROM's, so I don't know if that is a possible solution. Do you have any idea about this?
@cypherdare Sorry, I don't know well about the Xposed framework. The number 4 issue was just a careless bug on certain custom ROMs. To fix the bug, I had to replace libaudioflinger.so and libvisualizer.so system library files. The Xposed seems to have replacing native libraries feature, so I think we can fix the issue 4 with using Xposed.
However, I think Xposed cannot be a best solution. Because it requires root permission, furthermore it's impossible to make mods for all visualizer-broken devices.
Yes, sounds like too specific of a solution if a unique .so must be generated for every phone model.
I have received 2 reports that music visualization does not work on Galaxy S5. Have you tested if the S4 fix also works on S5?
I really wish that Samsung would fix this problem. I have informed my connections several times, without getting any reply.
From my personal investigations, it seems like the S5 is using the
DSP-offloading in most of the times and therefor bypasses the standard
visualizer-effect.
But they have also implemented a visualizer-effect for that offloaded
audio-path which gets called from inside libtinyalsa or libtinycompress.
But if this is working.. I don't know that yet so I have also excluded the
S5 in general for my application (AirAudio).
The S4-fix WON'T help here and I haven't found any fix inside the
build.prop which might help here.
Hope anyone has more luck with that and can share his/her knowledge with us
:)
2014-05-04 18:53 GMT+02:00 mobilevisuals notifications@github.com:
I have received 2 reports that music visualization does not work on Galaxy
S5. Have you tested if the S4 fix also works on S5?I really wish that Samsung would fix this problem. I have informed my
connections several times, without getting any reply.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-42137777
.
I see, I really hope that someone has a solution for this. S5 will soon be the most popular Android device. It is a pity that we have to put this device as incompatible with our apps.
I am really dissapointed with Samsung. The developers have informed them that their new Galaxy devices can not handle music visualization, which is an Android standard supported in the SDK. They still release another top device without support for music visualization.
I wanted to help out and inform them so that their new devices could be as good as the iPhones. But I get nothing for it, not even a reply, just a mail saying "we have passed along your message to the appropriate person".
To clarify, is Visualizer broken for all music apps on the S5, not just
ones that don't use OpenSL ES?
On Tue, May 6, 2014 at 9:48 AM, mobilevisuals notifications@github.comwrote:
I see, I really hope that someone has a solution for this. S5 will soon be
the most popular Android device. It is a pity that we have to put this
device as incompatible with our apps.I am really dissapointed with Samsung. The developers have informed them
that their new Galaxy devices can not handle music visualization, which is
an Android standard supported in the SDK. They still release another top
device without support for music visualization.I wanted to help out and inform them so that their new devices could be as
good as the iPhones. But I get nothing for it, not even a reply, just a
mail saying "we have passed along your message to the appropriate person".—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-42303834
.
To clarify, is Visualizer broken for all music apps on the S5, not just
ones that don't use OpenSL ES?
I'm sadly not totally sure about this so I can only guess.
The problem with OpenSL ES is the "FAST_TRACK"-flag which can be set by the
developers (users of OpenSL ES) and/or the Android-system like inside the
ToneGenerator.cpp.
This FAST_TRACK is a special thread/pipe inside AudioFlinger which gets
directly passed to the underlying drivers (audio.primary.xxx.so) and
therefor bypassing the audio-effects.
On most devices, only 1 FAST_TRACK can be used and that's also the reason
why such "hacks" like grabbing the first media-player-object of the device,
feed it with 1m of MP3-audio and let it staying around.. may help.
On newer devices, like the S5, it's also theoretically possible to increase
the number of fast-tracks manually via the build.prop, but that's not used
at the moment.
Sadly, at least 1 FAST_TRACK is used, so setting that new property to 0
won't help preventing the FAST_TRACK.
BUT: I think that FAST_TRACK is not the new problem on the S5, this is
furthermore the the "DSP Offloading" where the whole processing of the
audio-data is offloaded to the audio-driver (MP3-decoding etc.).
This should heavily reduce CPU-usage, but would also bypass our standard
visualizer-effect.
To continue provide a visualizer-effect, the manufacturer should also have
implemented an audio-effect supporting the "offloading". That effect would
then get called in case the audio is offloaded and it has to interact with
the audio-driver.
And I think, that's the clue at the moment.. I assume this offload-effect
is not well implemented by Samsung or whomever.
2014-05-06 16:07 GMT+02:00 cypherdare notifications@github.com:
To clarify, is Visualizer broken for all music apps on the S5, not just
ones that don't use OpenSL ES?On Tue, May 6, 2014 at 9:48 AM, mobilevisuals notifications@github.comwrote:
I see, I really hope that someone has a solution for this. S5 will soon
be
the most popular Android device. It is a pity that we have to put this
device as incompatible with our apps.I am really dissapointed with Samsung. The developers have informed them
that their new Galaxy devices can not handle music visualization, which
is
an Android standard supported in the SDK. They still release another top
device without support for music visualization.I wanted to help out and inform them so that their new devices could be
as
good as the iPhones. But I get nothing for it, not even a reply, just a
mail saying "we have passed along your message to the appropriate
person".—
Reply to this email directly or view it on GitHub<
https://github.com/felixpalmer/android-visualizer/issues/5#issuecomment-42303834>.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-42306230
.
No music visualization seem to work on S5. One customer however said that it works on "ProjectM Visualizer". They must have done something to fix it for that app.
Hi I've been trying to get a visualiser to work too. I've been testing it on a s4 i9505 and the fix doesn't appear to do anything. (this is all without the fix) The visualiser works the first time you install it(as mentioned above) but if you skip tracks it stops. It also starts working if you let a track end and automatically go to the next track. It will stop working again if you change tracks using the next and previous buttons. If you restart the phone then the visualiser will work and also let you skip tracks and still will work but will stop working at some point. One time it stopped working when I removed it from the last used apps window and loaded it up again and once it worked after removing it from there and then stopped working when i force closed it. Sooo I don't really know if this is helpful but I hope it is.
Also this is all with googles music player. If I use rocket player it all works completely fine.
Has any one tried with and without the fix, doing exactly the same thing and found different results?
Anyone care to test the new Spotify app (they recently pulled their original and uploaded a nearly identical app with a different package name) on devices other than Nexus and Galaxy? I've found that it is somehow bypassing Visualizer on one of my devices (ASUS MeMoPad 10) that is otherwise unaffected by all of the above listed OS bugs.
@h6ah4i Hi! What about Nexus 7 2013 flo? I have CM11. But the app does not work... Is it possible to fix it?
@MikhailSakh Hi. I think this app (android-visualizer) works on Nexus 7 (2013, flo) with CM11. Do you use another visualizer app and player app?
I tested the latest CM11 (cm-11-20140809-NIGHTLY-flo.zip) and self-built AOSP on my Nexus 7 (2013, flo). The result was as the following;
- CyanogenMod 11
- MediaPlayer (audio session != 0): works properly
- MediaPlayer (audio session = 0): works properly
- OpenSL (PowerAmp, audio session = 0): doesn't work
- AOSP
- MediaPlayer (audio session != 0): works properly
- MediaPlayer (audio session = 0): works properly
- OpenSL (PowerAmp, audio session = 0): doesn't work
As you can see, the results are the same on CM11 and AOSP. Moreover, it's also the same on the Google's Official Factory Image.
@h6ah4i It's just doesn't start after install... I can send startlog, if its help.
Do the new Samsung devices still have this issue? I haven't got any complaints from customers for a long time about the music visualization, so it seems like the situation has improved. I have however not tested on the new devices, so I am not sure.
Yeah, that's weird. I haven't had complaints from Samsung users in a long
time either. But I'm getting tons of complaints from Nexus users who have
updated to Lollipop. I need to get a new Nexus device to check it out.
On Wed, Dec 24, 2014 at 7:27 AM, mobilevisuals notifications@github.com
wrote:
Do the new Samsung devices still have this issue? I haven't got any
complaints from customers for a long time about the music visualization, so
it seems like the situation has improved. I have however not tested on the
new devices, so I am not sure.—
Reply to this email directly or view it on GitHub
#5 (comment)
.
Tried on my Nexus 4 after upgrading to Lollipop. And the visualizer only returns zeros on the output mix. If however you are able to get the specific audioSessionID It is possible to get data. I would guess it is some kind of privacy setting, but I havent been able to find anything in the release notes or on the phone itself.
Maybe a workaround could be searching through IDs
On Wed, Dec 24, 2014 at 7:27 AM, mobilevisuals notifications@github.com wrote: Do the new Samsung devices still have this issue? I haven't got any complaints from customers for a long time about the music visualization, so it seems like the situation has improved. I have however not tested on the new devices, so I am not sure.
— Reply to this email directly or view it on GitHub #5 (comment) .
Hi, I used the visualizer recently in my app. It works nicely in the Samsung Galaxy S5. I tried it on a Samsung Galaxy SIII and it won't work, plus it sometimes crashes the app (not always). I might just have to remove it from view if it's on that list of devices listed on here. Too bad. Looking forward if someone finds a working solution. Thanks.
It might be a manifest permission problem. You may need to also provide microphone permissions with visualizer in Android 5+ I think because of the way it accesses the mixer ...
No one has bothered posting any logcat info. This is the first thing to look at, esp during a major version OS smackdown like Lollipop. Lots of permissions have tightened up.
noni-mizu : That is because Samsung released lots of garbage mobiles a few years ago, like S4 mini. Now they are finally releasing good mobiles again, like the S6. We have tested on S6 and it supports music visualization, but some music players don't work like Spotify.
Does anyone know if this is the same reason the visualizer doesn't work on an Amazon Fire TV?
It is obviously a cross platform issue with android's Visualizer class. This is an experimental CPU-bound FFT class with many restrictions stated in the very limited docs.
Some devices restrict access to the linux driver streams (like audio). This is esp. true of hardware-secured "consumer appliance" type devices like Fire, Chromecast, etc. Even granting root permission may not resolve this.
This thread mentions many of the devices that it does work on, so app devs can restrict playstore distribution to devices that are known to work.
GPU-bound FFT would be a better solution for DSP, but still would encounter the permissions issues on some devices.
I do suspect that audio session 0 is (should be) deprecated and Visualizer's documentation has failed to mention it, which is unsurprising given how sparse its documentation is. If you look at the AudioEffect documentation, it has listed audio session 0 as deprecated since three years ago. Here's the commit where it was deprecated.
Session 0 is (was) an aggregate of all audio sessions, which represent(ed) a security issue.
I think this is mentioned in associated docs for audio. Visualizer should only be passed specific sessions.
Hi,
I'm having the same problem with S6 Edge+, where only operate the equalizer and visualization effects to the connected Bluetooth.
The problem also happens to the sound settings and equalizer. There were several music players tested and with any MP3 music.
Applications that did not work:
Dub Music Player + Equalizador: https://play.google.com/store/apps/details?id=hr.palamida
Anytime Visualizer: https://play.google.com/store/apps/details?id=noh.jinil.app.anytime
MusiX Player PRO: https://play.google.com/store/apps/details?id=com.mobineon.musix
The effect of viewing only works when converted to MP3 music for another extension, for example OGG.
The following illustration as an example:

I'm downloading and testing various music applications with visual effects and equalizer and among them one that follows is working:
https://play.google.com/store/apps/details?id=com.onkyo.jp.maidenaudio
or
https://play.google.com/store/apps/details?id=com.onkyo.jp.musicplayer
Why does it happen?
Thanks
Florencio Mello
fcbmello@gmail.com
Please see the comment above about the session number. These apps are likely passing insecure sessions (session 0), that bluetooth is somehow allowing. You should contact the apps developers directly. I am sure they will appreciate your free QA (and awesome graphics).
Thanks for the reply, which leaves me in doubt is that my wife has a Galaxy S6 Edge (not plus) and everything works.
Still, I will contact the application developer.
There are many factors than can cause this.
The version of android on the phone.
The codecs and DRM on the phone.
DRM is not a big selling point for manufacturers, so they generally do not advertise it.
Since equalizers need permission to decode DRM media, I would assume this is the case.
You should try other audio files that do not have DRM protection and see if that makes a difference.
Also look into the system log (adb/logcat) - that will have all the information about what is going on.
So, I have in last week built a test app (in real it is a Titanium module -- anyway)
The visualizer works fine on Caterpillar S40 (Android5.1) and on OnePlus (Android4.4). It works with ID=0 and bind on special id. Further it works with Mediaplayer and with the module https://github.com/trevorf/ti-android-streamer which based on https://github.com/vbartacek/aacdecoder-android (Audiotrack)
Additional I have tested with my NEXUS5 and NEXUS6P -- both devices works with Marshmellow.
Although I request MICROPHONE and AUDIO_RECORDING permission => I see nothing. The Tunnelplayer workaround is switched on and I start it as first. Nothing.
Hello All. I had stuck with this problem too. I develope application with VU-meters and need mixed audio volume including music. But I have got proper signal from microphone not from Visualizer(0). The "silent player" workaround by @h6ah4i probably won't help to me. I had downloaded and installed his Music Visualizer 1.6.6 - it shows vizs only when "player" and "microphone" modes. But in "snoop" mode vizs are not active. My device is not from Samsung or HTC - I test program on rather old Huawei MediaPad S7-301 with Android 4.0.3 (API 15). I got signal from Visualizer only when my device plays system sounds but not music. I tried different players including several rare progs. So strange cause Android on old Huawei devices is known as "native" - it wasn't redesigned, it was used "as Google made" instead.
And what is MOST strange for me - once I saw output from Visualizer. I cannot yet tell what I did before cause it was first app start at morning. First 1024 bytes block of incoming data contained defenitely positive audio level values. I saw them in debug output. But all next data contained silence.
Added.
Yes - my MediaPad is based on Snapdragon. I've got Visualizer 1.6.6 snoop mode working with Google Player. But with rare Folder Player it does not work. Even I have got working my VU-meters with ServeStream streaming player. Probably VU-meters should work using silent MediaPlayer. But I have no idea how give access to silent mp3 file for Java code. I can attach this file to Qt project rsources but path works only for Qt-based code.
Added.
Yes - my MediaPad is based on Snapdragon. I've got Visualizer 1.6.6 snoop mode working with Google Player. But with rare Folder Player it does not work. Even I have got working my VU-meters with ServeStream streaming player. Probably VU-meters should work using silent MediaPlayer. But I have no idea how give access to silent mp3 file for Java code. I can attach this file to Qt project rsources but path works only for Qt-based code.
Added.
I have created silent MediaPlayer and added short beep.mp3 file to android/assets folder in Qt project. To Java init code I have added following lines:
private static MediaPlayer mP;
......
try {
AssetFileDescriptor d = QtNative.activity().getAssets().openFd("beep.mp3");
mP = new MediaPlayer();
mP.stop();
mP.reset();
mP.setDataSource(d.getFileDescriptor(), d.getStartOffset(), d.getLength());
mP.prepare();
mP.start();
d.close();
} catch (IOException e){e.printStackTrace();}
I have build project and first ensured that my tablet beeped while starting my VU-meter. Then I commented mP.start() then rebuild and run program again. The result surprised me a lot! I have got working VU-meter with FolderPlayer - but Visualizer 1.6.6 did not work with it in shoop mode. But what is most surprising - VU-meter does NOT work with stock Google Player. But Visualizer 1.6.6 DOES. I'm finally weird with these Android bugs...
Things are going more strange. At next day I started my VU-meter and FolderPlayer right now after it. But... VU-meter did not work with FolderPlayer. Then I started Google Player - and VU-meter DID work with it. Before run Google Player I did not close FolderPlayer - just paused it. That means - FolderPlayer occupied MediaPlayer serivce and it forced Google Player play around tunnelling. But... I run MY VU-meters before it - it occupies MediaPlayer at first. I even added mP.start(); mP.pause(); to my code - to be sure MediaPlayer stays on pause. But this didn't help. What does this all mean? First - on my tablet players can occupy hardware music tunnel and force other players use software stream instead. Second - MediaPlayer "prepare" and even "strat/pause" trick does not work as needed. It does not occupy hardware tunnel. What is strange for me - even if I start sound without pause, then I always get debugging message in IDE: "MediaPlayer( 3748): start() mUri is null". Even "MediaPlayer( 3748): stop() mUri is null" appears when I turn off MediaPlayer mannually.
Finally I completely removed code with silent MediaPlayer - behavior remained the same. First started player blocks hardware channel then second plays through software. And my VU-meter shows it's level. I returned to the beginning and will look how fix this again.
