TarsosDSP间距分析傻瓜 [英] TarsosDSP Pitch Analysis for Dummies
问题描述
我在沃金的分析声音文件的音调一progarm。我碰到一个叫TarsosDSP很好的API,它提供了各种音调分析。但是我遇到了很多麻烦设置它。可有人告诉我如何使用这个API(espically的PitchProcessor类),请一些快速的指针? code的一些片段将是极其AP preciated因为我在声音分析真正的新。
I am woking on a progarm that analyze the pitch of a sound file. I came across a very good API called "TarsosDSP" which offers various pitch analysis. However I am experiencing a lot of trouble setting it up. Can someone show me some quick pointers on how to use this API (espically the PitchProcessor class) please? Some snippets of code would be extremely appreciated because I am really new at sound analysis.
感谢
编辑:我发现了一些文件在的http://稻壳.eecs.berkeley.edu /课程/ cs160-SP14 / index.php文件/ Sound_Programming 那里有一些例子,code,显示如何设置PitchProcessor,...
I found some document at http://husk.eecs.berkeley.edu/courses/cs160-sp14/index.php/Sound_Programming where there are some example code that shows how to setup the PitchProcessor, …
int bufferReadResult = mRecorder.read(mBuffer, 0, mBufferSize);
// (note: this is NOT android.media.AudioFormat)
be.hogent.tarsos.dsp.AudioFormat mTarsosFormat = new be.hogent.tarsos.dsp.AudioFormat(SAMPLE_RATE, 16, 1, true, false);
AudioEvent audioEvent = new AudioEvent(mTarsosFormat, bufferReadResult);
audioEvent.setFloatBufferWithByteBuffer(mBuffer);
pitchProcessor.process(audioEvent);
...我完全迷失了方向,究竟是什么mBuffer和mBufferSize?如何找到这些价值?而我在哪里输入我的音频文件?
…I am quite lost, what exactly are mBuffer and mBufferSize? How do I find these values? And where do I input my audio files?
推荐答案
音频在TarsosDSP框架的基本流程如下:从音频文件或一个麦克风始发传入的音频流被读出并切成的例如帧1024个样本。每一帧通过管道用于修改或分析(如间距分析),它的旅行。
The basic flow of audio in the TarsosDSP framework is as follows: the incoming audio stream originating from an audio file or a microphone is read and chopped into frames of e.g. 1024 samples. Each frame travels through a pipeline that modifies or analyses (e.g. pitch analysis) it.
在TarsosDSP的 AudioDispatcher
负责砍在帧的音频。此外,它封装了一个音频帧到 AudioEvent
对象。这 AudioEvent
目标是通过 AudioProcessors
链发送。
In TarsosDSP the AudioDispatcher
is responsible to chop the audio in frames. Also it wraps an audio frame into an AudioEvent
object. This AudioEvent
object is send through a chain of AudioProcessors
.
因此,在你报mBuffer是音频帧中的code,mBufferSize是在样品的缓冲区的大小。你可以选择自己的缓冲区大小但间距检测2048个样本是合理的。
So in the code you quoted mBuffer is the audio frame, mBufferSize is the size of the buffer in samples. You can choose the buffer size yourself but for pitch detection 2048 samples is reasonable.
有关基音检测,你可以做这样的事情的TarsosDSP库:
For pitch detection you could do something like this with the TarsosDSP library:
PitchDetectionHandler handler = new PitchDetectionHandler() {
@Override
public void handlePitch(PitchDetectionResult pitchDetectionResult,
AudioEvent audioEvent) {
System.out.println(audioEvent.getTimeStamp() + " " pitchDetectionResult.getPitch());
}
};
AudioDispatcher adp = AudioDispatcherFactory.fromDefaultMicrophone(2048, 0);
adp.addAudioProcessor(new PitchProcessor(PitchEstimationAlgorithm.YIN, 44100, 2048, handler));
adp.run();
在此code第一个处理程序创建了简单的打印检测到的音高。在添加 AudioDispatcher
附着到默认麦克风,并具有2048检测音调的音频处理器的缓冲区大小的 AudioDispatcher
。该处理器采用有作为。
In this code first a handler is created which simply prints the detected pitch. The AudioDispatcher
is attached to the default microphone and has a buffersize of 2048. An audio processor that detects pitch is added to the AudioDispatcher
. The handler is used there as well.
最后一行开始的过程。
这篇关于TarsosDSP间距分析傻瓜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!