Low pass sound filter computing RMS on iOS

I am working on an iPad App and I want to parse the audio from the video that I play. Everything is going well using MTAudioProcessingTap. I currently have test code for testing / measuring the volume of the left and right channels. Everything is going well:

void process(MTAudioProcessingTapRef tap, CMItemCount numberFrames,
         MTAudioProcessingTapFlags flags, AudioBufferList *bufferListInOut,
         CMItemCount *numberFramesOut, MTAudioProcessingTapFlags *flagsOut)
{
    OSStatus err = MTAudioProcessingTapGetSourceAudio(tap, numberFrames, bufferListInOut,
                                                  flagsOut, NULL, numberFramesOut);

    if (err)
        NSLog(@"Error from GetSourceAudio: %ld", err);

    float leftVolume, rightVolume;

    for (CMItemCount i = 0; i < bufferListInOut->mNumberBuffers; i++)
    {
        AudioBuffer *pBuffer = &bufferListInOut->mBuffers[i];
        int cSamples = numberFrames * pBuffer->mNumberChannels;

        float *pData = (float *)pBuffer->mData;

        float rms = 0.0f;

        for (int j = 0; j < cSamples; j++)
        {
            rms += pData[j] * pData[j];

        }

        if (cSamples > 0)
        {
            rms = sqrtf(rms / cSamples);
        }

        if (0 == i)
        {
            leftVolume = rms;
        }

        if (1 == i || (0 == i && 1 == bufferListInOut->mNumberBuffers))
        {
            rightVolume = rms;
        }
    }

    NSLog(@"Left / Right Volume: %f / %f", leftVolume, rightVolume);
}

But for this application, I just want to measure the RMS ("intensity") of the 0-80 Hz range (as an example). So I need a low pass filter.

I have been working at Googling for a long time, but my problem is that I can not find any notes, tutorial or solutions that are obvious. Almost every problem that sounds like mine has a random piece of code underneath it with crappy or lack of comments, so I can't figure out what all the magic numbers do there and what they mean.

- ? , do .

+5
1

, .: -)

- . , , , .

. .

, , , :

: - , , 0..80Hz. - , , , . RMS .

: .

. . , , , ( ).

FT ( ). , FFT ( ).

: FT .

, ?

0-80 , . . , 80 .

, , , FFT. ( , , ( ).)

, FT-multiply-FT, FT ( ). FT ( ) - : sinc().

sinc(x) := sin(pi*x) / pi*x

sinc (x) . , . , .

- : FIR. , , < 80 80 .

.

BTW: FFT, - , , . (Windowing () FFT.) , .

, FIR, . , , , .

, "" , , "" . 82 ( ), . 80 , . , 120 10% 120 , 80 ( ).

: https://ccrma.stanford.edu/~jos/sasp/FIR_Digital_Filter_Design.html

, : https://ccrma.stanford.edu/~jos/sasp/sasp.html

FIR- sinc.

, . , .

.

. , , - FFT , . , , RMS. iPad .

(I just saw that there is http://dsp.stackexchange.com for signal processing .)

+16
source

All Articles