-
Notifications
You must be signed in to change notification settings - Fork 279
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
Making visualization independent of the volume #19
Comments
Has anyone found a solution to this? It is very annoying that this works on iOS, but not on Android. |
I can't find a solution either, did someone found a fix already? |
I tried the second code and it seems worked! I was use the Locamedia App(A mediaplayer running backgroung in service), then the visualizer is in another App. oh,sorry, It`s on Android. BTW,I test mEqualizer.setEnabled(true) ,mVisualizer.setEnabled(true) .but the visualization still depends on volume |
There is a method on the Visualizer class called SetScalingMode - have you tried that? |
I'm encountering the same problem. I'm enabling the equalizer, setting the scaling mode to normalized, and still getting audio-dependent FFT data for a Visualizer with an |
If the volume is high, the FFT values are also higher. This will make the music visualization dependent on the volume, which is not a good thing. It should be the same visualization for low and high volumes. I found an interesting and easy solution to that problem:
http://stackoverflow.com/questions/8048692/android-visualizer-fft-waveform-affected-by-device-volume
It works for apps, which have their own music player, because they then have a MediaPlayer object. The Equalizer and the Visualizer must have the same audio session id for this to work. That session id belongs to the MediaPlayer object.
The problem is that it does not work for external media players, like Spotify. The visualization becomes dependent on the volyme there. There is no option get a handle to a mediaplayer object for Spotfify, so I have to set the audioSessionID to 0. This means any player currently used. This will however make the volume code not work.
Has someone a good suggestion to make this work on external players too? It would help me a lot to keep improving my apps. The following are the code i added to the apps. The first code works and is for apps with their own player . The second code is for external players like Spotify and it does not work.
// Create the Visualizer object and attach it to our media player.
mVisualizer = null;
int sessionId = player.getAudioSessionId();
mEqualizer = new Equalizer(0, sessionId);
mEqualizer.setEnabled(true);
mVisualizer = new Visualizer(sessionId);
External players:
mVisualizer = null;
int sessionId = 0;
mEqualizer = new Equalizer(0, sessionId);
mEqualizer.setEnabled(true);
mVisualizer = new Visualizer(sessionId);
The text was updated successfully, but these errors were encountered: