0
0

Hello there.

I’m trying to get spectrum values which is played.

But there is problem. Although Different sound was played, spectrum value had always same values.

Here is my code.

[code:3gsfmudy]

mContext.cUpdate();
mContext.cRecordSound();

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }               

            mContext.cPlaySound();

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            result=mContext.cGetSpectrum(spectrum, SPECTRUM_SIZE);

=======================jni interface =======================================

jint Java_com_android_sensor_AndroidSensorActivity_cGetSpectrum(JNIEnv *env, jobject thiz, jfloatArray freq, jint size)
{
FMOD_RESULT result = FMOD_OK;
int position = 0;
jfloat spectrum[64]={0};

result= FMOD_Channel_GetSpectrum(gChannel, spectrum, 64, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE);

CHECK_RESULT(result);

(*env)->SetFloatArrayRegion(env,  freq, 0, 64, spectrum );   

return 0;

}

[/code:3gsfmudy]

I used recording example which is released with fmod lib.

Thank you for reading my topic.

BR JT Lee.

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.