我試圖瞭解Superpowered SDK,但對於Android和C++以及音頻信號都是新的。我在這裏有頻域範例: https://github.com/superpoweredSDK/Low-Latency-Android-Audio-iOS-Audio-Engine/tree/master/Examples_Android/FrequencyDomainAndroid SuperPowered SDK音頻 - 頻域範例 - memset頻率操作
在我的Nexus 5X上運行。在FrequencyDomain.cpp文件:
static SuperpoweredFrequencyDomain *frequencyDomain;
static float *magnitudeLeft, *magnitudeRight, *phaseLeft, *phaseRight, *fifoOutput, *inputBufferFloat;
static int fifoOutputFirstSample, fifoOutputLastSample, stepSize, fifoCapacity;
#define FFT_LOG_SIZE 11 // 2^11 = 2048
static bool audioProcessing(void * __unused clientdata, short int *audioInputOutput, int numberOfSamples, int __unused samplerate) {
SuperpoweredShortIntToFloat(audioInputOutput, inputBufferFloat, (unsigned int)numberOfSamples); // Converting the 16-bit integer samples to 32-bit floating point.
frequencyDomain->addInput(inputBufferFloat, numberOfSamples); // Input goes to the frequency domain.
// In the frequency domain we are working with 1024 magnitudes and phases for every channel (left, right), if the fft size is 2048.
while (frequencyDomain->timeDomainToFrequencyDomain(magnitudeLeft, magnitudeRight, phaseLeft, phaseRight)) {
// You can work with frequency domain data from this point.
// This is just a quick example: we remove the magnitude of the first 20 bins, meaning total bass cut between 0-430 Hz.
memset(magnitudeLeft, 0, 80);
memset(magnitudeRight, 0, 80);
我理解的前20個箱是如何從0-430赫茲的位置: How do I obtain the frequencies of each value in an FFT?
,但我不明白的80 memset的價值...是4 * 20,它是4個字節的浮動* 20個分檔? magnitudeLeft是否保存所有頻率的數據?那麼我將如何刪除,例如,從中間或最後的10個頻率的箱子?謝謝!