Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Visualizer FFT / waveform affected by device volume?

I'm working on some music analysis using the Visualizer class on Android 2.3.1. I am finding that the FFT and waveform magnitudes are affected by the volume of the device. This means that if the user has the volume turned down I receive little or not FFT data.

I've tested this on a Motorola Xoom, Samsung Galaxy Tab and the emulator and it behaves this way.

I am using the code below:

mp = new MediaPlayer();
mp.setDataSource("/sdcard/sine1.wav");
mp.prepare();
mp.setLooping(true);
mp.start();
int audioSessionID = mp.getAudioSessionId();
v = new Visualizer(audioSessionID);
v.setEnabled(true);

Looking at the docs for the Visualizer class it seems that if we are passing in a valid audio session id then the visualizer should operate upon this audio session. It appears that the Visualizer is operating upon the output mix.

Has anyone else encountered this or found a way around it?

Thanks

like image 932
user1035335 Avatar asked Nov 08 '11 10:11

user1035335


1 Answers

I was also facing the same problem, but it is working when i am enabled the Eqaulizer and Visualizer for same seession id.I dont know the reason for it ,i checked it remove the equalizer from visualizer class in api demos it is working as you said.

 Equalizer mEqualizer = new Equalizer(0, SessionId);
 mEqualizer.setEnabled(true); // need to enable equalizer
 Visualizer mVisualizer = new Visualizer(SessionId);
like image 197
Ramesh Akula Avatar answered Oct 23 '22 10:10

Ramesh Akula