Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusting phase #103

Open
peterfealey opened this issue Jan 21, 2015 · 0 comments
Open

Adjusting phase #103

peterfealey opened this issue Jan 21, 2015 · 0 comments

Comments

@peterfealey
Copy link

I'm currently learning iOS development (as a bit of a hobby mainly) I have a deep interest in Audio and Music, and was just playing around with trying to put something together for a basic recording app that I could use to make phase adjustments to microphone input. I've used the basic playthru example as a starting point and wondered if someone might give me some pointers as to how to achieve phase inversion, thus far my attempts haven't yielded anything. On the fly would be cool so people could 'preview' and adjust settings as necessary. Here's my snippet:

    // Trying Phase cancellation
    [self.audioManager setInputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels) {
        float volume = 10;
        vDSP_vsmul(data, 1, &volume, data, 1, numFrames*numChannels);
        for (int i = 0; i < numFrames * numChannels; i++) {
            printf("Data in: %f\n", data[i]);
     // This should flip the phase 180 degrees, in principle?
            data[i] = -data[i];
            printf("Data Out: %f\n", data[i]);
        }
        wself.ringBuffer->AddNewInterleavedFloatData(data, numFrames, numChannels);
    }];

    [self.audioManager setOutputBlock:^(float *outData, UInt32 numFrames, UInt32 numChannels) {
        wself.ringBuffer->FetchInterleavedData(outData, numFrames, numChannels);
    }];

Any help would be gratefully received! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant