1

I would like to develop application on iOS5 that get voice and apply effect(high pass filer, delay, and so on) to it and output it from speaker.

I tried RemoteIO(input) -> effect ->RemoteIO(output) but it didn't work.

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);

But if AUGraphConnectNodeInput set bellow , I heard my voice from speaker.

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

how do i do it?

user1468755
  • 11
  • 1
  • 3
  • Why didn't copying audio into the RemoteIO output callback work for you? – hotpaw2 Jun 20 '12 at 16:19
  • RemoteIO->Converter->Effect->Converer->RemoteIO! I SEE. – user1468755 Jun 26 '12 at 08:28
  • Hi do you still have your code? My problem is, I simply want to hear my voice from the speaker but instead heard really high-pitched noise. Since in your question you said you were able to hear your voice after connecting IONode input with IONode output. – nyus2006 Jan 09 '19 at 11:57

1 Answers1

1

I wrote a tutorial detailing how to do realtime processing and recording from the microphone on iOS, but since then, I have discovered the joys of novocaine, which is a much easier way of doing effect processing on iOS. This is much easier than dealing with AURemoteGraph and that stuff.

Nik Reiman
  • 39,067
  • 29
  • 104
  • 160