Hello to all! Captcha the entire outgoing audio stream from android using android.media.audiofx.Visualizer

At the same time, everything works well on one phone, but on the other (when played with its own player written in C), the audio stream does not kapchitsya (everything is played correctly), but

 onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) 

all the time returns an array fft [] = {0,0,0....0,0} - 1024 zeros, regardless of what is playing or not playing.

If someone knows the possible reason for the incorrect work please write. The phone on which the new with android 4.2 does NOT work, on 2.3 4.1 and 4 everything works.

    1 answer 1

    As a hypothesis:

    Several new constants and methods for capturing audio content have appeared in API 16, in particular:

    public static final int SCALING_MODE_AS_PLAYED
    This will make it possible to record the data. Sample values ​​and fft values, and vice-versa.

    In Russian, this means that if the volume is set to zero, there will be no sampling. Dig around this ... Maybe just on devices with API 16, the default quality is zero and you need to prescribe public int setScalingMode (int mode) so that the universal code makes sense to organize a call to this function through reflection (since the method is available only for API 16 )

    • As if everything is normal there kapchitsya if you lose with the help of the built-in android player. For some reason, another player who samopisny, does not kapchitsya. Thank you very much, I will test and accomplish your goal until I close the question. - Alexbelk