安卓系统中的声音转换为频率[英] Sound convertion to frequency in android

本文是小编为大家收集整理的关于安卓系统中的声音转换为频率的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

可能的副本:
实时音高检测 通过麦克风确定声音的音频频率

我正在开发自己的Android吉他调谐器.在这里,我必须使用吉他音符频率.因此,我想知道如何将通过麦克风端口转换为其频率在Android中的声音?

推荐答案

编辑:链接死亡---这个问题已经解决了这里 ---

我将总结论文:

  1. 记录的东西:

        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. 使用FFT将频率的频率.

我会说你录制约4秒的应用FFT.与HotPaw2一样说,您必须使用音高估计算法来确定来自Strum的记录声音中的频率范围.

其他推荐答案

您需要一个音高估计算法(已经发表许多发布,例如自相关,ASDF/AMDF,临时谱处理,谐波产品谱,RAPT,YaApt等).单独的频率估计不适用于吉他调谐,因为音符间距与光谱频率不同.

本文地址:https://www.itbaoku.cn/post/102649.html

问题描述

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?

推荐答案

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.

其他推荐答案

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.