1

我想在 iOS5 上开发应用程序来获取语音并对其应用效果(高通滤波器、延迟等)并从扬声器输出。

我试过 RemoteIO(input) -> effect ->RemoteIO(output) 但它没有用。

AudioComponentDescription   cd;
cd.componentType            = kAudioUnitType_Output;
cd.componentSubType         = kAudioUnitSubType_RemoteIO;
cd.componentManufacturer    = kAudioUnitManufacturer_Apple;
cd.componentFlags           = 0;
cd.componentFlagsMask       = 0;

AUGraphAddNode(self.auGraph, &cd, &remoteIONode);
AUGraphNodeInfo(self.auGraph, remoteIONode, NULL, &remoteIOUnit);

UInt32  flag = 1;
AudioUnitSetProperty(remoteIOUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &flag, sizeof(flag));

AudioStreamBasicDescription audioFormat = [self auCanonicalASBDSampleRate:44100.0 channel:1];
AudioUnitSetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, &audioFormat, sizeof(AudioStreamBasicDescription));
AudioUnitSetProperty(remoteIOUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &audioFormat, sizeof(AudioStreamBasicDescription));  


AudioComponentDescription cd_e;

cd_e.componentSubType = kAudioUnitSubType_LowPassFilter;
cd_e.componentSubType = kAudioUnitSubType_Reverb2;
cd_e.componentFlags = 0;
cd_e.componentFlagsMask = 0;
cd_e.componentManufacturer = kAudioUnitManufacturer_Apple;
AUGraphAddNode(self.auGraph, &cd_e, &effectNode);
AUGraphNodeInfo(self.auGraph, effectNode, NULL, &effectUnit);

AudioUnitSetProperty(effectUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Global, 0, &audioFormat, sizeof(AudioStreamBasicDescription));    


 AudioUnitSetParameter(effectUnit, kAudioUnitScope_Global, 0, kLowPassParam_CutoffFrequency, 10.f, 0);
 AudioUnitSetParameter(effectUnit, kAudioUnitScope_Global, 0, kLowPassParam_Resonance, 10, 0);

AUGraphConnectNodeInput(self.auGraph, remoteIONode, 1, effectNode, 0);
AUGraphConnectNodeInput(self.auGraph, effectNode, 0, remoteIONode, 0);

AUGraphInitialize(localGraph);

但是如果 AUGraphConnectNodeInput 设置为 bellow ,我会从扬声器中听到我的声音。

AUGraphConnectNodeInput(self.auGraph, remoteIONode, 1, remoteIONode, 0);

我该怎么做?

4

1 回答 1

1

我写了一个教程,详细介绍了如何在 iOS 上通过麦克风进行实时处理和录音,但从那时起,我发现了 novocaine 的乐趣这是在 iOS 上进行效果处理的一种更简单的方法。这比处理 AURemoteGraph 和那些东西要容易得多。

于 2012-06-21T07:04:52.530 回答