Sound convertion to frequency in android [duplicate]

廉价感情. 提交于 2019-12-30 07:24:15

问题


Possible Duplicate:
Real time pitch detection
Determine the audio frequency of sound received via the microphone

I'm developing my own android guitar tuner. Here I will have to use the guitar note frequency. Therefore, I want to know how to convert the sound coming through the mic port into its frequency in android?


回答1:


EDIT: link dead ---This problem is already solved here---

I shall summarize the paper :

  1. Record stuff :

        int minSize = AudioRecord.getMinBufferSize(sampleRate,AudioFormat.
        CHANNEL_CONFIGURATION_MONO,
        AudioFormat.ENCODING_PCM_16BIT);
        AudioRecord audioInput = new AudioRecord(MediaRecorder.AudioSource.MIC, sampleRate,
        AudioFormat.CHANNEL_CONFIGURATION_MONO,
        AudioFormat.ENCODING_PCM_16BIT);
        minSize);
        ...
        short[] buffer = new short[readSize];
        audioInput.startRecording();
        audioInput.read(buffer, index, readSize); // record data from mic into buffer
    
  2. Anayze the frequency using FFT.

I'd say you record about 4 seconds of apply FFT on it. Like hotpaw2 says you have to use pitch estimation algorithms to determine the range of frequencies in recorded sound from the strum.




回答2:


You will need a pitch estimation algorithm (there have been many published, such as autocorrelation, ASDF/AMDF, cepstral processing, harmonic product spectrum, RAPT, YAAPT, etc.). Frequency estimation alone is not suitable for guitar tuning, as note pitch is different from spectral frequency.



来源:https://stackoverflow.com/questions/8928695/sound-convertion-to-frequency-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!